--- license: apache-2.0 datasets: - shareAI/ShareGPT-Chinese-English-90k language: - zh pipeline_tag: text-generation tags: - tiny - small - opt --- ## 这是什么 - Intro 中文 OPT-125m,在原 [OPT-125m](https://huggingface.co/facebook/opt-125m) 模型基础上[扩充了中文词表](https://github.com/stanleylsx/llms_tool),并在 WebText, ShareGPT 等数据集上作了一定的继续预训练。 Chinese OPT-125m, expanding the Chinese word list based on the original [OPT-125m](https://huggingface.co/facebook/opt-125m) model, and making some continued pre-training on WebText, ShareGPT, etc. ## 快速试用 - Quick Use ```python # 快速试用 # quick use from transformers import AutoModelForCausalLM, AutoTokenizer model_name_or_path = 'Sholder/chinese-opt-125m' device = 'cuda' model = AutoModelForCausalLM.from_pretrained(model_name_or_path).to(device) tokenizer = AutoTokenizer.from_pretrained(model_name_or_path) def quick_use(): text = input('User: ').strip() inputs = tokenizer(text, return_tensors="pt").to(device) print('Opt: ', end='', flush=True) tokens = model.generate( **inputs, max_new_tokens=64, do_sample=True, ) response = tokenizer.decode(tokens[0]) print(response) if __name__ == '__main__': quick_use() ```