Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,7 +72,6 @@ repo_dir = snapshot_download(
|
|
| 72 |
# The fine-tuned model is located in "fine_tuned_llama3" inside the Space
|
| 73 |
fine_tuned_model_path = os.path.join(repo_dir, "fine_tuned_llama3")
|
| 74 |
|
| 75 |
-
|
| 76 |
adapter_config_path = os.path.join(fine_tuned_model_path, "adapter_config.json")
|
| 77 |
|
| 78 |
if not os.path.exists(adapter_config_path):
|
|
@@ -91,23 +90,18 @@ print("Files in Model Directory:", os.listdir(fine_tuned_model_path))
|
|
| 91 |
sys.path.append(repo_dir)
|
| 92 |
|
| 93 |
# Load the base model
|
| 94 |
-
base_model = AutoModelForCausalLM.from_pretrained(
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
)
|
| 98 |
-
|
| 99 |
-
# Load fine-tuned adapter (PEFT)
|
| 100 |
-
fine_tuned_model = PeftModel.from_pretrained(base_model, fine_tuned_model_path)
|
| 101 |
-
|
| 102 |
-
# Load tokenizer
|
| 103 |
-
tokenizer = AutoTokenizer.from_pretrained(fine_tuned_model_path)
|
| 104 |
-
|
| 105 |
-
print("Fine-tuned model loaded successfully!")
|
| 106 |
-
|
| 107 |
-
|
| 108 |
|
|
|
|
|
|
|
| 109 |
|
|
|
|
|
|
|
| 110 |
|
|
|
|
| 111 |
|
| 112 |
|
| 113 |
# Download specific files (if snapshot_download wasn't used)
|
|
|
|
| 72 |
# The fine-tuned model is located in "fine_tuned_llama3" inside the Space
|
| 73 |
fine_tuned_model_path = os.path.join(repo_dir, "fine_tuned_llama3")
|
| 74 |
|
|
|
|
| 75 |
adapter_config_path = os.path.join(fine_tuned_model_path, "adapter_config.json")
|
| 76 |
|
| 77 |
if not os.path.exists(adapter_config_path):
|
|
|
|
| 90 |
sys.path.append(repo_dir)
|
| 91 |
|
| 92 |
# Load the base model
|
| 93 |
+
# base_model = AutoModelForCausalLM.from_pretrained(
|
| 94 |
+
# "meta-llama/Meta-Llama-3-8B",
|
| 95 |
+
# token=HF_TOKEN_LLAMA
|
| 96 |
+
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
+
# # Load fine-tuned adapter (PEFT)
|
| 99 |
+
# fine_tuned_model = PeftModel.from_pretrained(base_model, fine_tuned_model_path)
|
| 100 |
|
| 101 |
+
# # Load tokenizer
|
| 102 |
+
# tokenizer = AutoTokenizer.from_pretrained(fine_tuned_model_path)
|
| 103 |
|
| 104 |
+
# print("Fine-tuned model loaded successfully!")
|
| 105 |
|
| 106 |
|
| 107 |
# Download specific files (if snapshot_download wasn't used)
|