Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from tokenization_yi import YiTokenizer
|
|
9 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:120'
|
10 |
model_id = "01-ai/Yi-6B-200K"
|
11 |
tokenizer_path = "./"
|
12 |
-
|
13 |
|
14 |
DESCRIPTION = """
|
15 |
# 👋🏻Welcome to 🙋🏻♂️Tonic's🧑🏻🚀YI-200K🚀
|
@@ -21,11 +21,11 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
|
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
22 |
# tokenizer = YiTokenizer.from_pretrained(tokenizer_path)
|
23 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
def format_prompt(user_message, system_message="
|
28 |
-
prompt_dict = {"role": "user", "content": f"{
|
29 |
prompt = str(prompt_dict)
|
30 |
return prompt
|
31 |
|
@@ -56,7 +56,7 @@ with gr.Blocks(theme='ParityError/Anime') as demo:
|
|
56 |
system_prompt = gr.Textbox(placeholder='Provide a System Prompt In The First Person', label='System Prompt', lines=2, value="You are YiTonic, an AI language model created by Tonic-AI. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.")
|
57 |
|
58 |
with gr.Group():
|
59 |
-
chatbot = gr.Chatbot(label='TonicYi-6B-200K
|
60 |
|
61 |
with gr.Group():
|
62 |
submit_button = gr.Button('Submit', variant='primary')
|
|
|
9 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:120'
|
10 |
model_id = "01-ai/Yi-6B-200K"
|
11 |
tokenizer_path = "./"
|
12 |
+
eos_token_id = 7
|
13 |
|
14 |
DESCRIPTION = """
|
15 |
# 👋🏻Welcome to 🙋🏻♂️Tonic's🧑🏻🚀YI-200K🚀
|
|
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
22 |
# tokenizer = YiTokenizer.from_pretrained(tokenizer_path)
|
23 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
24 |
+
tokenizer.eos_token_id = eos_token_id
|
25 |
+
model.config.eos_token_id = eos_token_id
|
26 |
|
27 |
+
def format_prompt(user_message, system_message="You are YiTonic, an AI language model created by Tonic-AI. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and follow ethical guidelines and promote positive behavior."):
|
28 |
+
prompt_dict = {"role": "user", "content": f"{user_message}{system_message}"}
|
29 |
prompt = str(prompt_dict)
|
30 |
return prompt
|
31 |
|
|
|
56 |
system_prompt = gr.Textbox(placeholder='Provide a System Prompt In The First Person', label='System Prompt', lines=2, value="You are YiTonic, an AI language model created by Tonic-AI. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.")
|
57 |
|
58 |
with gr.Group():
|
59 |
+
chatbot = gr.Chatbot(label='TonicYi-6B-200K-🧠🤯')
|
60 |
|
61 |
with gr.Group():
|
62 |
submit_button = gr.Button('Submit', variant='primary')
|