Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,11 +4,31 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
| 4 |
import torch
|
| 5 |
import time
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
|
| 8 |
import os
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
torch.random.manual_seed(0)
|
| 14 |
"""
|
|
|
|
| 4 |
import torch
|
| 5 |
import time
|
| 6 |
from datetime import datetime
|
| 7 |
+
import shutil
|
| 8 |
|
| 9 |
import os
|
| 10 |
+
folder_path = "./models" # Change the folder name if needed
|
| 11 |
|
| 12 |
+
if not os.path.exists(folder_path):
|
| 13 |
+
os.makedirs(folder_path)
|
| 14 |
+
print(f"β
Folder created: {folder_path}")
|
| 15 |
+
else:
|
| 16 |
+
print(f"π Folder already exists: {folder_path}")
|
| 17 |
+
|
| 18 |
+
# Define source file and destination folder
|
| 19 |
+
source_file = "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"
|
| 20 |
+
destination_folder = "./models"
|
| 21 |
+
|
| 22 |
+
# Copy the file
|
| 23 |
+
shutil.copy(source_file, destination_folder)
|
| 24 |
+
|
| 25 |
+
model_path = "./models/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf" # Adjust if necessary
|
| 26 |
+
|
| 27 |
+
if os.path.exists(model_path):
|
| 28 |
+
print(f"β
Model found at: {model_path}")
|
| 29 |
+
else:
|
| 30 |
+
print(f"β Model not found at: {model_path}")
|
| 31 |
+
print("π Available files:", os.listdir("./models"))
|
| 32 |
|
| 33 |
torch.random.manual_seed(0)
|
| 34 |
"""
|