Spaces:
Runtime error
Runtime error
Commit
·
1729d9d
1
Parent(s):
617cfd5
Update utils.py
Browse files
utils.py
CHANGED
@@ -6,6 +6,7 @@ import numpy as np
|
|
6 |
from PIL import Image
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
import json
|
|
|
9 |
|
10 |
def load_model_from_config(config_path, model_name, device='cuda'):
|
11 |
# Load the config file
|
@@ -15,7 +16,7 @@ def load_model_from_config(config_path, model_name, device='cuda'):
|
|
15 |
model = instantiate_from_config(config.model)
|
16 |
|
17 |
# Download the model file from Hugging Face
|
18 |
-
model_file = hf_hub_download(repo_id=model_name, filename="model.safetensors")
|
19 |
|
20 |
print(f"Loading model from {model_name}")
|
21 |
# Load the state dict
|
|
|
6 |
from PIL import Image
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
import json
|
9 |
+
import OS
|
10 |
|
11 |
def load_model_from_config(config_path, model_name, device='cuda'):
|
12 |
# Load the config file
|
|
|
16 |
model = instantiate_from_config(config.model)
|
17 |
|
18 |
# Download the model file from Hugging Face
|
19 |
+
model_file = hf_hub_download(repo_id=model_name, filename="model.safetensors", token=os.getenv('HF_TOKEN'))
|
20 |
|
21 |
print(f"Loading model from {model_name}")
|
22 |
# Load the state dict
|