zhangshengdong
commited on
Commit
•
200b388
1
Parent(s):
e54a1f5
Upload chatbot_local.py
Browse files- utils/chatbot_local.py +1 -2
utils/chatbot_local.py
CHANGED
@@ -6,8 +6,6 @@ import torch
|
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer, StoppingCriteria, \
|
7 |
StoppingCriteriaList
|
8 |
|
9 |
-
MODEL_PATH = '/mnt/nfs/zsd_server/models/huggingface/llama-3-chinese-8b-instruct-v3'
|
10 |
-
|
11 |
|
12 |
class KeywordsStoppingCriteria(StoppingCriteria):
|
13 |
def __init__(self, keywords: list, tokenizer, device="cpu"):
|
@@ -102,6 +100,7 @@ class ChatBot:
|
|
102 |
|
103 |
|
104 |
if __name__ == "__main__":
|
|
|
105 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
106 |
model = AutoModelForCausalLM.from_pretrained(
|
107 |
MODEL_PATH,
|
|
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer, StoppingCriteria, \
|
7 |
StoppingCriteriaList
|
8 |
|
|
|
|
|
9 |
|
10 |
class KeywordsStoppingCriteria(StoppingCriteria):
|
11 |
def __init__(self, keywords: list, tokenizer, device="cpu"):
|
|
|
100 |
|
101 |
|
102 |
if __name__ == "__main__":
|
103 |
+
MODEL_PATH = '/mnt/nfs/zsd_server/models/huggingface/llama-3-chinese-8b-instruct-v3'
|
104 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
105 |
model = AutoModelForCausalLM.from_pretrained(
|
106 |
MODEL_PATH,
|