
使用的预训练模型为[uer/gpt2-chinese-cluecorpussmall](https://huggingface.co/uer/gpt2-chinese-cluecorpussmall)

## Usage
```python
from transformers import AutoModelForCausalLM
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("xmj2002/gpt2_tang_poetry")
model = AutoModelForCausalLM.from_pretrained("xmj2002/gpt2_tang_poetry")

text = "白居易《远方》"
inputs = tokenizer(text, return_tensors="pt").input_ids
outputs = model.generate(inputs, max_new_tokens=100, do_sample=True, top_k=100, top_p=0.95)
tokenizer.decode(outputs[0], skip_special_tokens=True)
```

{"language": ["zh"], "license": "apache-2.0", "datasets": ["xmj2002/tang_poems"]}
transformers pytorch gpt2 text-generation zh dataset:xmj2002/tang_poems license:apache-2.0 autotrain_compatible endpoints_compatible text-generation-inference region:us
TAGS
#transformers #pytorch #gpt2 #text-generation #zh #dataset-xmj2002/tang_poems #license-apache-2.0 #autotrain_compatible #endpoints_compatible #text-generation-inference #region-us 


使用的预训练模型为uer/gpt2-chinese-cluecorpussmall

## Usage


## Usage
TAGS
#transformers #pytorch #gpt2 #text-generation #zh #dataset-xmj2002/tang_poems #license-apache-2.0 #autotrain_compatible #endpoints_compatible #text-generation-inference #region-us 
 ## Usage