Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
2 |
import torch
|
3 |
|
4 |
# Load the model and tokenizer
|
5 |
model_name = "01-ai/Yi-34B-200K"
|
6 |
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def run(message, chat_history, system_prompt, max_new_tokens=1024, temperature=0.3, top_p=0.9, top_k=50):
|
10 |
prompt = get_prompt(message, chat_history, system_prompt)
|
|
|
1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
2 |
+
from tokenization_yi import YiTokenizer
|
3 |
import torch
|
4 |
|
5 |
# Load the model and tokenizer
|
6 |
model_name = "01-ai/Yi-34B-200K"
|
7 |
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
8 |
+
tokenizer_dir = "Tonic1/YiTonic"
|
9 |
+
vocab_file = os.path.join(tokenizer_dir, "tokenizer.model")
|
10 |
+
tokenizer_json = os.path.join(tokenizer_dir, "tokenizer.json")
|
11 |
+
tokenizer_config = os.path.join(tokenizer_dir, "tokenizer_config.json")
|
12 |
+
tokenizer = YiTokenizer(vocab_file=vocab_file)
|
13 |
|
14 |
def run(message, chat_history, system_prompt, max_new_tokens=1024, temperature=0.3, top_p=0.9, top_k=50):
|
15 |
prompt = get_prompt(message, chat_history, system_prompt)
|