Upload directory
Browse files
README.md
CHANGED
@@ -35,6 +35,7 @@ from huggingface_hub import hf_hub_download
|
|
35 |
import shutil
|
36 |
import os
|
37 |
import torch
|
|
|
38 |
|
39 |
|
40 |
# helpfer function to download huggingface repo and use model
|
@@ -55,8 +56,10 @@ def download(repo_id, path, HF_TOKEN=None):
|
|
55 |
def load_model_from_local_path(path, HF_TOKEN=None):
|
56 |
cwd = os.getcwd()
|
57 |
os.chdir(path)
|
|
|
58 |
model = AutoModel.from_pretrained(path, trust_remote_code=True, token=HF_TOKEN)
|
59 |
os.chdir(cwd)
|
|
|
60 |
return model
|
61 |
|
62 |
|
|
|
35 |
import shutil
|
36 |
import os
|
37 |
import torch
|
38 |
+
import sys
|
39 |
|
40 |
|
41 |
# helpfer function to download huggingface repo and use model
|
|
|
56 |
def load_model_from_local_path(path, HF_TOKEN=None):
|
57 |
cwd = os.getcwd()
|
58 |
os.chdir(path)
|
59 |
+
sys.path.insert(0, path)
|
60 |
model = AutoModel.from_pretrained(path, trust_remote_code=True, token=HF_TOKEN)
|
61 |
os.chdir(cwd)
|
62 |
+
sys.path.pop(0)
|
63 |
return model
|
64 |
|
65 |
|