MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / http_get

Function http_get

Megatron-LM/data_utils/file_utils.py:166–175  ·  view source on GitHub ↗
(url, temp_file)

Source from the content-addressed store, hash-verified

164
165
166def http_get(url, temp_file):
167 req = requests.get(url, stream=True)
168 content_length = req.headers.get('Content-Length')
169 total = int(content_length) if content_length is not None else None
170 progress = tqdm(unit="B", total=total)
171 for chunk in req.iter_content(chunk_size=1024):
172 if chunk: # filter out keep-alive new chunks
173 progress.update(len(chunk))
174 temp_file.write(chunk)
175 progress.close()
176
177
178def get_from_cache(url, cache_dir=None):

Callers 1

get_from_cacheFunction · 0.70

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected