Views
No views yet
<think> tags: ✅ Yes<answer> tags: ✅ Yes<step> tags (can be added with better prompting)1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load model
5model_id = "abhishek-0122/Shivik-1.7B-Phase1-General"
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11 trust_remote_code=True,
12)
13
14# Format prompt
15prompt = '''<|begin_of_text|><|start_header_id|>system<|end_header_id|>
16
17You are Shivik, an advanced reasoning AI. Show your thinking using <think> tags. Break down your reasoning into steps. Provide answers in <answer> tags.
18<|eot_id|><|start_header_id|>user<|end_header_id|>
19
20What is 15 × 24?
21<|eot_id|><|start_header_id|>assistant<|end_header_id|>
22
23'''
24
25# Generate
26inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
27outputs = model.generate(
28 **inputs,
29 max_new_tokens=1024,
30 temperature=0.7,
31 top_p=0.9,
32 do_sample=True,
33)
34
35response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
36print(response)<think>
15 × 24 can be broken down step by step.
First, let me use the distributive property:
15 × 24 = 15 × (20 + 4)
= (15 × 20) + (15 × 4)
= 300 + 60
= 360
</think>
<answer>
360
</answer>1generation_config = {
2 "max_new_tokens": 1024, # Adjust based on task complexity
3 "temperature": 0.7, # Lower (0.3-0.5) for math, higher (0.7-0.9) for creative
4 "top_p": 0.9,
5 "repetition_penalty": 1.2, # Prevents repetition
6 "do_sample": True,
7}<think> and <answer> tags, but missing <step> tags<step> and <verify> tags1@model{shivik-phase1-2025,
2 title={Shivik 1.7B Phase 1: General Knowledge Foundation},
3 author={Your Name},
4 year={2025},
5 url={https://huggingface.co/abhishek-0122/Shivik-1.7B-Phase1-General}
6}