Text Generation
Transformers
Safetensors
English
qwen2
Generated from Trainer
sft
ultrafeedback
conversational
text-generation-inference
Instructions to use activeDap/Qwen1.5-1.8B_ultrafeedback_chosen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use activeDap/Qwen1.5-1.8B_ultrafeedback_chosen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="activeDap/Qwen1.5-1.8B_ultrafeedback_chosen") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("activeDap/Qwen1.5-1.8B_ultrafeedback_chosen") model = AutoModelForCausalLM.from_pretrained("activeDap/Qwen1.5-1.8B_ultrafeedback_chosen") 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 activeDap/Qwen1.5-1.8B_ultrafeedback_chosen with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/activeDap/Qwen1.5-1.8B_ultrafeedback_chosen
- SGLang
How to use activeDap/Qwen1.5-1.8B_ultrafeedback_chosen 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 "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen" \ --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": "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen", "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 "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen" \ --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": "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use activeDap/Qwen1.5-1.8B_ultrafeedback_chosen with Docker Model Runner:
docker model run hf.co/activeDap/Qwen1.5-1.8B_ultrafeedback_chosen
| license: apache-2.0 | |
| base_model: Qwen/Qwen1.5-1.8B | |
| tags: | |
| - generated_from_trainer | |
| - sft | |
| - ultrafeedback | |
| datasets: | |
| - activeDap/ultrafeedback_chosen | |
| language: | |
| - en | |
| library_name: transformers | |
| # Qwen1.5-1.8B Fine-tuned on ultrafeedback_chosen | |
| This model is a fine-tuned version of [Qwen/Qwen1.5-1.8B](https://huggingface.co/Qwen/Qwen1.5-1.8B) on the [activeDap/ultrafeedback_chosen](https://huggingface.co/datasets/activeDap/ultrafeedback_chosen) dataset. | |
| ## Training Results | |
|  | |
| ### Training Statistics | |
| | Metric | Value | | |
| |--------|-------| | |
| | Total Steps | 816 | | |
| | Final Training Loss | 1.5145 | | |
| | Min Training Loss | 1.5145 | | |
| | Training Runtime | 263.04 seconds | | |
| | Samples/Second | 198.53 | | |
| ## Training Configuration | |
| | Parameter | Value | | |
| |-----------|-------| | |
| | Base Model | Qwen/Qwen1.5-1.8B | | |
| | Dataset | activeDap/ultrafeedback_chosen | | |
| | Number of Epochs | 1.0 | | |
| | Per Device Batch Size | 16 | | |
| | Gradient Accumulation Steps | 1 | | |
| | Total Batch Size | 64 (4 GPUs) | | |
| | Learning Rate | 2e-05 | | |
| | LR Scheduler | cosine | | |
| | Warmup Ratio | 0.1 | | |
| | Max Sequence Length | 512 | | |
| | Optimizer | adamw_torch_fused | | |
| | Mixed Precision | BF16 | | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_name = "activeDap/Qwen1.5-1.8B_ultrafeedback_chosen" | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModelForCausalLM.from_pretrained(model_name) | |
| # Format input with prompt template | |
| prompt = "What is machine learning?\nAssistant:" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| # Generate response | |
| outputs = model.generate(**inputs, max_new_tokens=100) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ## Training Framework | |
| - **Library:** Transformers + TRL | |
| - **Training Type:** Supervised Fine-Tuning (SFT) | |
| - **Format:** Prompt-completion with Assistant-only loss | |
| ## Citation | |
| If you use this model, please cite the original base model and dataset: | |
| ```bibtex | |
| @misc{ultrafeedback2023, | |
| title={UltraFeedback: Boosting Language Models with High-quality Feedback}, | |
| author={Ganqu Cui and Lifan Yuan and Ning Ding and others}, | |
| year={2023}, | |
| eprint={2310.01377}, | |
| archivePrefix={arXiv} | |
| } | |
| ``` | |