Downloads · 30 days
0
yashassnadig/leetcode2output
leetcode2output is a text generation model from yashassnadig. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This model is a fine-tuned version of unsloth/Llama-3.2-1B-unsloth-bnb-4bit. It was trained as a fun "troll project" on a dataset of LeetCode problems, their specific inputs, and their corresponding outputs.
Downloads · 30 days
0
Access
Public
Updated Jul 2, 2025
Repo size
20.6 MB
Likes
0
Public
Click a slice to open those files.
.json17.3 MB · 83%
From the Hugging Face model README
This model is a fine-tuned version of unsloth/Llama-3.2-1B-unsloth-bnb-4bit. It was trained as a fun "troll project" on a dataset of LeetCode problems, their specific inputs, and their corresponding outputs.
Given a problem description and a specific input from its training data, it directly predicts the final output, bypassing the entire coding and execution step.
For example, if you prompt it with the "Two Sum" problem and the input nums = [3,3], target = 6, it will respond with [0, 1], not the Python code to solve it.
Developed by: yashassnadig
Model type: Causal Language Model
Language(s): English
License: apache-2.0
Finetuned from model: unsloth/Llama-3.2-1B-unsloth-bnb-4bit
I used only two target models ("q_proj", "v_proj") which focuses only on the attention blocks and kept rank value (r=8). Why? I have neither money nor time to run the model.
If you like to waste your time on this, the notebook is available here: https://www.kaggle.com/code/yashasnadig/leetcode2output
The model is intended for direct use via the transformers library. You must format your prompt in the same structure it was trained on.
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name = "yashassnadig/leetcode2output"
# Load the fine-tuned PEFT adapter
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Define the prompt template
prompt_template = """Below is a programming problem description and an example input. Your task is to write the corresponding code output that correctly solves the problem for the given input.
### Instruction:
{problem_description}
### Input:
{input_data}
### Response:
"""
# Example from the training data
problem = "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.\nYou may assume that each input would have exactly one solution, and you may not use the same element twice.\nYou can return the answer in any order."
input_data = "nums = [3,3], target = 6"
# Format the full prompt
full_prompt = prompt_template.format(problem_description=problem, input_data=input_data)
# Use a pipeline for easy generation
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
result = pipe(full_prompt, max_new_tokens=20, do_sample=False)
print(result[0]['generated_text'])
This model should not be used for:
It is a specialized model designed only to replicate the input-output pairs from its training set.
The model was fine-tuned on a dataset by newfacade from here: https://huggingface.co/datasets/newfacade/LeetCodeDataset
I just used 5k samples from it and trained only for 1 epoch.