Text Generation
Transformers
PyTorch
Chinese
English
gpt2
text-generation-inference
Inference Endpoints
Hollway commited on
Commit
0dfd489
1 Parent(s): 0c6b87b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -4
README.md CHANGED
@@ -1,10 +1,18 @@
1
  ---
 
 
 
2
  license: mit
 
 
 
3
  ---
4
 
5
- ## Usage
6
 
7
- ### Initalization
 
 
8
  ```
9
  !pip install transformers[torch]
10
 
@@ -16,7 +24,7 @@ tokenizer = GPT2Tokenizer.from_pretrained('Hollway/gpt2_finetune')
16
  model = GPT2LMHeadModel.from_pretrained('Hollway/gpt2_finetune').to(device)
17
  ```
18
 
19
- ### Inference
20
  ```
21
  def generate(text):
22
  inputs = tokenizer(text, return_tensors="pt").to(model.device)
@@ -33,4 +41,4 @@ def generate(text):
33
  return tokenizer.decode(tokens[0], skip_special_tokens=True)
34
 
35
  generate("只因你")
36
- ```
 
1
  ---
2
+ language:
3
+ - cn
4
+ - en
5
  license: mit
6
+ datasets:
7
+ - TigerResearch/tigerbot-zhihu-zh-10k
8
+ pipeline_tag: text-generation
9
  ---
10
 
11
+ # 中文文本生成
12
 
13
+ ## 1 Usage
14
+
15
+ ### 1.1 Initalization
16
  ```
17
  !pip install transformers[torch]
18
 
 
24
  model = GPT2LMHeadModel.from_pretrained('Hollway/gpt2_finetune').to(device)
25
  ```
26
 
27
+ ### 1.2 Inference
28
  ```
29
  def generate(text):
30
  inputs = tokenizer(text, return_tensors="pt").to(model.device)
 
41
  return tokenizer.decode(tokens[0], skip_special_tokens=True)
42
 
43
  generate("只因你")
44
+ ```