Update README.md
Browse files
README.md
CHANGED
@@ -24,9 +24,9 @@ tasks:
|
|
24 |
import torch
|
25 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
26 |
from transformers.generation.utils import GenerationConfig
|
27 |
-
tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/
|
28 |
-
model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/
|
29 |
-
model.generation_config = GenerationConfig.from_pretrained("FreedomIntelligence/
|
30 |
messages = []
|
31 |
messages.append({"role": "user", "content": "肚子疼怎么办?"})
|
32 |
response = model.HuatuoChat(tokenizer, messages)
|
|
|
24 |
import torch
|
25 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
26 |
from transformers.generation.utils import GenerationConfig
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B", use_fast=True, trust_remote_code=True)
|
28 |
+
model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
29 |
+
model.generation_config = GenerationConfig.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B")
|
30 |
messages = []
|
31 |
messages.append({"role": "user", "content": "肚子疼怎么办?"})
|
32 |
response = model.HuatuoChat(tokenizer, messages)
|