初始化项目,由ModelHub XC社区提供模型
Model: iamhariraj/DialoGPT-small-Rick Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
123
README.md
Normal file
123
README.md
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
---
|
||||||
|
language: en
|
||||||
|
license: mit
|
||||||
|
tags:
|
||||||
|
- text-generation
|
||||||
|
- conversational
|
||||||
|
- dialogpt
|
||||||
|
- rick-and-morty
|
||||||
|
- fine-tuned
|
||||||
|
- pytorch
|
||||||
|
- transformers
|
||||||
|
base_model: microsoft/DialoGPT-small
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
---
|
||||||
|
|
||||||
|
# DialoGPT-small-Rick 🧪
|
||||||
|
|
||||||
|
A conversational AI fine-tuned to talk like **Rick Sanchez** from *Rick and Morty*.
|
||||||
|
Built on top of [microsoft/DialoGPT-small](https://huggingface.co/microsoft/DialoGPT-small) and trained on Rick's dialogue from the show.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Try it Live
|
||||||
|
|
||||||
|
👉 [**RickChatBot — Gradio Space**](https://huggingface.co/spaces/iamhariraj/RickChatBot)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧠 Model Details
|
||||||
|
|
||||||
|
| Property | Value |
|
||||||
|
|----------------|------------------------------------|
|
||||||
|
| Base Model | microsoft/DialoGPT-small |
|
||||||
|
| Architecture | GPT-2 (117M parameters) |
|
||||||
|
| Task | Conversational Text Generation |
|
||||||
|
| Fine-tuned on | Rick Sanchez dialogue (Rick & Morty)|
|
||||||
|
| Framework | PyTorch + HuggingFace Transformers |
|
||||||
|
| Language | English |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💬 How to Use
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
import torch
|
||||||
|
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained("iamhariraj/DialoGPT-small-Rick")
|
||||||
|
model = AutoModelForCausalLM.from_pretrained("iamhariraj/DialoGPT-small-Rick")
|
||||||
|
|
||||||
|
chat_history_ids = None
|
||||||
|
|
||||||
|
print("Talk to Rick (type 'quit' to exit)")
|
||||||
|
while True:
|
||||||
|
user_input = input("You: ")
|
||||||
|
if user_input.lower() == "quit":
|
||||||
|
break
|
||||||
|
|
||||||
|
input_ids = tokenizer.encode(
|
||||||
|
user_input + tokenizer.eos_token,
|
||||||
|
return_tensors="pt"
|
||||||
|
)
|
||||||
|
|
||||||
|
if chat_history_ids is not None:
|
||||||
|
input_ids = torch.cat([chat_history_ids, input_ids], dim=-1)
|
||||||
|
|
||||||
|
chat_history_ids = model.generate(
|
||||||
|
input_ids,
|
||||||
|
max_length=1000,
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
response = tokenizer.decode(
|
||||||
|
chat_history_ids[:, input_ids.shape[-1]:][0],
|
||||||
|
skip_special_tokens=True
|
||||||
|
)
|
||||||
|
print(f"Rick: {response}")
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Example Conversations
|
||||||
|
|
||||||
|
| You | Rick |
|
||||||
|
|-----|------|
|
||||||
|
| "What is the meaning of life?" | *(Rick-style nihilistic response)* |
|
||||||
|
| "Can you build me a portal gun?" | *(Rick flexing his genius)* |
|
||||||
|
| "I need your help" | *(sarcastic Rick response)* |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚠️ Limitations
|
||||||
|
|
||||||
|
- Based on DialoGPT-**small** — responses can sometimes be generic or repetitive
|
||||||
|
- May not always stay perfectly in character
|
||||||
|
- Not suitable for serious or sensitive conversations
|
||||||
|
- Trained on a limited dialogue dataset
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 Training
|
||||||
|
|
||||||
|
- **Base:** microsoft/DialoGPT-small
|
||||||
|
- **Data:** Rick Sanchez lines extracted from Rick and Morty scripts
|
||||||
|
- **Framework:** HuggingFace Transformers + PyTorch
|
||||||
|
- **Trainer:** HuggingFace `Trainer` API
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👤 Author
|
||||||
|
|
||||||
|
Made by [iamhariraj](https://huggingface.co/iamhariraj)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
MIT
|
||||||
38
config.json
Normal file
38
config.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "output-small",
|
||||||
|
"activation_function": "gelu_new",
|
||||||
|
"architectures": [
|
||||||
|
"GPT2LMHeadModel"
|
||||||
|
],
|
||||||
|
"attn_pdrop": 0.1,
|
||||||
|
"bos_token_id": 50256,
|
||||||
|
"embd_pdrop": 0.1,
|
||||||
|
"eos_token_id": 50256,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"layer_norm_epsilon": 1e-05,
|
||||||
|
"model_type": "gpt2",
|
||||||
|
"n_ctx": 1024,
|
||||||
|
"n_embd": 768,
|
||||||
|
"n_head": 12,
|
||||||
|
"n_inner": null,
|
||||||
|
"n_layer": 12,
|
||||||
|
"n_positions": 1024,
|
||||||
|
"reorder_and_upcast_attn": false,
|
||||||
|
"resid_pdrop": 0.1,
|
||||||
|
"scale_attn_by_inverse_layer_idx": false,
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch_dtype": "float32",
|
||||||
|
"transformers_version": "4.34.1",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 50257
|
||||||
|
}
|
||||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 50256,
|
||||||
|
"eos_token_id": 50256,
|
||||||
|
"transformers_version": "4.34.1"
|
||||||
|
}
|
||||||
50001
merges.txt
Normal file
50001
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
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:b51a7861dd47d836cd94cfe1cffbf06431fbfff1dcdfb022686f982c3eb37447
|
||||||
|
size 497805149
|
||||||
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
100305
tokenizer.json
Normal file
100305
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
22
tokenizer_config.json
Normal file
22
tokenizer_config.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"add_bos_token": false,
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"50256": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bos_token": "<|endoftext|>",
|
||||||
|
"clean_up_tokenization_spaces": true,
|
||||||
|
"eos_token": "<|endoftext|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"model_max_length": 1024,
|
||||||
|
"pad_token": null,
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"unk_token": "<|endoftext|>"
|
||||||
|
}
|
||||||
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