MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / download_file

Function download_file

docker/open_llama/hug_model.py:29–49  ·  view source on GitHub ↗
(url, destination)

Source from the content-addressed store, hash-verified

27 return magic, version
28
29def download_file(url, destination):
30 print(f"Downloading {url} to {destination}...")
31 response = requests.get(url, stream=True)
32 if response.status_code == 200:
33 with open(destination, 'wb') as f:
34 total_downloaded = 0
35 for chunk in response.iter_content(chunk_size=1024):
36 if chunk: # filter out keep-alive new chunks
37 f.write(chunk)
38 total_downloaded += len(chunk)
39 if total_downloaded >= 10485760: # 10 MB
40 print('.', end='', flush=True)
41 total_downloaded = 0
42 print("\nDownload complete.")
43
44 # Creating a symbolic link from destination to "model.bin"
45 if os.path.isfile("model.bin"):
46 os.remove("model.bin") # remove the existing link if any
47 os.symlink(destination, "model.bin")
48 else:
49 print(f"Download failed with status code {response.status_code}")
50
51def get_user_choice(model_list):
52 # Print the enumerated list

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…