Text Generation
Transformers
PyTorch
TensorBoard
Safetensors
qwen2
Generated from Trainer
axolotl
dpo
trl
unsloth
conversational
text-generation-inference
Instructions to use Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9") model = AutoModelForCausalLM.from_pretrained("Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", 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 Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9
- SGLang
How to use Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 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 "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9" \ --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": "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", "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 "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9" \ --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": "Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", max_seq_length=2048, ) - Docker Model Runner
How to use Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9 with Docker Model Runner:
docker model run hf.co/Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9
End of training
Browse files- README.md +70 -0
- adapter_model.bin +3 -0
- config.json +0 -1
- generation_config.json +15 -0
- pytorch_model.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: unsloth/Qwen2-1.5B-Instruct
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: d0418eba-34ac-4759-87f2-3d693d4da9e9
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- axolotl
|
| 8 |
+
- dpo
|
| 9 |
+
- trl
|
| 10 |
+
- unsloth
|
| 11 |
+
licence: license
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Model Card for d0418eba-34ac-4759-87f2-3d693d4da9e9
|
| 15 |
+
|
| 16 |
+
This model is a fine-tuned version of [unsloth/Qwen2-1.5B-Instruct](https://huggingface.co/unsloth/Qwen2-1.5B-Instruct).
|
| 17 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 18 |
+
|
| 19 |
+
## Quick start
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from transformers import pipeline
|
| 23 |
+
|
| 24 |
+
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
| 25 |
+
generator = pipeline("text-generation", model="Alphatao/d0418eba-34ac-4759-87f2-3d693d4da9e9", device="cuda")
|
| 26 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 27 |
+
print(output["generated_text"])
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Training procedure
|
| 31 |
+
|
| 32 |
+
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/alphatao-alphatao/Gradients-On-Demand/runs/4kxjd28c)
|
| 33 |
+
|
| 34 |
+
This model was trained with DPO, a method introduced in [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://huggingface.co/papers/2305.18290).
|
| 35 |
+
|
| 36 |
+
### Framework versions
|
| 37 |
+
|
| 38 |
+
- TRL: 0.12.0.dev0
|
| 39 |
+
- Transformers: 4.46.0
|
| 40 |
+
- Pytorch: 2.5.0+cu124
|
| 41 |
+
- Datasets: 3.0.1
|
| 42 |
+
- Tokenizers: 0.20.1
|
| 43 |
+
|
| 44 |
+
## Citations
|
| 45 |
+
|
| 46 |
+
Cite DPO as:
|
| 47 |
+
|
| 48 |
+
```bibtex
|
| 49 |
+
@inproceedings{rafailov2023direct,
|
| 50 |
+
title = {{Direct Preference Optimization: Your Language Model is Secretly a Reward Model}},
|
| 51 |
+
author = {Rafael Rafailov and Archit Sharma and Eric Mitchell and Christopher D. Manning and Stefano Ermon and Chelsea Finn},
|
| 52 |
+
year = 2023,
|
| 53 |
+
booktitle = {Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023},
|
| 54 |
+
url = {http://papers.nips.cc/paper_files/paper/2023/hash/a85b405ed65c6477a4fe8302b5e06ce7-Abstract-Conference.html},
|
| 55 |
+
editor = {Alice Oh and Tristan Naumann and Amir Globerson and Kate Saenko and Moritz Hardt and Sergey Levine},
|
| 56 |
+
}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Cite TRL as:
|
| 60 |
+
|
| 61 |
+
```bibtex
|
| 62 |
+
@misc{vonwerra2022trl,
|
| 63 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
| 64 |
+
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallouédec},
|
| 65 |
+
year = 2020,
|
| 66 |
+
journal = {GitHub repository},
|
| 67 |
+
publisher = {GitHub},
|
| 68 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 69 |
+
}
|
| 70 |
+
```
|
adapter_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a8918c10592febbfe477b27b7d3cdffb4970861c2f4891484317c6b6543bd5b
|
| 3 |
+
size 295577898
|
config.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"_attn_implementation_autoset": true,
|
| 3 |
"_name_or_path": "unsloth/Qwen2-1.5B-Instruct",
|
| 4 |
"architectures": [
|
| 5 |
"Qwen2ForCausalLM"
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"_name_or_path": "unsloth/Qwen2-1.5B-Instruct",
|
| 3 |
"architectures": [
|
| 4 |
"Qwen2ForCausalLM"
|
generation_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"max_length": 32768,
|
| 9 |
+
"pad_token_id": 151643,
|
| 10 |
+
"repetition_penalty": 1.1,
|
| 11 |
+
"temperature": 0.7,
|
| 12 |
+
"top_k": 20,
|
| 13 |
+
"top_p": 0.8,
|
| 14 |
+
"transformers_version": "4.46.0"
|
| 15 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af1e4697ce03c250d8fb4ec71c33c2f637dca8555b92e17594c71d1b6b79b804
|
| 3 |
+
size 3383119922
|