Spaces:
Sleeping
Sleeping
Fix all import issues: use hf_hub_download and create proper Python package structure
Browse files- app.py +4 -4
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -17,12 +17,12 @@ def load_model():
|
|
| 17 |
print("Loading AbLang2 model...")
|
| 18 |
try:
|
| 19 |
# First, let's get the model directory and ensure all files are downloaded
|
| 20 |
-
from
|
| 21 |
|
| 22 |
# Download all necessary files
|
| 23 |
-
adapter_path =
|
| 24 |
-
config_path =
|
| 25 |
-
modeling_path =
|
| 26 |
|
| 27 |
cached_model_dir = os.path.dirname(adapter_path)
|
| 28 |
print(f"Model directory: {cached_model_dir}")
|
|
|
|
| 17 |
print("Loading AbLang2 model...")
|
| 18 |
try:
|
| 19 |
# First, let's get the model directory and ensure all files are downloaded
|
| 20 |
+
from huggingface_hub import hf_hub_download
|
| 21 |
|
| 22 |
# Download all necessary files
|
| 23 |
+
adapter_path = hf_hub_download("hemantn/ablang2", "adapter.py")
|
| 24 |
+
config_path = hf_hub_download("hemantn/ablang2", "configuration_ablang2paired.py")
|
| 25 |
+
modeling_path = hf_hub_download("hemantn/ablang2", "modeling_ablang2paired.py")
|
| 26 |
|
| 27 |
cached_model_dir = os.path.dirname(adapter_path)
|
| 28 |
print(f"Model directory: {cached_model_dir}")
|
requirements.txt
CHANGED
|
@@ -5,3 +5,4 @@ numpy==1.24.0
|
|
| 5 |
pandas==2.0.0
|
| 6 |
einops==0.7.0
|
| 7 |
rotary-embedding-torch==0.8.9
|
|
|
|
|
|
| 5 |
pandas==2.0.0
|
| 6 |
einops==0.7.0
|
| 7 |
rotary-embedding-torch==0.8.9
|
| 8 |
+
huggingface-hub>=0.19.0
|