初始化项目,由ModelHub XC社区提供模型
Model: Spirax/DialoGPT-medium-sheldon Source: Original Platform
This commit is contained in:
17
.gitattributes
vendored
Normal file
17
.gitattributes
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
49
README.md
Normal file
49
README.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
thumbnail: https://i.imgur.com/7HAcbbD.gif
|
||||||
|
|
||||||
|
tags:
|
||||||
|
|
||||||
|
- conversational
|
||||||
|
|
||||||
|
license: mit
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# DialoGPT Trained on the Speech of a TV Series Character
|
||||||
|
|
||||||
|
This is an instance of [microsoft/DialoGPT-medium](https://huggingface.co/microsoft/DialoGPT-medium) trained on a TV series character, Sheldon from [The Big Bang Theory](https://en.wikipedia.org/wiki/The_Big_Bang_Theory). The data comes from [a Kaggle TV series script dataset](https://www.kaggle.com/mitramir5/the-big-bang-theory-series-transcript).
|
||||||
|
|
||||||
|
|
||||||
|
Chat with the model:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoTokenizer, AutoModelWithLMHead
|
||||||
|
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained("spirax/DialoGPT-medium-sheldon")
|
||||||
|
|
||||||
|
model = AutoModelWithLMHead.from_pretrained("spirax/DialoGPT-medium-sheldon")
|
||||||
|
|
||||||
|
# Let's chat for 4 lines
|
||||||
|
for step in range(4):
|
||||||
|
# encode the new user input, add the eos_token and return a tensor in Pytorch
|
||||||
|
new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
|
||||||
|
# print(new_user_input_ids)
|
||||||
|
|
||||||
|
# append the new user input tokens to the chat history
|
||||||
|
bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
|
||||||
|
|
||||||
|
# generated a response while limiting the total chat history to 1000 tokens,
|
||||||
|
chat_history_ids = model.generate(
|
||||||
|
bot_input_ids, max_length=200,
|
||||||
|
pad_token_id=tokenizer.eos_token_id,
|
||||||
|
no_repeat_ngram_size=3,
|
||||||
|
do_sample=True,
|
||||||
|
top_k=100,
|
||||||
|
top_p=0.7,
|
||||||
|
temperature=0.8
|
||||||
|
)
|
||||||
|
|
||||||
|
# pretty print last ouput tokens from bot
|
||||||
|
print("SheldorBot: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))
|
||||||
|
```
|
||||||
36
config.json
Normal file
36
config.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "microsoft/DialoGPT-medium",
|
||||||
|
"activation_function": "gelu_new",
|
||||||
|
"architectures": [
|
||||||
|
"GPT2LMHeadModel"
|
||||||
|
],
|
||||||
|
"attn_pdrop": 0.1,
|
||||||
|
"bos_token_id": 50256,
|
||||||
|
"embd_pdrop": 0.1,
|
||||||
|
"eos_token_id": 50256,
|
||||||
|
"gradient_checkpointing": false,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"layer_norm_epsilon": 1e-05,
|
||||||
|
"model_type": "gpt2",
|
||||||
|
"n_ctx": 1024,
|
||||||
|
"n_embd": 1024,
|
||||||
|
"n_head": 16,
|
||||||
|
"n_inner": null,
|
||||||
|
"n_layer": 24,
|
||||||
|
"n_positions": 1024,
|
||||||
|
"resid_pdrop": 0.1,
|
||||||
|
"scale_attn_weights": true,
|
||||||
|
"summary_activation": null,
|
||||||
|
"summary_first_dropout": 0.1,
|
||||||
|
"summary_proj_to_labels": true,
|
||||||
|
"summary_type": "cls_index",
|
||||||
|
"summary_use_proj": true,
|
||||||
|
"task_specific_params": {
|
||||||
|
"conversational": {
|
||||||
|
"max_length": 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transformers_version": "4.8.2",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 50257
|
||||||
|
}
|
||||||
50001
merges.txt
Normal file
50001
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e6df78e947a9afd230ff05561409898501695e18658e1d6898105f74eb15d326
|
||||||
|
size 1444493752
|
||||||
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3f77d9d06165c94fded39cfea09108e6e8a266a0bd414eaa7aa7ff40582f9667
|
||||||
|
size 1444581337
|
||||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}}
|
||||||
1
tokenizer.json
Normal file
1
tokenizer.json
Normal file
File diff suppressed because one or more lines are too long
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": false, "model_max_length": 1024, "special_tokens_map_file": null, "name_or_path": "microsoft/DialoGPT-medium", "errors": "replace", "tokenizer_class": "GPT2Tokenizer"}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user