Views
No views yet
32640.1[q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]codellama/CodeLlama-7b-Instruct-hf32816paged_adamw_32bit with betas = (0.900, 0.999) and epsilon = 1e-080.00010.142| Step | Epoch | Training Loss | Validation Loss |
|---|---|---|---|
| 10 | 0.3113 | 5.4923 | 4.4958 |
| 20 | 0.6226 | 0.4476 | 0.3011 |
| 30 | 0.9339 | 0.2841 | 0.2455 |
| 40 | 1.2179 | 0.2703 | 0.2151 |
| 50 | 1.5292 | 0.2241 | 0.1897 |
| 60 | 1.8405 | 0.1913 | 0.1625 |
| 70 | 2.1245 | 0.2357 | 0.1485 |
| 80 | 2.4358 | 0.1515 | 0.1357 |
| 90 | 2.7471 | 0.1373 | 0.1294 |
5.49230.129494%| Metric | Base Model | Fine-tuned | Improvement |
|---|---|---|---|
| FastAPI Code Quality | 75.1/100 | 85.0/100 | +9.9 points |
| Code Completeness | 59.9/100 | 75.8/100 | +15.9 points |
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load model and tokenizer
5model_name = "Showmick119/codellama-7b-fastapi-finetuned-20250713"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype=torch.float16,
10 device_map="auto",
11 load_in_4bit=True
12)
13
14# Generate FastAPI code
15prompt = "[INST] Create a FastAPI POST endpoint for user registration with email validation [/INST]"
16inputs = tokenizer(prompt, return_tensors="pt")
17
18with torch.no_grad():
19 outputs = model.generate(
20 **inputs,
21 max_new_tokens=512,
22 temperature=0.1,
23 do_sample=True,
24 pad_token_id=tokenizer.pad_token_id
25 )
26
27response = tokenizer.decode(outputs[0], skip_special_tokens=True)
28print(response[len(prompt):].strip())1@misc{codellama-fastapi-2025,
2 title={CodeLlama-7B Fine-tuned for FastAPI Code Generation},
3 author={Showmick119},
4 year={2025},
5 url={https://huggingface.co/Showmick119/codellama-7b-fastapi-finetuned-20250713}
6}