liam168 commited on
Commit
6bbc984
1 Parent(s): 02e0d38

feat: init

Browse files
Files changed (7) hide show
  1. .gitattributes +0 -8
  2. README.md +40 -0
  3. config.json +30 -0
  4. merges.txt +0 -0
  5. pytorch_model.bin +3 -0
  6. tokenizer_config.json +1 -0
  7. vocab.json +0 -0
.gitattributes CHANGED
@@ -6,12 +6,4 @@
6
  *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
  *.ot filter=lfs diff=lfs merge=lfs -text
8
  *.onnx filter=lfs diff=lfs merge=lfs -text
9
- *.arrow filter=lfs diff=lfs merge=lfs -text
10
- *.ftz filter=lfs diff=lfs merge=lfs -text
11
- *.joblib filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
  *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.pb filter=lfs diff=lfs merge=lfs -text
15
- *.pt filter=lfs diff=lfs merge=lfs -text
16
- *.pth filter=lfs diff=lfs merge=lfs -text
17
- *tfevents* filter=lfs diff=lfs merge=lfs -text
6
  *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
  *.ot filter=lfs diff=lfs merge=lfs -text
8
  *.onnx filter=lfs diff=lfs merge=lfs -text
 
 
 
 
9
  *.msgpack filter=lfs diff=lfs merge=lfs -text
 
 
 
 
README.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ widget:
4
+ - text: "I got a surprise for you, Morty."
5
+ license: apache-2.0
6
+ ---
7
+
8
+
9
+ # liam168/chat-DialoGPT-small-en
10
+
11
+ ## Model description
12
+
13
+ 用英文聊天数据训练的模型;
14
+
15
+ ### How to use
16
+
17
+ Now we are ready to try out how the model works as a chatting partner!
18
+
19
+ ```python
20
+ from transformers import AutoModelForCausalLM, AutoTokenizer
21
+ import torch
22
+
23
+ mode_name = 'liam168/chat-DialoGPT-small-en'
24
+ tokenizer = AutoTokenizer.from_pretrained(mode_name)
25
+ model = AutoModelForCausalLM.from_pretrained(mode_name)
26
+
27
+ # Let's chat for 5 lines
28
+ for step in range(5):
29
+ # encode the new user input, add the eos_token and return a tensor in Pytorch
30
+ new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
31
+
32
+ # append the new user input tokens to the chat history
33
+ bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
34
+
35
+ # generated a response while limiting the total chat history to 1000 tokens,
36
+ chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
37
+
38
+ # pretty print last ouput tokens from bot
39
+ print("Answer: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))
40
+ ```
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 50256,
8
+ "embd_pdrop": 0.1,
9
+ "eos_token_id": 50256,
10
+ "initializer_range": 0.02,
11
+ "layer_norm_epsilon": 1e-05,
12
+ "model_type": "gpt2",
13
+ "n_ctx": 1024,
14
+ "n_embd": 768,
15
+ "n_head": 12,
16
+ "n_layer": 12,
17
+ "n_positions": 1024,
18
+ "resid_pdrop": 0.1,
19
+ "summary_activation": null,
20
+ "summary_first_dropout": 0.1,
21
+ "summary_proj_to_labels": true,
22
+ "summary_type": "cls_index",
23
+ "summary_use_proj": true,
24
+ "task_specific_params": {
25
+ "conversational": {
26
+ "max_length": 1000
27
+ }
28
+ },
29
+ "vocab_size": 50257
30
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6e2be6d12f77bf925a89f2381c6c685f4739752289039d590622d37d48a153d
3
+ size 351265583
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"model_max_length": 1024}
vocab.json ADDED
The diff for this file is too large to render. See raw diff