AdityaNarayan/HyperSwitch-Repo-CPT-Dataset
Viewer β’ Updated β’ 16.7k β’ 24 β’ 1
A specialized LoRA fine-tuned adapter based on Kwaipilot/KAT-Dev (32B) for the Hyperswitch Rust codebase. This model excels at understanding payment processing patterns, Hyperswitch architecture, and Rust development practices.
This LoRA adapter was trained on samples extracted from the Hyperswitch codebase to enhance code understanding, explanation, and generation within the payment processing domain. The adapter uses a FFN-focused approach (MLP blocks only) for efficient fine-tuning.
r: 64 # LoRA rank
alpha: 128 # LoRA alpha (2*r)
dropout: 0.05 # LoRA dropout
target_modules: # FFN blocks only
- gate_proj # FFN gating projection
- up_proj # FFN up projection
- down_proj # FFN down projection
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Kwaipilot/KAT-Dev",
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(
"Kwaipilot/KAT-Dev",
trust_remote_code=True
)
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"AdityaNarayan/Kwaipilot-KAT-Dev-CPT-LoRA-FFN-Block-Adapter-HyperSwitch"
)
# Generate code
prompt = """// File: hyperswitch/crates/router/src/core/payments.rs
// Task: Complete the payment validation function
pub fn validate_payment_method("""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.2, # Lower temperature for code generation
do_sample=True,
top_p=0.95,
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
generation_config = {
"max_new_tokens": 256,
"temperature": 0.2,
"top_p": 0.95,
"do_sample": True,
"repetition_penalty": 1.1
}
generation_config = {
"max_new_tokens": 512,
"temperature": 0.5,
"top_p": 0.9,
"do_sample": True
}
generation_config = {
"max_new_tokens": 384,
"temperature": 0.4,
"top_p": 0.9,
"do_sample": True
}
@misc{hyperswitch-kat-dev-ffn-lora-2025,
title={Kwaipilot-KAT-Dev-CPT-LoRA-FFN-Block-Adapter-HyperSwitch},
author={Aditya Narayan},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/AdityaNarayan/Kwaipilot-KAT-Dev-CPT-LoRA-FFN-Block-Adapter-HyperSwitch},
}
Note: This is a FFN-block-only LoRA adapter.
Base model
Kwaipilot/KAT-Dev