LadiesMan69 commited on
Commit
2fe18f7
Β·
verified Β·
1 Parent(s): f6b1bcd

Model card upd

Browse files
Files changed (1) hide show
  1. README.md +123 -6
README.md CHANGED
@@ -1,21 +1,138 @@
1
  ---
 
2
  base_model: unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
3
  tags:
4
  - text-generation-inference
5
  - transformers
6
  - unsloth
7
  - qwen2
8
- license: apache-2.0
 
 
9
  language:
10
  - en
 
 
11
  ---
12
 
13
- # Uploaded finetuned model
 
 
14
 
15
- - **Developed by:** LadiesMan69
 
 
16
  - **License:** apache-2.0
17
- - **Finetuned from model :** unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
20
 
21
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
1
  ---
2
+ license: apache-2.0
3
  base_model: unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
4
  tags:
5
  - text-generation-inference
6
  - transformers
7
  - unsloth
8
  - qwen2
9
+ - lora
10
+ - fastapi
11
+ - code-assistant
12
  language:
13
  - en
14
+ library_name: transformers
15
+ pipeline_tag: text-generation
16
  ---
17
 
18
+ # Qwen2.5-Coder-7B-FastAPI-LoRA
19
+
20
+ A LoRA fine-tune of **Qwen2.5-Coder-7B-Instruct** specialized as a **FastAPI documentation assistant**. The model is trained to answer questions, generate code, and explain concepts related to the FastAPI framework, covering everything from basic routing to advanced topics like security and testing.
21
 
22
+ ## Model Details
23
+
24
+ - **Developed by:** [LadiesMan69](https://huggingface.co/LadiesMan69)
25
  - **License:** apache-2.0
26
+ - **Base model:** [unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit)
27
+ - **Model type:** Causal decoder-only language model (Qwen2 architecture)
28
+ - **Fine-tuning method:** LoRA (Low-Rank Adaptation)
29
+ - **Language:** English
30
+ - **Trained with:** [Unsloth](https://github.com/unslothai/unsloth) + Hugging Face TRL β€” 2x faster training
31
+
32
+ ## Motivation
33
+
34
+ General-purpose code models are often imprecise or outdated when it comes to framework-specific APIs. This model was fine-tuned on a curated dataset of FastAPI-focused instruction/response pairs to produce a lightweight, deployable assistant that gives accurate, idiomatic answers for building and debugging FastAPI applications.
35
+
36
+ ## Training Data
37
+
38
+ The fine-tuning dataset was built specifically for this task using the **ChatML** format and organized into topic categories, including:
39
+
40
+ - **Tutorial** β€” core concepts: path/query parameters, request bodies, response models, dependency injection
41
+ - **Advanced** β€” background tasks, middleware, WebSockets, custom exception handlers, lifespan events
42
+ - **Security** β€” OAuth2/JWT authentication, password hashing, CORS, rate limiting
43
+ - **Testing** β€” `TestClient` usage, pytest fixtures, mocking dependencies, async test patterns
44
+
45
+ Examples were generated in batches per category to ensure balanced topic coverage and consistent formatting across the dataset.
46
+
47
+ ## Intended Use
48
+
49
+ - Answering questions about FastAPI concepts, patterns, and best practices
50
+ - Generating FastAPI route handlers, Pydantic models, and dependency-injected services
51
+ - Explaining and debugging FastAPI-related code snippets
52
+ - Acting as an in-editor or chat-based documentation assistant for developers working with FastAPI
53
+
54
+ ## How to Use
55
+
56
+ ### With `transformers`
57
+
58
+ ```python
59
+ from transformers import AutoTokenizer, AutoModelForCausalLM
60
+
61
+ model_id = "LadiesMan69/Qwen2.5-Coder-7B-FastAPI-LoRA"
62
+
63
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
64
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
65
+
66
+ messages = [
67
+ {"role": "system", "content": "You are a helpful FastAPI documentation assistant."},
68
+ {"role": "user", "content": "How do I add JWT-based authentication to a FastAPI route?"},
69
+ ]
70
+
71
+ inputs = tokenizer.apply_chat_template(
72
+ messages,
73
+ add_generation_prompt=True,
74
+ tokenize=True,
75
+ return_dict=True,
76
+ return_tensors="pt",
77
+ ).to(model.device)
78
+
79
+ outputs = model.generate(**inputs, max_new_tokens=512)
80
+ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
81
+ ```
82
+
83
+ ### With `unsloth`
84
+
85
+ ```python
86
+ from unsloth import FastModel
87
+
88
+ model, tokenizer = FastModel.from_pretrained(
89
+ model_name="LadiesMan69/Qwen2.5-Coder-7B-FastAPI-LoRA",
90
+ max_seq_length=2048,
91
+ )
92
+ ```
93
+
94
+ ### With `vLLM`
95
+
96
+ ```bash
97
+ pip install vllm
98
+ vllm serve "LadiesMan69/Qwen2.5-Coder-7B-FastAPI-LoRA"
99
+ ```
100
+
101
+ ```bash
102
+ curl -X POST "http://localhost:8000/v1/chat/completions" \
103
+ -H "Content-Type: application/json" \
104
+ --data '{
105
+ "model": "LadiesMan69/Qwen2.5-Coder-7B-FastAPI-LoRA",
106
+ "messages": [
107
+ {"role": "user", "content": "Show me a minimal FastAPI app with a health check endpoint."}
108
+ ]
109
+ }'
110
+ ```
111
+
112
+ ## Prompt Format
113
+
114
+ This model uses the ChatML-style chat template built into the tokenizer (`apply_chat_template`). For best results, include a system message establishing the assistant's role as a FastAPI expert, followed by the user's question.
115
+
116
+ ## Limitations
117
+
118
+ - Focused specifically on FastAPI; general coding ability outside this domain is inherited from the base model and not specifically enhanced.
119
+ - As with any LLM, generated code should be reviewed and tested before use in production.
120
+ - May not reflect the very latest FastAPI releases if they postdate the training data.
121
+
122
+ ## Training Procedure
123
+
124
+ Fine-tuned using LoRA adapters on top of the 4-bit quantized `unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit` base model, leveraging Unsloth's optimized training kernels for faster, memory-efficient fine-tuning.
125
+
126
+ ## Model Tree
127
+
128
+ - Base: [Qwen/Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B)
129
+ - β†’ [Qwen/Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B)
130
+ - β†’ [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct)
131
+ - β†’ [unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit) (quantized)
132
+ - β†’ **LadiesMan69/Qwen2.5-Coder-7B-FastAPI-LoRA** (this model, LoRA fine-tune)
133
+
134
+ ## Acknowledgements
135
 
136
+ This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library.
137
 
138
+ [![Made with Unsloth](https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png)](https://github.com/unslothai/unsloth)