Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,17 +8,8 @@ from transformers import (
|
|
| 8 |
import os
|
| 9 |
from threading import Thread
|
| 10 |
import spaces
|
| 11 |
-
import time
|
| 12 |
import subprocess
|
| 13 |
|
| 14 |
-
from transformers_modules.apple.OpenELM-3B-Instruct.d3c76da586450c73898e6bed70cecf3376300fb3.configuration_openelm import OpenELMConfig
|
| 15 |
-
|
| 16 |
-
from transformers_modules.apple.OpenELM_3B_Instruct.d3c76da586450c73898e6bed70cecf3376300fb3.configuration_openelm import OpenELMConfig
|
| 17 |
-
from transformers import AutoConfig, AutoTokenizer
|
| 18 |
-
|
| 19 |
-
config = AutoConfig.from_pretrained("apple/OpenELM-270M", trust_remote_code=True)
|
| 20 |
-
|
| 21 |
-
|
| 22 |
# flash-attn ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น. CUDA ๋น๋๋ ๊ฑด๋๋.
|
| 23 |
subprocess.run(
|
| 24 |
"pip install flash-attn --no-build-isolation",
|
|
@@ -29,21 +20,16 @@ subprocess.run(
|
|
| 29 |
# Hugging Face ํ ํฐ ๊ฐ์ ธ์ค๊ธฐ
|
| 30 |
token = os.environ["HF_TOKEN"]
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
# beomi/Llama-3-KoEn-8B-Instruct-preview ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๊ฐ์ด ๋ก๋
|
| 34 |
model = AutoModelForCausalLM.from_pretrained(
|
| 35 |
-
# "microsoft/Phi-3-mini-128k-instruct",
|
| 36 |
"apple/OpenELM-270M",
|
| 37 |
token=token,
|
| 38 |
trust_remote_code=True,
|
| 39 |
)
|
| 40 |
-
# bug fix
|
| 41 |
-
# tok = AutoTokenizer.from_pretrained("apple/OpenELM-3B-Instruct", token=token, trust_remote_code=True)
|
| 42 |
tok = AutoTokenizer.from_pretrained(
|
| 43 |
"apple/OpenELM-270M",
|
| 44 |
token=token,
|
| 45 |
trust_remote_code=True,
|
| 46 |
-
config=OpenELMConfig(),
|
| 47 |
)
|
| 48 |
|
| 49 |
# ์ข
๋ฃ ํ ํฐ ID ์ค์
|
|
@@ -130,7 +116,7 @@ demo = gr.ChatInterface(
|
|
| 130 |
],
|
| 131 |
stop_btn="Stop Generation",
|
| 132 |
title="Chat With LLMs",
|
| 133 |
-
description="Now Running [
|
| 134 |
)
|
| 135 |
|
| 136 |
# Gradio ์ธํฐํ์ด์ค ์คํ
|
|
|
|
| 8 |
import os
|
| 9 |
from threading import Thread
|
| 10 |
import spaces
|
|
|
|
| 11 |
import subprocess
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# flash-attn ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น. CUDA ๋น๋๋ ๊ฑด๋๋.
|
| 14 |
subprocess.run(
|
| 15 |
"pip install flash-attn --no-build-isolation",
|
|
|
|
| 20 |
# Hugging Face ํ ํฐ ๊ฐ์ ธ์ค๊ธฐ
|
| 21 |
token = os.environ["HF_TOKEN"]
|
| 22 |
|
| 23 |
+
# apple/OpenELM-270M ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ก๋
|
|
|
|
| 24 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 25 |
"apple/OpenELM-270M",
|
| 26 |
token=token,
|
| 27 |
trust_remote_code=True,
|
| 28 |
)
|
|
|
|
|
|
|
| 29 |
tok = AutoTokenizer.from_pretrained(
|
| 30 |
"apple/OpenELM-270M",
|
| 31 |
token=token,
|
| 32 |
trust_remote_code=True,
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
# ์ข
๋ฃ ํ ํฐ ID ์ค์
|
|
|
|
| 116 |
],
|
| 117 |
stop_btn="Stop Generation",
|
| 118 |
title="Chat With LLMs",
|
| 119 |
+
description="Now Running [apple/OpenELM-270M](https://huggingface.co/apple/OpenELM-270M)",
|
| 120 |
)
|
| 121 |
|
| 122 |
# Gradio ์ธํฐํ์ด์ค ์คํ
|