Instructions to use IDEA-CCNL/Wenzhong-GPT2-110M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IDEA-CCNL/Wenzhong-GPT2-110M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IDEA-CCNL/Wenzhong-GPT2-110M")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("IDEA-CCNL/Wenzhong-GPT2-110M") model = AutoModelForCausalLM.from_pretrained("IDEA-CCNL/Wenzhong-GPT2-110M") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use IDEA-CCNL/Wenzhong-GPT2-110M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IDEA-CCNL/Wenzhong-GPT2-110M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IDEA-CCNL/Wenzhong-GPT2-110M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/IDEA-CCNL/Wenzhong-GPT2-110M
- SGLang
How to use IDEA-CCNL/Wenzhong-GPT2-110M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "IDEA-CCNL/Wenzhong-GPT2-110M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IDEA-CCNL/Wenzhong-GPT2-110M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "IDEA-CCNL/Wenzhong-GPT2-110M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IDEA-CCNL/Wenzhong-GPT2-110M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use IDEA-CCNL/Wenzhong-GPT2-110M with Docker Model Runner:
docker model run hf.co/IDEA-CCNL/Wenzhong-GPT2-110M
YAML Metadata Error:"widget[0]" must be of type object
YAML Metadata Error:"widget[1]" must be of type object
Wenzhong-GPT2-110M
- Main Page:Fengshenbang
- Github: Fengshenbang-LM
็ฎไป Brief Introduction
ๅไบๅค็NLGไปปๅก๏ผไธญๆ็็GPT2-Smallใ
Focused on handling NLG tasks, Chinese GPT2-Small.
ๆจกๅๅ็ฑป Model Taxonomy
| ้ๆฑ Demand | ไปปๅก Task | ็ณปๅ Series | ๆจกๅ Model | ๅๆฐ Parameter | ้ขๅค Extra |
|---|---|---|---|---|---|
| ้็จ General | ่ช็ถ่ฏญ่จ็ๆ NLG | ้ปไปฒ Wenzhong | GPT2 | 110M | ไธญๆ Chinese |
ๆจกๅไฟกๆฏ Model Information
็ฑปไผผไบWenzhong2.0-GPT2-3.5B-chinese๏ผๆไปฌๅฎ็ฐไบไธไธชsmall็ๆฌ็12ๅฑ็Wenzhong-GPT2-110M๏ผๅนถไธๅจๆ้๏ผ300G็ๆฌ๏ผไธ้ข่ฟ่ก้ข่ฎญ็ปใ
Similar to Wenzhong2.0-GPT2-3.5B-chinese, we implement a small size Wenzhong-GPT2-110M with 12 layers, which is pre-trained on Wudao Corpus (300G version).
ไฝฟ็จ Usage
ๅ ่ฝฝๆจกๅ Loading Models
from transformers import GPT2Tokenizer,GPT2LMHeadModel
hf_model_path = 'IDEA-CCNL/Wenzhong-GPT2-110M'
tokenizer = GPT2Tokenizer.from_pretrained(hf_model_path)
model = GPT2LMHeadModel.from_pretrained(hf_model_path)
ไฝฟ็จ็คบไพ Usage Examples
question = "ๅไบฌๆฏไธญๅฝ็"
inputs = tokenizer(question,return_tensors='pt')
generation_output = model.generate(**inputs,
return_dict_in_generate=True,
output_scores=True,
max_length=150,
# max_new_tokens=80,
do_sample=True,
top_p = 0.6,
# num_beams=5,
eos_token_id=50256,
pad_token_id=0,
num_return_sequences = 5)
for idx,sentence in enumerate(generation_output.sequences):
print('next sentence %d:\n'%idx,
tokenizer.decode(sentence).split('<|endoftext|>')[0])
print('*'*40)
ๅผ็จ Citation
ๅฆๆๆจๅจๆจ็ๅทฅไฝไธญไฝฟ็จไบๆไปฌ็ๆจกๅ๏ผๅฏไปฅๅผ็จๆไปฌ็่ฎบๆ๏ผ
If you are using the resource for your work, please cite the our paper:
@article{fengshenbang,
author = {Jiaxing Zhang and Ruyi Gan and Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen},
title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
journal = {CoRR},
volume = {abs/2209.02970},
year = {2022}
}
ไนๅฏไปฅๅผ็จๆไปฌ็็ฝ็ซ:
You can also cite our website:
@misc{Fengshenbang-LM,
title={Fengshenbang-LM},
author={IDEA-CCNL},
year={2021},
howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
}
- Downloads last month
- 1,951