YaYi
Introduction
YaYi was fine-tuned on millions of artificially constructed high-quality domain data. This training data covers five key domains: media publicity, public opinion analysis, public safety, financial risk control, and urban governance, encompassing over a hundred natural language instruction tasks. Throughout the iterative development process of the YaYi, starting from pre-training initialization weights and progressing to domain-specific model, we have steadily enhanced its foundational Chinese language capabilities and domain analysis capabilities. We've also introduced multi-turn conversation enhancements and integrated various plug-in capabilities. Furthermore, through continuous manual feedback and optimization from hundreds of users during the internal testing phase, we've meticulously refined the model's performance and security.
By open-sourcing the YaYi model, we will contribute our own efforts to the development of the Chinese pre-trained large language model open-source community. Through this open-source initiative, we seek to collaborate with every partner to build the YaYi model ecosystem together.
News: ? YaYi has open sourced the Chinese optimization model version based on LLaMA 2 to explore the latest practices suitable for Chinese multi-domain tasks.
Model download
Model | ?HF Model Name | Download Links |
---|---|---|
YaYi-7B | wenge-research/yayi-7b | Download |
YaYi-7B-Llama2 | wenge-research/yayi-7b-llama2 | Download |
YaYi-13B-Llama2 | wenge-research/yayi-13b-llama2 | Download |
YaYi-70B-Llama2 | wenge-research/yayi-70b-llama2 | Download |
For more details, please refer to our ?Github Repo。
Run
from modelscope import AutoTokenizer,Model
from modelscope import snapshot_download
import torch
local_dir = snapshot_download("AI-ModelScope/yayi-13b-llama2",revision='master')
model = Model.from_pretrained(local_dir, revision='master', device_map='auto', torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(local_dir, revision='master')
prompt =f"""<|System|>:
You are a helpful, respectful and honest assistant named YaYi developed by Beijing Wenge Technology Co.,Ltd. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
<|Human|>:
你是谁?
<|YaYi|>:
"""
eos_token_id = tokenizer("<|End|>").input_ids[0]
inputs = tokenizer(prompt, return_tensors="pt")
# Generate
generate_ids = model.generate(inputs.input_ids.to(model.device), eos_token_id=eos_token_id, pad_token_id=eos_token_id, max_length=512,do_sample=True,top_k=10,num_return_sequences=1)
print(tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0])
评论