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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SaffalPoosh/reasoning_cpp_llm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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 Desktop
- Docker Model Runner
How to use SaffalPoosh/reasoning_cpp_llm with Docker Model Runner:
docker model run hf.co/SaffalPoosh/reasoning_cpp_llm
Update README.md
Browse filesadded code for inference
8 unmodified lines910111213141 unmodified line1617181920218 unmodified lines- transformers- trl- unsloth---# Model Card for Model ID1 unmodified line<!-- Provide a quick summary of what the model is/does. -->## Model Details8 unmodified lines910111213141516171 unmodified line1920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051068 unmodified lines- transformers- trl- unslothlicense: apache-2.0datasets:- open-r1/codeforces-cots---# Model Card for Model ID1 unmodified line<!-- Provide a quick summary of what the model is/does. -->this is qlora adapter trained on the CPP coding tasks and its trained for reasoning based generation.```pythonexample_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 secondsMemory limit per test: 256.0 megabytes1 ≤ m, n ≤ 100Grid 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:```input3 30 0 00 1 00 0 0```"""from unsloth import FastLanguageModelfrom transformers import TextStreamermodel_path = "SaffalPoosh/reasoning_cpp_llm"max_seq_length = 16000dtype = Noneload_in_4bit = Truemodel, 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 adaptersfrom transformers import TextIteratorStreamerFastLanguageModel.for_inference(model)from threading import Thread# Prepare Input Datainput_text = example_probleminputs = tokenizer(input_text, return_tensors="pt")inputs = {k:v.to("cuda") for k,v in inputs.items()}# Initialize the text streamertext_streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=False)# Perform Inference# _ = model.generate(**inputs, streamer=text_streamer, max_new_tokens=8000)stream_catcher = Thread(target=model.generate, kwargs={**inputs, "do_sample": True, "streamer": text_streamer,# "eos_token_id": tokenizer.eos_token_id,"max_new_tokens": 10000})stream_catcher.start()with open("output.txt", "w") as f:for token in text_streamer:print(token, end="", flush=True)f.write(token)stream_catcher.join()```the `output.txt` file shows the output of generation.## Model Details
README.md+85