Upload folder using huggingface_hub
Browse files- README.md +9 -3
- example_usage.py +9 -3
README.md
CHANGED
@@ -64,9 +64,15 @@ import torch
|
|
64 |
import numpy as np
|
65 |
import importlib.util
|
66 |
|
67 |
-
# Load model - architecture
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# Load the data collator (included in this repo)
|
72 |
collator_file = hf_hub_download(repo_id="videoloc/seamless-basic", filename="data_collator.py")
|
|
|
64 |
import numpy as np
|
65 |
import importlib.util
|
66 |
|
67 |
+
# Load model - custom architecture requires importing the model class
|
68 |
+
model_files = hf_hub_download(repo_id="videoloc/seamless-basic", filename="modeling_seamless_basic.py")
|
69 |
+
spec = importlib.util.spec_from_file_location("modeling_seamless_basic", model_files)
|
70 |
+
modeling_module = importlib.util.module_from_spec(spec)
|
71 |
+
spec.loader.exec_module(modeling_module)
|
72 |
+
|
73 |
+
# Now load the model using the custom class
|
74 |
+
config = modeling_module.SeamlessBasicConfig.from_pretrained("videoloc/seamless-basic")
|
75 |
+
model = modeling_module.HFSeamlessBasic.from_pretrained("videoloc/seamless-basic")
|
76 |
|
77 |
# Load the data collator (included in this repo)
|
78 |
collator_file = hf_hub_download(repo_id="videoloc/seamless-basic", filename="data_collator.py")
|
example_usage.py
CHANGED
@@ -8,9 +8,15 @@ import numpy as np
|
|
8 |
import importlib.util
|
9 |
|
10 |
def load_model_and_collator():
|
11 |
-
# Load model - architecture
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Load data collator
|
16 |
collator_file = hf_hub_download(repo_id="videoloc/seamless-basic", filename="data_collator.py")
|
|
|
8 |
import importlib.util
|
9 |
|
10 |
def load_model_and_collator():
|
11 |
+
# Load model - custom architecture requires importing the model class
|
12 |
+
model_files = hf_hub_download(repo_id="videoloc/seamless-basic", filename="modeling_seamless_basic.py")
|
13 |
+
spec = importlib.util.spec_from_file_location("modeling_seamless_basic", model_files)
|
14 |
+
modeling_module = importlib.util.module_from_spec(spec)
|
15 |
+
spec.loader.exec_module(modeling_module)
|
16 |
+
|
17 |
+
# Now load the model using the custom class
|
18 |
+
config = modeling_module.SeamlessBasicConfig.from_pretrained("videoloc/seamless-basic")
|
19 |
+
model = modeling_module.HFSeamlessBasic.from_pretrained("videoloc/seamless-basic")
|
20 |
|
21 |
# Load data collator
|
22 |
collator_file = hf_hub_download(repo_id="videoloc/seamless-basic", filename="data_collator.py")
|