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

Function http_get

BingBertSquad/turing/file_utils.py:162–171  ·  view source on GitHub ↗
(url, temp_file)

Source from the content-addressed store, hash-verified

160
161
162def http_get(url, temp_file):
163 req = requests.get(url, stream=True)
164 content_length = req.headers.get('Content-Length')
165 total = int(content_length) if content_length is not None else None
166 progress = tqdm(unit="B", total=total)
167 for chunk in req.iter_content(chunk_size=1024):
168 if chunk: # filter out keep-alive new chunks
169 progress.update(len(chunk))
170 temp_file.write(chunk)
171 progress.close()
172
173
174def 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