titipata commited on
Commit
46348b7
1 Parent(s): 75793e5

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ widget:
3
+ - text: "ความรัก"
4
+ ---
5
+
6
+ # Generate Thai Lyrics
7
+
8
+ GPT2 for Thai lyrics generation. We use [GPT2 base Thai](https://huggingface.co/flax-community/gpt2-base-thai) as a pre-trained model
9
+ for [Siamzom lyrics](https://www.siamzone.com/music/thailyric/)
10
+
11
+
12
+ ## Example use
13
+
14
+ ``` py
15
+ from transformers import pipeline
16
+ from transformers import GPT2Model, GPT2TokenizerFast, AutoModelForCausalLM, AutoTokenizer
17
+
18
+ model_name = "tupleblog/generate-thai-lyrics"
19
+ model = AutoModelForCausalLM.from_pretrained(model_name)
20
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
21
+ model.config.pad_token_id = model.config.eos_token_id
22
+
23
+
24
+ nlp = pipeline(
25
+ "text-generation",
26
+ model=model,
27
+ tokenizer=tokenizer
28
+ )
29
+ text = "ความรัก"
30
+ nlp(text, max_length=100, top_k=40, temperature=0.8) # varying the temperature and top-k produce different output
31
+ ```