Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,23 +69,25 @@ repo_dir = snapshot_download(
|
|
| 69 |
force_download=True # Forces redownload
|
| 70 |
)
|
| 71 |
|
| 72 |
-
print("the parent Directory is ", os.listdir(repo_dir))
|
| 73 |
|
| 74 |
-
#
|
| 75 |
-
|
|
|
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
adapter_config_path = os.path.join(fine_tuned_model_path, "adapter_config.json")
|
| 78 |
|
| 79 |
print("Downloaded Model Path:", fine_tuned_model_path)
|
| 80 |
print("Files in Model Directory:", os.listdir(fine_tuned_model_path))
|
| 81 |
|
|
|
|
| 82 |
if not os.path.exists(adapter_config_path):
|
| 83 |
raise FileNotFoundError(f"adapter_config.json not found in {fine_tuned_model_path}. Check if the model was downloaded correctly.")
|
| 84 |
|
| 85 |
-
# Verify the model path
|
| 86 |
-
if not os.path.exists(fine_tuned_model_path):
|
| 87 |
-
raise FileNotFoundError(f"Fine-tuned model not found at {fine_tuned_model_path}")
|
| 88 |
-
|
| 89 |
|
| 90 |
|
| 91 |
|
|
|
|
| 69 |
force_download=True # Forces redownload
|
| 70 |
)
|
| 71 |
|
|
|
|
| 72 |
|
| 73 |
+
# Step 2: Change the working directory to the downloaded snapshot directory
|
| 74 |
+
# This ensures that all relative paths inside your private space code are correctly resolved.
|
| 75 |
+
os.chdir(repo_dir)
|
| 76 |
|
| 77 |
+
# Verify the parent directory to check the files
|
| 78 |
+
print("The parent directory is:", os.listdir(repo_dir))
|
| 79 |
+
|
| 80 |
+
# Step 3: Correctly access the fine-tuned model directory in the snapshot
|
| 81 |
+
fine_tuned_model_path = "./fine_tuned_llama3" # Use the relative path as in your private space
|
| 82 |
adapter_config_path = os.path.join(fine_tuned_model_path, "adapter_config.json")
|
| 83 |
|
| 84 |
print("Downloaded Model Path:", fine_tuned_model_path)
|
| 85 |
print("Files in Model Directory:", os.listdir(fine_tuned_model_path))
|
| 86 |
|
| 87 |
+
# Step 4: Verify the existence of required files
|
| 88 |
if not os.path.exists(adapter_config_path):
|
| 89 |
raise FileNotFoundError(f"adapter_config.json not found in {fine_tuned_model_path}. Check if the model was downloaded correctly.")
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
|
| 93 |
|