Text Generation
PEFT
Safetensors
French
text2sql
text-to-sql
lora
qlora
schema-linking
qwen2.5-coder
french
conversational
Instructions to use axrafTic/text2sqlProspeciton with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use axrafTic/text2sqlProspeciton with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "axrafTic/text2sqlProspeciton") - Notebooks
- Google Colab
- Kaggle
Delete README.md with huggingface_hub
Browse files
README.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
base_model: unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit
|
| 3 |
-
library_name: peft
|
| 4 |
-
pipeline_tag: text-generation
|
| 5 |
-
language:
|
| 6 |
-
- fr
|
| 7 |
-
tags:
|
| 8 |
-
- text2sql
|
| 9 |
-
- text-to-sql
|
| 10 |
-
- lora
|
| 11 |
-
- qlora
|
| 12 |
-
- schema-linking
|
| 13 |
-
- qwen2.5-coder
|
| 14 |
-
- french
|
| 15 |
-
---
|
| 16 |
-
|
| 17 |
-
# Text-to-SQL Prospect Model (Approach B: Schema-Linking)
|
| 18 |
-
|
| 19 |
-
Fine-tuned QLoRA adapter for **Qwen2.5-Coder-3B-Instruct** designed to generate SQL queries in French for the `companies` database schema.
|
| 20 |
-
|
| 21 |
-
## Model Details
|
| 22 |
-
- **Base Model**: `Qwen/Qwen2.5-Coder-3B-Instruct` / `unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit`
|
| 23 |
-
- **Method**: QLoRA Fine-Tuning (`r=32`, `alpha=64`, target modules: all linear layers)
|
| 24 |
-
- **Task**: Text-to-SQL (French natural language questions -> SQLite / Postgres SQL queries)
|
| 25 |
-
- **Approach**: Schema-Linking with column annotations (`SCHEMA_B`)
|
| 26 |
-
|
| 27 |
-
## Prompt Structure (ChatML)
|
| 28 |
-
|
| 29 |
-
```text
|
| 30 |
-
<|im_start|>system
|
| 31 |
-
Tu es un analyste de données expert en SQL. Transforme la question de l'utilisateur en une requête SQL valide et exécutable. Ne génère que le code SQL, sans explication.<|im_end|>
|
| 32 |
-
<|im_start|>user
|
| 33 |
-
Base de données:
|
| 34 |
-
[SCHEMA]
|
| 35 |
-
Table: companies (Profils d'entreprises françaises)
|
| 36 |
-
Colonnes:
|
| 37 |
-
- id (UUID identifiant unique)
|
| 38 |
-
- name (Nom commercial de l'entreprise)
|
| 39 |
-
- rating (Note Google Maps de 0 à 5)
|
| 40 |
-
- reviews (Nombre total d'avis Google)
|
| 41 |
-
- is_spending_on_ads (1 si l'entreprise paie pour des annonces, 0 sinon)
|
| 42 |
-
- description (Description textuelle de l'activité)
|
| 43 |
-
- website (URL du site web, NULL si absent)
|
| 44 |
-
- address (Adresse postale complète)
|
| 45 |
-
- ville (ex: 'Paris', 'Lyon', 'Marseille')
|
| 46 |
-
- secteur (ex: 'Informatique', 'Finance', 'Santé')
|
| 47 |
-
- region (ex: 'Ile-de-France', 'Auvergne-Rhone-Alpes')
|
| 48 |
-
- codeAPE (Code NAF d'activité économique)
|
| 49 |
-
- siren (Identifiant unique entreprise à 9 chiffres)
|
| 50 |
-
- siret (Identifiant unique établissement à 14 chiffres)
|
| 51 |
-
|
| 52 |
-
Question: Lister les entreprises à Paris avec une note supérieure à 4.
|
| 53 |
-
SQL:<|im_end|>
|
| 54 |
-
<|im_start|>assistant
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
## How to Load in Python
|
| 58 |
-
|
| 59 |
-
```python
|
| 60 |
-
import torch
|
| 61 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 62 |
-
from peft import PeftModel
|
| 63 |
-
|
| 64 |
-
base_model_id = "Qwen/Qwen2.5-Coder-3B-Instruct"
|
| 65 |
-
adapter_id = "axrafTic/text2sqlProspeciton"
|
| 66 |
-
|
| 67 |
-
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
|
| 68 |
-
base_model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.float16, device_map="auto")
|
| 69 |
-
model = PeftModel.from_pretrained(base_model, adapter_id)
|
| 70 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|