Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
-
import
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
import sentencepiece
|
@@ -7,7 +7,7 @@ from tokenization_yi import YiTokenizer
|
|
7 |
|
8 |
|
9 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:120'
|
10 |
-
model_id = "larryvrh/Yi-
|
11 |
|
12 |
DESCRIPTION = """
|
13 |
# 👋🏻Welcome to 🙋🏻♂️Tonic's🧑🏻🚀YI-200K🚀"
|
@@ -17,7 +17,7 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
|
|
17 |
"""
|
18 |
|
19 |
tokenizer = YiTokenizer.from_pretrained("./")
|
20 |
-
model = AutoModelForCausalLM.from_pretrained("larryvrh/Yi-
|
21 |
|
22 |
def predict(message, max_new_tokens=4056, temperature=3.5, top_p=0.9, top_k=800, do_sample=False):
|
23 |
|
@@ -42,7 +42,7 @@ with gr.Blocks(theme='ParityError/Anime') as demo:
|
|
42 |
with gr.Group():
|
43 |
textbox = gr.Textbox(placeholder='Enter your message here', label='Your Message', lines=2)
|
44 |
submit_button = gr.Button('Submit', variant='primary')
|
45 |
-
chatbot = gr.Chatbot(label='TonicYi-
|
46 |
|
47 |
with gr.Accordion(label='Advanced options', open=False):
|
48 |
max_new_tokens = gr.Slider(label='Max New Tokens', minimum=1, maximum=55000, step=1, value=8000)
|
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torchhttps://huggingface.co/spaces/Tonic1/YiTonic/tree/main
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
import sentencepiece
|
|
|
7 |
|
8 |
|
9 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:120'
|
10 |
+
model_id = "larryvrh/Yi-6B-200K-Llamafied"
|
11 |
|
12 |
DESCRIPTION = """
|
13 |
# 👋🏻Welcome to 🙋🏻♂️Tonic's🧑🏻🚀YI-200K🚀"
|
|
|
17 |
"""
|
18 |
|
19 |
tokenizer = YiTokenizer.from_pretrained("./")
|
20 |
+
model = AutoModelForCausalLM.from_pretrained("larryvrh/Yi-6B-200K-Llamafied", device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
21 |
|
22 |
def predict(message, max_new_tokens=4056, temperature=3.5, top_p=0.9, top_k=800, do_sample=False):
|
23 |
|
|
|
42 |
with gr.Group():
|
43 |
textbox = gr.Textbox(placeholder='Enter your message here', label='Your Message', lines=2)
|
44 |
submit_button = gr.Button('Submit', variant='primary')
|
45 |
+
chatbot = gr.Chatbot(label='TonicYi-6B-200K')
|
46 |
|
47 |
with gr.Accordion(label='Advanced options', open=False):
|
48 |
max_new_tokens = gr.Slider(label='Max New Tokens', minimum=1, maximum=55000, step=1, value=8000)
|