Towards a Human-like Open-Domain Chatbot
Paper • 2001.09977 • Published
How to use t-bank-ai/ruDialoGPT-small with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="t-bank-ai/ruDialoGPT-small")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("t-bank-ai/ruDialoGPT-small", dtype="auto")How to use t-bank-ai/ruDialoGPT-small with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "t-bank-ai/ruDialoGPT-small"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "t-bank-ai/ruDialoGPT-small",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/t-bank-ai/ruDialoGPT-small
How to use t-bank-ai/ruDialoGPT-small with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "t-bank-ai/ruDialoGPT-small" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "t-bank-ai/ruDialoGPT-small",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "t-bank-ai/ruDialoGPT-small" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "t-bank-ai/ruDialoGPT-small",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use t-bank-ai/ruDialoGPT-small with Docker Model Runner:
docker model run hf.co/t-bank-ai/ruDialoGPT-small
This generation model is based on sberbank-ai/rugpt3small_based_on_gpt2. It's trained on large corpus of dialog data and can be used for buildning generative conversational agents
The model was trained with context size 3
On a private validation set we calculated metrics introduced in this paper:
| sensibleness | specificity | SSA | |
|---|---|---|---|
| tinkoff-ai/ruDialoGPT-small | 0.64 | 0.5 | 0.57 |
| tinkoff-ai/ruDialoGPT-medium | 0.78 | 0.69 | 0.735 |
How to use:
import torch
from transformers import AutoTokenizer, AutoModelWithLMHead
tokenizer = AutoTokenizer.from_pretrained('tinkoff-ai/ruDialoGPT-small')
model = AutoModelWithLMHead.from_pretrained('tinkoff-ai/ruDialoGPT-small')
inputs = tokenizer('@@ПЕРВЫЙ@@ привет @@ВТОРОЙ@@ привет @@ПЕРВЫЙ@@ как дела? @@ВТОРОЙ@@', return_tensors='pt')
generated_token_ids = model.generate(
**inputs,
top_k=10,
top_p=0.95,
num_beams=3,
num_return_sequences=3,
do_sample=True,
no_repeat_ngram_size=2,
temperature=1.2,
repetition_penalty=1.2,
length_penalty=1.0,
eos_token_id=50257,
max_new_tokens=40
)
context_with_response = [tokenizer.decode(sample_token_ids) for sample_token_ids in generated_token_ids]
context_with_response