Views
No views yet
<think> blocks before providing the final answer(), [], {}, <>, ⟨⟩, ⟦⟧, ⦃⦄, ⦅⦆<think> reasoning blockspip install unsloth transformers1from unsloth import FastLanguageModel
2
3# Load LoRA adapters
4model, tokenizer = FastLanguageModel.from_pretrained(
5 model_name="akashdutta1030/dddd",
6 max_seq_length=2048,
7 dtype=None,
8 load_in_4bit=False, # Use True for 4-bit quantization
9)
10
11FastLanguageModel.for_inference(model)1messages = [
2 {
3 "role": "system",
4 "content": "You are a logic engine. Complete the Dyck bracket sequence by tracking the stack of open brackets."
5 },
6 {
7 "role": "user",
8 "content": "([{<"
9 }
10]
11
12prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
13inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
14
15with torch.no_grad():
16 outputs = model.generate(
17 **inputs,
18 max_new_tokens=512,
19 temperature=0.1,
20 top_p=0.95,
21 do_sample=True,
22 )
23
24response = tokenizer.decode(outputs[0], skip_special_tokens=False)
25print(response)<think>
1. Input sequence: (, [, {, <
2. Maintain a stack of opening brackets:
- Push '(' -> Stack: ['(']
- Push '[' -> Stack: ['(', '[']
- Push '{' -> Stack: ['(', '[', '{']
- Push '<' -> Stack: ['(', '[', '{', '<']
3. To close the sequence, pop from the stack in reverse order:
- Pop '<' -> Closing: '>'
- Pop '{' -> Closing: '}'
- Pop '[' -> Closing: ']'
- Pop '(' -> Closing: ')'
4. Appending closing brackets to input: ([{<>}])
</think>
([{<>}])1@misc{deepseek-r1-dyck-finetuned,
2 title={DeepSeek-R1-Dyck-Finetuned: Bracket Completion Model},
3 author={Fine-tuned on DeepSeek-R1-Distill-Llama-8B},
4 year={2024},
5 howpublished={\url{https://huggingface.co/akashdutta1030/dddd}}
6}