Download link for models

#52
by codecrypt112 - opened

I cannot able to find a link to download. It just redirect me to the same page.

Me too, the link to downloading the weights isn't working

I have created a simple python script, that downloads the .safetensors in the huggingface repo. The size of the this model goes more than 360GB. I am not sure if this script actually useful, as i couldnt download fully because of my storage constrain. But sure the models are downloaded.

import requests
from tqdm import tqdm
import getpass

# Base URL for the models
base_url = "https://huggingface.co/deepseek-ai/DeepSeek-V3/resolve/main/"

# Directory to save the models
save_dir = "mymodels"
os.makedirs(save_dir, exist_ok=True)

# Number of models to download
num_models = 163

hf_token = getpass.getpass("Enter your Hugging Face API token: ")
def download_model(model_number):
    file_name = f"model-{model_number:05d}-of-{num_models:06d}.safetensors"
    url = f"{base_url}{file_name}?download=true"
    save_path = os.path.join(save_dir, file_name)
    
    # Download the file with authentication
    print(f"Downloading {file_name}...")
    response = requests.get(url, stream=True, headers={"Authorization": f"Bearer {hf_token}"})
    if response.status_code == 200:
        # Get the total file size from headers
        total_size = int(response.headers.get('content-length', 0))
        with open(save_path, 'wb') as f:
            with tqdm(total=total_size, unit='B', unit_scale=True, unit_divisor=1024) as pbar:
                for chunk in response.iter_content(chunk_size=8192):
                    f.write(chunk)
                    pbar.update(len(chunk))
        
        print(f"Saved {file_name} to {save_path}")
    else:
        print(f"Failed to download {file_name}. Status code: {response.status_code}")

for i in range(1, num_models + 1):
    download_model(i)

print("All downloads completed.")```

Sign up or log in to comment