Instructions to use AmirMohseni/Velma-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AmirMohseni/Velma-9b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AmirMohseni/Velma-9b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AmirMohseni/Velma-9b") model = AutoModelForCausalLM.from_pretrained("AmirMohseni/Velma-9b") 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 AmirMohseni/Velma-9b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AmirMohseni/Velma-9b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmirMohseni/Velma-9b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AmirMohseni/Velma-9b
- SGLang
How to use AmirMohseni/Velma-9b 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 "AmirMohseni/Velma-9b" \ --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": "AmirMohseni/Velma-9b", "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 "AmirMohseni/Velma-9b" \ --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": "AmirMohseni/Velma-9b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AmirMohseni/Velma-9b with Docker Model Runner:
docker model run hf.co/AmirMohseni/Velma-9b
Velma-9b
Model Overview
Velma-9b is a fine-tuned version of google/gemma-2-9b-it, optimized to improve reasoning capabilities. The model has been trained using the GSM8K dataset, a benchmark dataset designed to enhance mathematical and logical reasoning skills in language models.
This fine-tuning process allows Velma-9b to excel at structured problem-solving, step-by-step reasoning, and logical inference, making it an ideal choice for tasks requiring in-depth analytical thinking.
Features
- Fine-Tuned on GSM8K: Enhanced for mathematical reasoning and step-by-step logical problem-solving.
- Transformer-Based: Built on the powerful
gemma-2-9b-itarchitecture. - Optimized for SFT (Supervised Fine-Tuning): Fine-tuned using TRL (Transformer Reinforcement Learning) for improved inference and structured output generation.
- Efficient Deployment: Compatible with
transformersand supports GPU acceleration for fast inference.
Quick Start
Use the following code to generate text using Velma-9b:
from transformers import pipeline
# Initialize the pipeline
generator = pipeline("text-generation", model="AmirMohseni/Velma-9b", device="cuda")
# Example prompt
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?"
# Generate output
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
Training Procedure
Velma-9b was fine-tuned using the Supervised Fine-Tuning (SFT) approach with the GSM8K dataset. This dataset contains high-quality mathematical and logical reasoning problems that help models develop structured thinking and problem-solving skills.
Training Details
- Base Model: google/gemma-2-9b-it
- Dataset Used: GSM8K
- Fine-Tuning Method: SFT(STaR) using TRL
- Optimization Objective: Supervised fine-tuning to enhance structured reasoning
Framework Versions
- TRL:
0.12.1 - Transformers:
4.46.3 - PyTorch:
2.1.1 - Datasets:
3.1.0 - Tokenizers:
0.20.3
Use Cases
Velma-9b is best suited for tasks requiring structured reasoning and logical inference:
- Mathematical & Logical Reasoning Tasks: Providing step-by-step explanations and structured problem-solving.
- AI Research & Experimentation: Evaluating fine-tuning strategies for reasoning-focused language models.
- Downloads last month
- 6