Instructions to use hello12w/persona_chatbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hello12w/persona_chatbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hello12w/persona_chatbot") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hello12w/persona_chatbot") model = AutoModelForCausalLM.from_pretrained("hello12w/persona_chatbot", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hello12w/persona_chatbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hello12w/persona_chatbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hello12w/persona_chatbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hello12w/persona_chatbot
- SGLang
How to use hello12w/persona_chatbot with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hello12w/persona_chatbot" \ --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": "hello12w/persona_chatbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "hello12w/persona_chatbot" \ --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": "hello12w/persona_chatbot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hello12w/persona_chatbot with Docker Model Runner:
docker model run hf.co/hello12w/persona_chatbot
metadata
license: mit
language:
- en
library_name: transformers
datasets:
- Cynaptics/persona-chat
DialoGPT-Chat-Finetune
This is a fine-tuned version of the DialoGPT model. It has been fine-tuned on persona-based data to generate human-like conversational responses.
Model Description
The model is based on the DialoGPT architecture and has been fine-tuned for conversational tasks, specifically targeting persona-based interactions.
Model Details
- Architecture: DialoGPT-medium
- Pretraining Data: The original model was pretrained on a large corpus of text data.
- Fine-tuning Data: This model was fine-tuned on persona-based conversational data.
Library
- Framework: PyTorch
- Model: DialoGPT-medium
Example Usage
You can use this model via the Hugging Face transformers library.
To use the fine-tuned model for text generation based on a persona, follow these steps:
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
# Load the fine-tuned model and tokenizer
model_name = "hello12w/persona_chatbot"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Define the persona and prompt
prompt = prompt = f"""
Person B has the following Persona information.
Persona of Person B: My name is Sarah and I'm a 28 year old software engineer.
Persona of Person B: I love coding and developing new software applications.
Persona of Person B: In my free time, I enjoy reading sci-fi novels and playing board games.
Instruct: Person A and Person B are now having a conversation.
Following the conversation below, write a response that Person B would say based on the above Persona information.
Please carefully consider the flow and context of the conversation below, and use the Person B's Persona information appropriately to generate a response that you think is the most appropriate reply for Person B.
Persona A: Hi Sarah, I heard you're working on a cool project at work. Can you tell me more about it?
Output:
"""
input_ids = tokenizer(prompt, return_tensors="pt", truncation=True)
attention_mask = input_ids.attention_mask
input_ids = input_ids.input_ids
# Inference
with torch.no_grad():
outputs = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
max_new_tokens=200,
do_sample=True,
top_p=0.95,
temperature=0.9
)
# Decode output tokens
decoded_outputs = tokenizer.batch_decode(outputs, skip_special_tokens=True)
output = decoded_outputs[0][len(prompt):]
print(output)