Text Generation
Transformers
GGUF
Safetensors
English
math
tulu
trl
llama
text-generation-inference
math_lingo
conversational
Instructions to use QuantFactory/Tulu-MathLingo-8B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/Tulu-MathLingo-8B-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/Tulu-MathLingo-8B-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Tulu-MathLingo-8B-GGUF", filename="Tulu-MathLingo-8B.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Tulu-MathLingo-8B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Tulu-MathLingo-8B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/Tulu-MathLingo-8B-GGUF 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 "QuantFactory/Tulu-MathLingo-8B-GGUF" \ --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": "QuantFactory/Tulu-MathLingo-8B-GGUF", "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 "QuantFactory/Tulu-MathLingo-8B-GGUF" \ --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": "QuantFactory/Tulu-MathLingo-8B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Ollama:
ollama run hf.co/QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/Tulu-MathLingo-8B-GGUF 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 QuantFactory/Tulu-MathLingo-8B-GGUF 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 QuantFactory/Tulu-MathLingo-8B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/Tulu-MathLingo-8B-GGUF to start chatting
- Pi
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- Docker Model Runner
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Tulu-MathLingo-8B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Tulu-MathLingo-8B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Tulu-MathLingo-8B-GGUF-Q4_K_M
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
|
| 4 |
+
license: creativeml-openrail-m
|
| 5 |
+
datasets:
|
| 6 |
+
- microsoft/orca-math-word-problems-200k
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
base_model:
|
| 10 |
+
- allenai/Llama-3.1-Tulu-3-8B
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
library_name: transformers
|
| 13 |
+
tags:
|
| 14 |
+
- safetensors
|
| 15 |
+
- math
|
| 16 |
+
- tulu
|
| 17 |
+
- trl
|
| 18 |
+
- llama
|
| 19 |
+
- text-generation-inference
|
| 20 |
+
- math_lingo
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
[](https://hf.co/QuantFactory)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# QuantFactory/Tulu-MathLingo-8B-GGUF
|
| 28 |
+
This is quantized version of [prithivMLmods/Tulu-MathLingo-8B](https://huggingface.co/prithivMLmods/Tulu-MathLingo-8B) created using llama.cpp
|
| 29 |
+
|
| 30 |
+
# Original Model Card
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Tulu-MathLingo-8B Model Files
|
| 34 |
+
|
| 35 |
+
The **Tulu-MathLingo-8B** model is a fine-tuned version of **meta-llama/Llama-3.1-8B**, optimized for solving mathematical word problems and reasoning tasks in English and the Tulu language. The model integrates advanced language understanding and reasoning capabilities with a focus on providing solutions to math-related queries.
|
| 36 |
+
|
| 37 |
+
| **File Name** | **Size** | **Description** | **Upload Status** |
|
| 38 |
+
|-----------------------------------|--------------|------------------------------------------------|-------------------|
|
| 39 |
+
| `.gitattributes` | 1.57 kB | Configures LFS tracking for large files. | Updated |
|
| 40 |
+
| `README.md` | 292 Bytes | Basic details about the uploaded model. | Updated |
|
| 41 |
+
| `config.json` | 988 Bytes | Contains model architecture and metadata. | Uploaded |
|
| 42 |
+
| `generation_config.json` | 241 Bytes | Parameters for text generation (e.g., length, temperature). | Uploaded |
|
| 43 |
+
| `model-00001-of-00004.safetensors`| 4.98 GB | Part 1 of model weights. | Uploaded (LFS) |
|
| 44 |
+
| `model-00002-of-00004.safetensors`| 5 GB | Part 2 of model weights. | Uploaded (LFS) |
|
| 45 |
+
| `model-00003-of-00004.safetensors`| 4.92 GB | Part 3 of model weights. | Uploaded (LFS) |
|
| 46 |
+
| `model-00004-of-00004.safetensors`| 1.17 GB | Part 4 of model weights. | Uploaded (LFS) |
|
| 47 |
+
| `model.safetensors.index.json` | 25.4 kB | Index file for multi-part model weights. | Uploaded |
|
| 48 |
+
| `special_tokens_map.json` | 462 Bytes | Maps special tokens (e.g., `<PAD>`, `<EOS>`). | Uploaded |
|
| 49 |
+
| `tokenizer.json` | 17.2 MB | Full tokenizer configuration. | Uploaded (LFS) |
|
| 50 |
+
| `tokenizer_config.json` | 57.6 kB | Metadata for tokenizer usage. | Uploaded |
|
| 51 |
+
### Sample Solve
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
|
| 55 |
+
### **Key Features**
|
| 56 |
+
|
| 57 |
+
1. **Multilingual Math Reasoning:**
|
| 58 |
+
- Designed for solving complex math problems in **English** and **Tulu**.
|
| 59 |
+
|
| 60 |
+
2. **Text Generation:**
|
| 61 |
+
- Generates detailed and contextually accurate text responses.
|
| 62 |
+
|
| 63 |
+
3. **Fine-Tuned Specializations:**
|
| 64 |
+
- Trained on the **microsoft/orca-math-word-problems-200k** dataset for word problem-solving.
|
| 65 |
+
|
| 66 |
+
4. **Special Token Mapping:**
|
| 67 |
+
- Configured to use tokens for specific functions such as `<PAD>` and `<EOS>` effectively.
|
| 68 |
+
|
| 69 |
+
5. **Secure and Efficient Storage:**
|
| 70 |
+
- Model weights are stored in the **Safetensors** format for secure and faster inference.
|
| 71 |
+
|
| 72 |
+
6. **Large Parameter Size:**
|
| 73 |
+
- 8.03 billion parameters enable handling complex queries and multi-turn conversations.
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
### **Training Details**
|
| 78 |
+
|
| 79 |
+
- **Base Model:** [meta-llama/Llama-3.1-8B](#)
|
| 80 |
+
- **Fine-Tuned:**
|
| 81 |
+
- Through multiple stages: **SFT (Supervised Fine-Tuning)** and **DPO (Direct Preference Optimization)**.
|
| 82 |
+
|
| 83 |
+
- **Dataset:**
|
| 84 |
+
- Trained on **200k word problems** from the **Microsoft Orca Math Word Problems Dataset**.
|
| 85 |
+
|
| 86 |
+
- **Model Size:**
|
| 87 |
+
- 8.03B parameters, optimized for **FP16** tensor type.
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
### **Applications**
|
| 92 |
+
|
| 93 |
+
1. **Mathematical Word Problems:**
|
| 94 |
+
- Solve structured or unstructured math problems in natural language.
|
| 95 |
+
|
| 96 |
+
2. **Conversational AI for Math:**
|
| 97 |
+
- Engage users in interactive dialogues focused on math and logic reasoning.
|
| 98 |
+
|
| 99 |
+
3. **Multilingual Support:**
|
| 100 |
+
- Supports queries in **Tulu** and **English**, enhancing accessibility.
|
| 101 |
+
|
| 102 |
+
4. **Education Tools:**
|
| 103 |
+
- Useful in tutoring systems for math, helping students with problem-solving.
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
### **Usage**
|
| 108 |
+
|
| 109 |
+
#### **Loading the Model**
|
| 110 |
+
```python
|
| 111 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 112 |
+
|
| 113 |
+
model_name = "prithivMLmods/Tulu-MathLingo-8B"
|
| 114 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 115 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="fp16")
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
##### **Math Word Problem**
|
| 121 |
+
```python
|
| 122 |
+
query = "If a train travels 60 miles in 2 hours, what is its average speed?"
|
| 123 |
+
inputs = tokenizer(query, return_tensors="pt")
|
| 124 |
+
outputs = model.generate(**inputs, max_length=100)
|
| 125 |
+
|
| 126 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 127 |
+
print("Answer:", response)
|
| 128 |
+
```
|
| 129 |
+
### **Performance Requirements**
|
| 130 |
+
|
| 131 |
+
- **Hardware:**
|
| 132 |
+
- Requires a GPU with at least **24GB VRAM** for optimal performance due to model size and FP16 usage.
|
| 133 |
+
|
| 134 |
+
- **Optimization:**
|
| 135 |
+
- Use mixed precision (`fp16`) for reduced memory footprint.
|
| 136 |
+
- Split inference across multiple GPUs if necessary.
|
| 137 |
+
|
| 138 |
+
---
|