This is
Version 2 of the
sirunchained/text-to-sql-model, fine-tuned from
google/gemma-3-270m-it for Text-to-SQL generation.
In this version, the model is
merged with the LoRA adapter – you can load it directly with
pipeline() (no PEFT required).
1from transformers import pipeline
2
3generator = pipeline(
4 "text-generation",
5 model="sirunchained/text-to-sql-model-v2",
6 device=0 # or "cuda"
7)
8
9# Example with schema
10prompt = """<start_of_turn>user
11# Schema
12customers(id, name, email, country)
13# Text
14Find customers from USA.<end_of_turn>
15<start_of_turn>model
16"""
17result = generator(prompt, max_new_tokens=128)
18print(result[0]["generated_text"])
1from transformers import pipeline
2
3pipe = pipeline("text-generation", model="sirunchained/text-to-sql-model-v2")
4
5messages = [
6 {"role": "user", "content": "# Schema\ncustomers(id, name, email)\n\n# Text\nFind customers with gmail emails."}
7]
8
9outputs = pipe(
10 pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True),
11 max_new_tokens=128
12)
13print(outputs[0]["generated_text"])
1# LoRA Configuration
2LoraConfig(
3 r=8,
4 lora_alpha=16,
5 lora_dropout=0.05,
6 bias="none",
7 task_type=TaskType.CAUSAL_LM,
8)
9
10# Training Configuration
11SFTConfig(
12 num_train_epochs=5,
13 per_device_train_batch_size=32,
14 learning_rate=5e-5,
15 lr_scheduler_type="constant",
16 weight_decay=0.0,
17 load_best_model_at_end=True,
18 metric_for_best_model="mean_token_accuracy",
19 greater_is_better=True,
20)
This model is released under the same license as Google's Gemma model. See the
Gemma model card for details.