Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,11 @@ model_id = "AxisCommunity/OrionZetAI_1.0V"
|
|
| 9 |
print("Загрузка токенизатора...")
|
| 10 |
tokenizer = LlamaTokenizer.from_pretrained(model_id)
|
| 11 |
|
| 12 |
-
print("Проверка файлов модели в облаке...")
|
| 13 |
-
# Скачиваем конфигурационные файлы локально в контейнер
|
| 14 |
config_path = hf_hub_download(repo_id=model_id, filename="config.json")
|
| 15 |
local_dir = os.path.dirname(config_path)
|
| 16 |
|
| 17 |
-
# Проверяем
|
| 18 |
-
# Это обманет библиотеку transformers и заставит её прочитать модель!
|
| 19 |
possible_files = ["orion_model.safetensors", "model.safetensors"]
|
| 20 |
for f in possible_files:
|
| 21 |
try:
|
|
@@ -28,8 +26,7 @@ for f in possible_files:
|
|
| 28 |
except Exception:
|
| 29 |
continue
|
| 30 |
|
| 31 |
-
print("Загрузка
|
| 32 |
-
# Теперь transformers увидит идеальную структуру папки и запустится
|
| 33 |
model = LlamaForCausalLM.from_pretrained(
|
| 34 |
local_dir,
|
| 35 |
torch_dtype=torch.float16,
|
|
@@ -38,7 +35,7 @@ model = LlamaForCausalLM.from_pretrained(
|
|
| 38 |
|
| 39 |
def generate(text):
|
| 40 |
if not text.strip():
|
| 41 |
-
return "Введи запрос..."
|
| 42 |
|
| 43 |
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 44 |
|
|
@@ -52,12 +49,12 @@ def generate(text):
|
|
| 52 |
|
| 53 |
return tokenizer.decode(output[0], skip_special_tokens=True)
|
| 54 |
|
| 55 |
-
# Интерфейс Gradio
|
| 56 |
demo = gr.Interface(
|
| 57 |
fn=generate,
|
| 58 |
-
inputs=gr.Textbox(lines=3, placeholder="Напиши что-нибудь
|
| 59 |
outputs="text",
|
| 60 |
-
title="
|
| 61 |
)
|
| 62 |
|
| 63 |
demo.launch()
|
|
|
|
| 9 |
print("Загрузка токенизатора...")
|
| 10 |
tokenizer = LlamaTokenizer.from_pretrained(model_id)
|
| 11 |
|
| 12 |
+
print("Проверка файлов модели OrionPax в облаке...")
|
|
|
|
| 13 |
config_path = hf_hub_download(repo_id=model_id, filename="config.json")
|
| 14 |
local_dir = os.path.dirname(config_path)
|
| 15 |
|
| 16 |
+
# Проверяем файлы весов и делаем линк
|
|
|
|
| 17 |
possible_files = ["orion_model.safetensors", "model.safetensors"]
|
| 18 |
for f in possible_files:
|
| 19 |
try:
|
|
|
|
| 26 |
except Exception:
|
| 27 |
continue
|
| 28 |
|
| 29 |
+
print("Загрузка OrionPax в память сервера...")
|
|
|
|
| 30 |
model = LlamaForCausalLM.from_pretrained(
|
| 31 |
local_dir,
|
| 32 |
torch_dtype=torch.float16,
|
|
|
|
| 35 |
|
| 36 |
def generate(text):
|
| 37 |
if not text.strip():
|
| 38 |
+
return "Введи запрос для OrionPax..."
|
| 39 |
|
| 40 |
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 41 |
|
|
|
|
| 49 |
|
| 50 |
return tokenizer.decode(output[0], skip_special_tokens=True)
|
| 51 |
|
| 52 |
+
# Интерфейс Gradio с новым крутым названием!
|
| 53 |
demo = gr.Interface(
|
| 54 |
fn=generate,
|
| 55 |
+
inputs=gr.Textbox(lines=3, placeholder="Напиши что-нибудь OrionPax..."),
|
| 56 |
outputs="text",
|
| 57 |
+
title="OrionPax AI Cloud 1.0V" # <-- Твое новое имя проекта!
|
| 58 |
)
|
| 59 |
|
| 60 |
demo.launch()
|