Text Generation
Transformers
Safetensors
English
mistral
llama-factory
unsloth
conversational
text-generation-inference
Instructions to use trollek/danube2-1.8b-MathInstruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trollek/danube2-1.8b-MathInstruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="trollek/danube2-1.8b-MathInstruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("trollek/danube2-1.8b-MathInstruct") model = AutoModelForCausalLM.from_pretrained("trollek/danube2-1.8b-MathInstruct") 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
- vLLM
How to use trollek/danube2-1.8b-MathInstruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trollek/danube2-1.8b-MathInstruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trollek/danube2-1.8b-MathInstruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/trollek/danube2-1.8b-MathInstruct
- SGLang
How to use trollek/danube2-1.8b-MathInstruct 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 "trollek/danube2-1.8b-MathInstruct" \ --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": "trollek/danube2-1.8b-MathInstruct", "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 "trollek/danube2-1.8b-MathInstruct" \ --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": "trollek/danube2-1.8b-MathInstruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use trollek/danube2-1.8b-MathInstruct 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 trollek/danube2-1.8b-MathInstruct 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 trollek/danube2-1.8b-MathInstruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for trollek/danube2-1.8b-MathInstruct to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="trollek/danube2-1.8b-MathInstruct", max_seq_length=2048, ) - Docker Model Runner
How to use trollek/danube2-1.8b-MathInstruct with Docker Model Runner:
docker model run hf.co/trollek/danube2-1.8b-MathInstruct
Update README.md
Browse files
README.md
CHANGED
|
@@ -72,4 +72,34 @@ val_size: 0.01
|
|
| 72 |
per_device_eval_batch_size: 1
|
| 73 |
eval_strategy: steps
|
| 74 |
eval_steps: 1000
|
| 75 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
per_device_eval_batch_size: 1
|
| 73 |
eval_strategy: steps
|
| 74 |
eval_steps: 1000
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### BAdam training results
|
| 78 |
+
|
| 79 |
+
| Training Loss | Epoch | Step | Validation Loss |
|
| 80 |
+
|:-------------:|:------:|:-----:|:---------------:|
|
| 81 |
+
| 0.2748 | 0.0617 | 1000 | 0.2788 |
|
| 82 |
+
| 0.2786 | 0.1234 | 2000 | 0.2503 |
|
| 83 |
+
| 0.18 | 0.1850 | 3000 | 0.2144 |
|
| 84 |
+
| 0.2015 | 0.2467 | 4000 | 0.1926 |
|
| 85 |
+
| 0.2044 | 0.3084 | 5000 | 0.1777 |
|
| 86 |
+
| 0.142 | 0.3701 | 6000 | 0.1661 |
|
| 87 |
+
| 0.1813 | 0.4317 | 7000 | 0.1570 |
|
| 88 |
+
| 0.1413 | 0.4934 | 8000 | 0.1529 |
|
| 89 |
+
| 0.1805 | 0.5551 | 9000 | 0.1462 |
|
| 90 |
+
| 0.1431 | 0.6168 | 10000 | 0.1410 |
|
| 91 |
+
| 0.1693 | 0.6784 | 11000 | 0.1375 |
|
| 92 |
+
| 0.1291 | 0.7401 | 12000 | 0.1357 |
|
| 93 |
+
| 0.1501 | 0.8018 | 13000 | 0.1348 |
|
| 94 |
+
| 0.1521 | 0.8635 | 14000 | 0.1345 |
|
| 95 |
+
| 0.1279 | 0.9251 | 15000 | 0.1346 |
|
| 96 |
+
| 0.1351 | 0.9868 | 16000 | 0.1344 |
|
| 97 |
+
|
| 98 |
+
### GSM8K results
|
| 99 |
+
|
| 100 |
+
|Tasks|Version| Filter |n-shot| Metric |Value | |Stderr|
|
| 101 |
+
|-----|------:|----------------|-----:|-----------|-----:|---|-----:|
|
| 102 |
+
|gsm8k| 3|strict-match | 5|exact_match|0.2691|± |0.0122|
|
| 103 |
+
| | |flexible-extract| 5|exact_match|0.2752|± |0.0123|
|
| 104 |
+
|
| 105 |
+
It matches the chat trained model from h2o.
|