metadata
library_name: transformers
license: apache-2.0
base_model:
- Qwen/Qwen2.5-Coder-3B-Instruct
Model Card for Model ID
Generates and Edits minimal multi-file python code. Right now consistently generates upto 2-3 files with a runner.sh bash script that orchestrates the file. Maintains the PEP-8 style.
Model Details
Model Description
- Developed by: Reshinth Adithyan
- License: Apache 2.0
Model Sources [optional]
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import fire
def main(model_path:str="./models_dir/repo_coder_v1"):
input_prompt = "###Instruction: {prompt}".format(prompt="Generate a small python repo for matplotlib to visualize timeseries data to read from timeseries.csv file using pandas.")
def load_model(model_path):
"""
Load the model and tokenizer from the specified path.
"""
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype="auto")
return model, tokenizer
model, tokenizer = load_model(model_path)
print(f"Loaded model from {model_path}.")
input = tokenizer(input_prompt, return_tensors="pt").to(model.device)
print(input)
with torch.no_grad():
output = model.generate(**input, max_length=1024, do_sample=True, temperature=0.9, top_p=0.95, top_k=50)
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(f"Generated text: {output_text}")
if __name__ == "__main__":
fire.Fire(main)