Instructions to use harshwardhanjadhav/llama3.2-1b-CoT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harshwardhanjadhav/llama3.2-1b-CoT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="harshwardhanjadhav/llama3.2-1b-CoT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("harshwardhanjadhav/llama3.2-1b-CoT") model = AutoModelForCausalLM.from_pretrained("harshwardhanjadhav/llama3.2-1b-CoT", device_map="auto") 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 harshwardhanjadhav/llama3.2-1b-CoT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "harshwardhanjadhav/llama3.2-1b-CoT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "harshwardhanjadhav/llama3.2-1b-CoT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/harshwardhanjadhav/llama3.2-1b-CoT
- SGLang
How to use harshwardhanjadhav/llama3.2-1b-CoT 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 "harshwardhanjadhav/llama3.2-1b-CoT" \ --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": "harshwardhanjadhav/llama3.2-1b-CoT", "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 "harshwardhanjadhav/llama3.2-1b-CoT" \ --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": "harshwardhanjadhav/llama3.2-1b-CoT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use harshwardhanjadhav/llama3.2-1b-CoT 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 harshwardhanjadhav/llama3.2-1b-CoT 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 harshwardhanjadhav/llama3.2-1b-CoT to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for harshwardhanjadhav/llama3.2-1b-CoT to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="harshwardhanjadhav/llama3.2-1b-CoT", max_seq_length=2048, ) - Docker Model Runner
How to use harshwardhanjadhav/llama3.2-1b-CoT with Docker Model Runner:
docker model run hf.co/harshwardhanjadhav/llama3.2-1b-CoT
Llama-3.2-1B-CoT (OpenThoughts-10k)
Llama-3.2-1B-CoT is a fine-tuned version of unsloth/Llama-3.2-1B-Instruct trained on a curated 10,000-sample subset of the OpenThoughts-114k dataset. It has been trained to generate structured, step-by-step internal reasoning traces before presenting final answers to complex mathematical and analytical problems.
- Developed by: harshwardhanjadhav
- Model Type: Causal Language Model (Fine-tuned for Chain-of-Thought / Systemic Reasoning)
- Base Model:
unsloth/Llama-3.2-1B-Instruct - License: Apache 2.0
- Fine-Tuning Framework: Unsloth & Hugging Face TRL
💡 Model Capabilities & Prompt Structure
This model is fine-tuned to parse multi-step problems by breaking down its internal analysis into distinct <|begin_of_thought|> and <|begin_of_solution|> blocks.
Expected System Prompt
To trigger the Chain-of-Thought pathway correctly, provide the following system prompt in your chat template:
Your role as an assistant involves thoroughly exploring questions through a systematic long thinking process before providing the final precise and accurate solutions.
This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process.
Please structure your response into two main sections: Thought and Solution.
In the Thought section, detail your reasoning process using the specified format: <|begin_of_thought|> {thought with steps separated with '\n\n'} <|end_of_thought|> Each step should include detailed considerations such as analisying questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps.
In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The solution should remain a logical, accurate, concise expression style and detail necessary step needed to reach the conclusion, formatted as follows: <|begin_of_solution|> {final formatted, precise, and clear solution} <|end_of_solution|> Now, try to solve the following question through the above guidelines:
⚡ Quickstart & Usage⚙️ Recommended Inference Hyperparameters[!IMPORTANT]Because 1B parameter reasoning models are prone to infinite repetition during extended thinking phases, repetition_penalty=1.15 and temperature=0.1 are strictly required for output stability. ParameterRecommended ValueReasontemperature0.1Ensures deterministic, logically consistent CoT tracesrepetition_penalty1.15Prevents infinite loops inside long reasoning blockstop_p0.9Filters out low-probability token tailsmax_new_tokens4096Accommodates lengthy multi-step reasoningPython Inference Code (Unsloth) Pythonimport torch from unsloth import FastLanguageModel from transformers import TextStreamer
1. Load Model & Tokenizer
model_name="harshwardhanjadhav/llama3.2-1b-CoT",
max_seq_length=8192,
dtype=torch.float16,
load_in_4bit=False,
)
FastLanguageModel.for_inference(model)
2. Define Messages
3. Stream Output
_ = model.generate(
input_ids=inputs,
streamer=streamer,
max_new_tokens=4096,
temperature=0.1,
repetition_penalty=1.15,
top_p=0.9,
use_cache=True,
)
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
📊 Training DetailsDataset: 10,000 samples from open-thoughts/OpenThoughts-114kSequence Length: 8,192 tokensPrecision: Mixed Precision (fp16 / bf16)Optimization: Fine-tuned 2x faster using Unsloth GPU kernels⚠️ Limitations & Usage AdviceParameter Scale: Being a 1B parameter model, it may struggle with highly abstract mathematical theorems or multi-nested algorithmic code generation compared to 8B+ or 70B models.Context Window: Keep total context (Prompt + Thinking Trace + Solution) under 8,192 tokens.
- Downloads last month
- 632
Model tree for harshwardhanjadhav/llama3.2-1b-CoT
Base model
meta-llama/Llama-3.2-1B-Instruct