Instructions to use harpertoken/chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harpertoken/chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="harpertoken/chat")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("harpertoken/chat") model = AutoModelForCausalLM.from_pretrained("harpertoken/chat", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use harpertoken/chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "harpertoken/chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "harpertoken/chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/harpertoken/chat
- SGLang
How to use harpertoken/chat 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 "harpertoken/chat" \ --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": "harpertoken/chat", "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 "harpertoken/chat" \ --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": "harpertoken/chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use harpertoken/chat with Docker Model Runner:
docker model run hf.co/harpertoken/chat
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,108 +1,42 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
language:
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
tags:
|
| 8 |
-
- text-generation-inference
|
| 9 |
-
- conversational-ai
|
| 10 |
- gpt2
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
- bleu
|
| 14 |
-
- f1
|
| 15 |
-
library_name: transformers
|
| 16 |
---
|
| 17 |
|
| 18 |
-
>
|
| 19 |
-
|
| 20 |
-
# HarpertokenConvFT
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
- **Model Name**: HarpertokenConvFT
|
| 24 |
-
- **Base Model**: gpt2
|
| 25 |
-
- **Model Type**: GPT-2-based conversational AI model
|
| 26 |
-
- **Max Sequence Length**: 1024 tokens
|
| 27 |
|
| 28 |
-
|
| 29 |
-
Generates human-like responses for chatbots, virtual assistants, and dialogue systems.
|
| 30 |
|
| 31 |
-
|
| 32 |
-
The model was fine-tuned on the DailyDialog dataset, featuring:
|
| 33 |
-
- **Training Examples**: 11,118
|
| 34 |
-
- **Validation Examples**: 1,000
|
| 35 |
-
- **Test Examples**: 1,000
|
| 36 |
|
| 37 |
-
|
| 38 |
-
- **Description**: A high-quality, multi-turn dialogue dataset covering everyday topics.
|
| 39 |
-
- **Features**: Includes dialogues, communication acts, and emotion annotations.
|
| 40 |
-
- **Citation**:
|
| 41 |
-
```
|
| 42 |
-
@InProceedings{li2017dailydialog,
|
| 43 |
-
author = {Li, Yanran and Su, Hui and Shen, Xiaoyu and Li, Wenjie and Cao, Ziqiang and Niu, Shuzi},
|
| 44 |
-
title = {DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset},
|
| 45 |
-
booktitle = {Proceedings of The 8th International Joint Conference on Natural Language Processing (IJCNLP 2017)},
|
| 46 |
-
year = {2017}
|
| 47 |
-
}
|
| 48 |
-
```
|
| 49 |
|
| 50 |
-
##
|
| 51 |
-
- **Learning Rate**: 2e-5
|
| 52 |
-
- **Batch Size**: 8
|
| 53 |
-
- **Number of Epochs**: 3
|
| 54 |
-
- **Weight Decay**: 0.01
|
| 55 |
|
| 56 |
-
## Ethical Considerations
|
| 57 |
-
Inherited from the GPT-2 base model and the DailyDialog dataset, this model may reflect biases or limitations present in its training data. Caution is advised when using it in sensitive contexts, as it could produce biased or inappropriate responses.
|
| 58 |
-
|
| 59 |
-
## How to Use
|
| 60 |
-
|
| 61 |
-
### Using the Model Directly
|
| 62 |
```python
|
| 63 |
-
from transformers import
|
| 64 |
-
|
| 65 |
-
# Load model and tokenizer
|
| 66 |
-
model = AutoModelForCausalLM.from_pretrained("harpertoken/harpertokenConvFT")
|
| 67 |
-
tokenizer = AutoTokenizer.from_pretrained("harpertoken/harpertokenConvFT")
|
| 68 |
-
|
| 69 |
-
# Prepare input
|
| 70 |
-
input_text = "Hello, how are you?"
|
| 71 |
-
inputs = tokenizer(input_text, return_tensors="pt")
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 76 |
-
print(response)
|
| 77 |
```
|
| 78 |
|
| 79 |
-
|
| 80 |
-
Run the provided script to generate responses:
|
| 81 |
-
```bash
|
| 82 |
-
python3 generate_response.py --input "Hello, how are you?"
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
### Using the API
|
| 86 |
-
**Check API Status:**
|
| 87 |
-
```bash
|
| 88 |
-
curl http://localhost:8000/status
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
**Generate a Response:**
|
| 92 |
-
```bash
|
| 93 |
-
curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"input_text": "Hello, how are you?"}'
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
### Using FastAPI Documentation
|
| 97 |
-
Interact with the API via the browser at:
|
| 98 |
-
[http://localhost:8000/docs#/default/generate_response_chat_post](http://localhost:8000/docs#/default/generate_response_chat_post)
|
| 99 |
-
|
| 100 |
-
## Related Models
|
| 101 |
|
| 102 |
-
|
| 103 |
-
- **Base Model**: This model is fine-tuned from GPT-2 ([openai/gpt2](https://huggingface.co/gpt2)).
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
| 108 |
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
base_model: openai-community/gpt2
|
| 7 |
+
datasets:
|
| 8 |
+
- daily_dialog
|
| 9 |
tags:
|
|
|
|
|
|
|
| 10 |
- gpt2
|
| 11 |
+
- text-generation
|
| 12 |
+
- dialogue
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
+
> Previously published as `harpertoken/harpertokenConvFT`. The old identifier still redirects here.
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# chat
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
`openai-community/gpt2` further fine-tuned on DailyDialog, a corpus of short multi-turn English conversations about everyday topics. The base model is the 124M-parameter GPT-2 — `config.json` records `_name_or_path: gpt2`, twelve layers, 768 embedding dimensions. The previous version of this card declared its base model as `gpt2`, an identifier that has since moved; `openai-community/gpt2` is the current one.
|
|
|
|
| 20 |
|
| 21 |
+
This is a continuation, not a chat model. Nothing here establishes turn-taking, instruction following or any conversational protocol: there is no chat template in `tokenizer_config.json` and no special tokens beyond the end-of-text marker. It produces fluent English that resembles dialogue because that is what it was trained to imitate, which is a weaker property than it sounds.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
The card this replaces documented a `generate_response.py` script and a FastAPI service on `localhost:8000` with `/status`, `/chat` and interactive docs endpoints. None of that is in the repository — it contains weights and tokenizer files only — so those sections have been removed. The declared perplexity, BLEU and F1 metrics likewise had no values behind them; no evaluation is recorded for this checkpoint.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
```python
|
| 28 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
generator = pipeline("text-generation", model="harpertoken/chat")
|
| 31 |
+
print(generator("Hello, how are you?", max_new_tokens=60)[0]["generated_text"])
|
|
|
|
|
|
|
| 32 |
```
|
| 33 |
|
| 34 |
+
A `pad_token` is not configured, so batching prompts together will warn. Set `tokenizer.pad_token = tokenizer.eos_token` if you need it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
## Limitations
|
|
|
|
| 37 |
|
| 38 |
+
DailyDialog is scripted, crowd-sourced, and narrow — 13k conversations of polite small talk, annotated for emotion and communication acts. A model trained on it will handle greetings and farewells far better than disagreement, and will reproduce the register of that corpus rather than anything wider. Because GPT-2 is a 124M-parameter base and the fine-tuning is small, output is frequently fluent and wrong. The biases of both GPT-2 and DailyDialog carry through unchanged.
|
| 39 |
|
| 40 |
+
## Attribution
|
| 41 |
|
| 42 |
+
GPT-2 follows Radford et al. (2018). DailyDialog is described in Li et al., *DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset*, IJCNLP 2017.
|