File size: 1,199 Bytes
46348b7 cd6c7a7 46348b7 cd6c7a7 46348b7 cd6c7a7 46348b7 cd6c7a7 46348b7 8f6f665 46348b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
---
language:
- th
widget:
- text: "ความรัก"
- text: "อยากรู้"
- text: "ไหนว่า"
---
# Generate Thai Lyrics (แต่งเพลงไทยด้วย GPT-2)
GPT-2 for Thai lyrics generation. We use [GPT-2 base Thai](https://huggingface.co/flax-community/gpt2-base-thai) as a pre-trained model
for [Siamzone lyrics](https://www.siamzone.com/music/thailyric/)
เราเทรนโมเดล GPT-2 สำหรับใช้แต่งเนื้อเพลงไทยด้วยเนื้อเพลงจากเว็บไซต์ Siamzone
## Example use
``` py
from transformers import pipeline
from transformers import GPT2Model, GPT2TokenizerFast, AutoModelForCausalLM, AutoTokenizer
model_name = "tupleblog/generate-thai-lyrics"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
model.config.pad_token_id = model.config.eos_token_id
nlp = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer
)
text = "ความรัก"
nlp(text, max_length=100, top_k=40, temperature=0.8) # varying the temperature and top-k produce different output
```
|