Downloads · 30 days
5
16% of all-time downloads
christiansuarez/Dyck
Dyck is a machine learning model from christiansuarez. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Fine-tuned DeepSeek-R1-Distill-Qwen-1.5B for completing Dyck sequences (balanced bracket problems) with step-by-step reasoning.
Downloads · 30 days
5
16% of all-time downloads
All-time downloads
31
Public
Parameters
1.8B
53.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.pt35.5 GB · 62%
From the Hugging Face model README
Fine-tuned DeepSeek-R1-Distill-Qwen-1.5B for completing Dyck sequences (balanced bracket problems) with step-by-step reasoning.
This model completes Dyck sequences by adding minimal closing brackets to match all opening brackets. Given a prefix like ([<{, it generates:
Example:
Input: ([<{
Output:
# 1: ( open -> push ) | [')']
# 2: [ open -> push ] | [')',']']
# 3: < open -> push > | [')',']','>']
# 4: { open -> push } | [')',']','>','}']
# 5: done | stack LIFO [')',']','>','}']
# +1: add '}'
# +2: add '>'
# +3: add ']'
# +4: add ')'
# add: }>)]
# full: ([<{}>)]
FINAL ANSWER: ([<{}>)]
(), [], {}, <>->, |) + final answerThe model learns to:
->, |) for clarityfrom transformers import AutoModelForCausalLM, AutoTokenizer
import torch
MODEL_ID = "results" # or your HF repo path
SEQUENCE = "([<{"
# Load model
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
model.eval()
# Format prompt (same as training)
prompt = f"""Complete the Dyck sequence with minimal closing brackets.
Sequence: {SEQUENCE}
Rules: add only closings that match open brackets; no extra pairs.
Format: use -> for steps (e.g. open -> push close | stack=[...]); # +k: add 'X'; end FINAL ANSWER: <full_sequence>. No prose."""
messages = [{"role": "user", "content": prompt}]
chat_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(chat_text, return_tensors="pt").to(model.device)
# Generate (greedy decoding for deterministic output)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=600,
do_sample=False,
pad_token_id=tokenizer.pad_token_id,
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
(), [], {}, <>Created for Dyck sequence completion task with full fine-tuning approach.
Inherits license from base model DeepSeek-R1-Distill-Qwen-1.5B.