Instructions to use diabolic6045/harry_potter_chatbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use diabolic6045/harry_potter_chatbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="diabolic6045/harry_potter_chatbot")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("diabolic6045/harry_potter_chatbot") model = AutoModelForCausalLM.from_pretrained("diabolic6045/harry_potter_chatbot") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use diabolic6045/harry_potter_chatbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "diabolic6045/harry_potter_chatbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diabolic6045/harry_potter_chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/diabolic6045/harry_potter_chatbot
- SGLang
How to use diabolic6045/harry_potter_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 "diabolic6045/harry_potter_chatbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diabolic6045/harry_potter_chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "diabolic6045/harry_potter_chatbot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diabolic6045/harry_potter_chatbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use diabolic6045/harry_potter_chatbot with Docker Model Runner:
docker model run hf.co/diabolic6045/harry_potter_chatbot
Commit ·
c0af931
1
Parent(s): 558ae3a
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Harry Potter Chatbot
|
| 2 |
+
|
| 3 |
+
This model is a chatbot designed to generate responses in the style of Harry Potter, the protagonist from J.K. Rowling's popular book series and its movie adaptations.
|
| 4 |
+
|
| 5 |
+
## Model Architecture
|
| 6 |
+
|
| 7 |
+
The `harry_potter_chatbot` is based on the [`DialoGPT-medium`](https://huggingface.co/microsoft/DialoGPT-medium) model, a powerful GPT-based architecture designed for generating conversational responses. It has been fine-tuned on a dataset of Harry Potter's dialogues from movie transcripts.
|
| 8 |
+
|
| 9 |
+
## Usage
|
| 10 |
+
|
| 11 |
+
You can use this model to generate responses for a given input text using the following code:
|
| 12 |
+
|
| 13 |
+
```python
|
| 14 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 15 |
+
|
| 16 |
+
tokenizer = AutoTokenizer.from_pretrained("diabolic6045/harry_potter_chatbot")
|
| 17 |
+
model = AutoModelForCausalLM.from_pretrained("diabolic6045/harry_potter_chatbot")
|
| 18 |
+
|
| 19 |
+
input_text = "What's your favorite spell?"
|
| 20 |
+
input_tokens = tokenizer.encode(input_text, return_tensors='pt')
|
| 21 |
+
output_tokens = model.generate(input_tokens, max_length=50, num_return_sequences=1)
|
| 22 |
+
output_text = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
| 23 |
+
|
| 24 |
+
print(output_text)
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Limitations
|
| 28 |
+
|
| 29 |
+
This model is specifically designed to generate responses in the style of Harry Potter and may not provide accurate or coherent answers to general knowledge questions. It may also sometimes generate inappropriate responses. Be cautious while using this model in a public setting or for critical applications.
|
| 30 |
+
|
| 31 |
+
## Training Data
|
| 32 |
+
|
| 33 |
+
The model was fine-tuned on a dataset of Harry Potter's dialogues from movie transcripts. The dataset was collected from publicly available movie scripts and includes conversations and quotes from various Harry Potter films.
|
| 34 |
+
|
| 35 |
+
## Acknowledgments
|
| 36 |
+
|
| 37 |
+
This model was trained using the Hugging Face [Transformers](https://github.com/huggingface/transformers) library, and it is based on the [`DialoGPT-medium`](https://huggingface.co/microsoft/DialoGPT-medium) model by Microsoft. Special thanks to the Hugging Face team and Microsoft for their contributions to the NLP community.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
Feel free to test the model and provide feedback or report any issues. Enjoy chatting with Harry Potter!
|