Instructions to use SaffalPoosh/reasoning_cpp_llm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SaffalPoosh/reasoning_cpp_llm with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "SaffalPoosh/reasoning_cpp_llm") - Transformers
How to use SaffalPoosh/reasoning_cpp_llm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SaffalPoosh/reasoning_cpp_llm") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SaffalPoosh/reasoning_cpp_llm", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use SaffalPoosh/reasoning_cpp_llm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SaffalPoosh/reasoning_cpp_llm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SaffalPoosh/reasoning_cpp_llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SaffalPoosh/reasoning_cpp_llm
- SGLang
How to use SaffalPoosh/reasoning_cpp_llm 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 "SaffalPoosh/reasoning_cpp_llm" \ --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": "SaffalPoosh/reasoning_cpp_llm", "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 "SaffalPoosh/reasoning_cpp_llm" \ --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": "SaffalPoosh/reasoning_cpp_llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use SaffalPoosh/reasoning_cpp_llm 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 SaffalPoosh/reasoning_cpp_llm 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 SaffalPoosh/reasoning_cpp_llm to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SaffalPoosh/reasoning_cpp_llm to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="SaffalPoosh/reasoning_cpp_llm", max_seq_length=2048, ) - Docker Model Runner
How to use SaffalPoosh/reasoning_cpp_llm with Docker Model Runner:
docker model run hf.co/SaffalPoosh/reasoning_cpp_llm
- Model Card for Model ID
- Model Card for SaffalPoosh/reasoning_cpp_llm
- Example Usage
- Model Details
- Training Details
- Usage Notes
- Output Format
- Requirements
- Hardware Requirements
- Model Details
- Uses
- Bias, Risks, and Limitations
- How to Get Started with the Model
- Training Details
- Evaluation
- Model Examination [optional]
- Environmental Impact
- Technical Specifications [optional]
- Citation [optional]
- Glossary [optional]
- More Information [optional]
- Model Card Authors [optional]
- Model Card Contact
Model Card for Model ID
Model Card for SaffalPoosh/reasoning_cpp_llm
This is a QLoRA adapter trained on C++ coding tasks and designed for reasoning-based code generation. The model specializes in solving algorithmic problems with step-by-step reasoning and generating optimized C++ solutions.
Example Usage
Problem Example
example_problem = """
A robot is situated at the top-left corner of an m x n grid. The robot can only move either down or right at any point in time. It wants to reach the bottom-right corner of the grid. Some cells in the grid are blocked by obstacles. How many unique paths can the robot take to reach the destination?
Constraints:
Time limit per test: 2.0 seconds
Memory limit per test: 256.0 megabytes
1 ≤ m, n ≤ 100
Grid cells are either 0 (empty) or 1 (obstacle).
Input Format:
The first line contains two integers m and n — the dimensions of the grid.
The next m lines each contain n integers (0 or 1) representing the grid.
Output Format:
Print a single integer — the number of unique paths.
Example:
Input:
3 3
0 0 0
0 1 0
0 0 0
"""
Model Loading and Inference
from unsloth import FastLanguageModel
from transformers import TextStreamer
from transformers import TextIteratorStreamer
from threading import Thread
# Model configuration
model_path = "SaffalPoosh/reasoning_cpp_llm"
max_seq_length = 16000
dtype = None
load_in_4bit = True
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=model_path,
max_seq_length=max_seq_length,
dtype=dtype,
load_in_4bit=load_in_4bit,
local_files_only=False
)
# This will download the base model and then patch by applying the LoRA adapters
FastLanguageModel.for_inference(model)
# Prepare Input Data
input_text = example_problem
inputs = tokenizer(input_text, return_tensors="pt")
inputs = {k: v.to("cuda") for k, v in inputs.items()}
# Initialize the text streamer
text_streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=False)
# Perform Inference with streaming
stream_catcher = Thread(
target=model.generate,
kwargs={
**inputs,
"do_sample": True,
"streamer": text_streamer,
"max_new_tokens": 10000
}
)
stream_catcher.start()
# Stream output to console and file
with open("output.txt", "w") as f:
for token in text_streamer:
print(token, end="", flush=True)
f.write(token)
stream_catcher.join()
Model Details
- Model Type: QLoRA Fine-tuned Language Model
- Base Model: [Specify base model if known]
- Training Focus: C++ algorithmic problem solving with reasoning
- Max Sequence Length: 16,000 tokens
- Quantization: 4-bit loading supported
- Hardware Requirements: CUDA-compatible GPU recommended
Training Details
- Training Method: QLoRA (Quantized Low-Rank Adaptation)
- Dataset: C++ coding tasks with reasoning annotations
- Task Type: Code generation with step-by-step reasoning
- Optimization: Focused on algorithmic problem solving
Usage Notes
- The model generates reasoning-based solutions for C++ programming problems
- Supports streaming inference for real-time output
- The
output.txtfile contains the complete generated solution - Designed to handle competitive programming style problems with constraints
Output Format
The model typically generates:
- Problem analysis and reasoning
- Algorithm explanation
- Complete C++ implementation
- Time and space complexity analysis
Requirements
pip install unsloth transformers torch
Hardware Requirements
- GPU: CUDA-compatible GPU (recommended)
- Memory: Sufficient VRAM for 4-bit quantized model
- Storage: Space for base model download and adapter weights
Model Details
Model Description
- Developed by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Model type: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
- Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
Training Details
Training Data
[More Information Needed]
Training Procedure
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]
Framework versions
- PEFT 0.17.1
- Downloads last month
- 4