TokenBender/code_instructions_122k_alpaca_style
Viewer β’ Updated β’ 122k β’ 1.6k β’ 80
This model is a fine-tuned version of the rohitnagareddy/AdbhutMOE Mixture-of-Experts (MoE) model, specialized for Python code generation and programming assistance tasks. It combines the efficiency of sparse MoE architecture with domain-specific fine-tuning for coding applications.
rohitnagareddy/AdbhutMOE (Custom MoE Architecture)TokenBender/code_instructions_122k_alpaca_style - A comprehensive dataset of coding instructions and solutionsThis model is based on a custom Mixture-of-Experts architecture:
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
import torch
model_id = "rohitnagareddy/AdbhutMOE-Coding-Finetuned"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# Create a text generation pipeline
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer
)
# Generate code
prompt = '''### Instruction:
Write a Python function that takes a list of integers and returns the sum of all even numbers in the list.
### Response:'''
response = pipe(prompt, max_new_tokens=150, temperature=0.2, do_sample=True)
print(response[0]["generated_text"])
# For more control over generation
prompt = '''### Instruction:
Create a Python class for a simple calculator with basic arithmetic operations.
### Response:'''
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.3,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.pad_token_id
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
This model serves as a foundation for further experimentation with MoE architectures in code generation. Contributions and improvements are welcome!
Fine-tuned by rohitnagareddy using LoRA on the AdbhutMOE architecture. This model demonstrates the application of parameter-efficient fine-tuning to Mixture-of-Experts models.
Base model
rohitnagareddy/AdbhutMOE