Spaces:
Sleeping
Sleeping
AugustLight
commited on
Commit
•
4c2e13f
1
Parent(s):
edfdf40
Update app.py
Browse files
app.py
CHANGED
@@ -8,28 +8,26 @@ model = None
|
|
8 |
def load_model():
|
9 |
global model
|
10 |
try:
|
11 |
-
|
12 |
-
current_dir = os.getcwd()
|
13 |
-
files = os.listdir(current_dir)
|
14 |
-
print(f"Текущая директория: {current_dir}")
|
15 |
-
print(f"Список файлов: {files}")
|
16 |
|
17 |
-
#
|
18 |
-
model_path =
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
#
|
23 |
-
print("Начинаем загрузку модели...")
|
24 |
model = AutoModelForCausalLM.from_pretrained(
|
25 |
model_path,
|
26 |
model_type="llama",
|
27 |
context_length=2048,
|
28 |
gpu_layers=0,
|
29 |
-
threads=4
|
30 |
-
batch_size=8
|
31 |
)
|
32 |
-
print("Модель успешно
|
33 |
return model
|
34 |
|
35 |
except Exception as e:
|
|
|
8 |
def load_model():
|
9 |
global model
|
10 |
try:
|
11 |
+
print("Начинаем загрузку модели из Hub...")
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Загружаем файл модели из Hub
|
14 |
+
model_path = hf_hub_download(
|
15 |
+
repo_id="AugustLight/LLight-3.2-3B-Instruct",
|
16 |
+
filename="Llight.Q8_0.gguf",
|
17 |
+
repo_type="model"
|
18 |
+
)
|
19 |
+
|
20 |
+
print(f"Модель загружена в: {model_path}")
|
21 |
|
22 |
+
# Инициализируем модель
|
|
|
23 |
model = AutoModelForCausalLM.from_pretrained(
|
24 |
model_path,
|
25 |
model_type="llama",
|
26 |
context_length=2048,
|
27 |
gpu_layers=0,
|
28 |
+
threads=4
|
|
|
29 |
)
|
30 |
+
print("Модель успешно инициализирована!")
|
31 |
return model
|
32 |
|
33 |
except Exception as e:
|