PEFT
English
code
sql
bugdaryan commited on
Commit
4b59e31
1 Parent(s): e6488d1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -15
README.md CHANGED
@@ -1,22 +1,94 @@
1
  ---
 
 
 
 
 
 
 
 
2
  library_name: peft
3
  ---
4
- ## Training procedure
5
 
 
6
 
7
- The following `bitsandbytes` quantization config was used during training:
8
- - quant_method: bitsandbytes
9
- - load_in_8bit: False
10
- - load_in_4bit: True
11
- - llm_int8_threshold: 6.0
12
- - llm_int8_skip_modules: None
13
- - llm_int8_enable_fp32_cpu_offload: False
14
- - llm_int8_has_fp16_weight: False
15
- - bnb_4bit_quant_type: nf4
16
- - bnb_4bit_use_double_quant: False
17
- - bnb_4bit_compute_dtype: float16
18
- ### Framework versions
19
 
20
- - PEFT 0.4.0
 
 
 
 
21
 
22
- - PEFT 0.4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: openrail
3
+ datasets:
4
+ - bugdaryan/spider-natsql-wikisql-instruct
5
+ language:
6
+ - en
7
+ tags:
8
+ - code
9
+ - sql
10
  library_name: peft
11
  ---
 
12
 
13
+ # LoRA adapters for model WizardCoderSQL
14
 
15
+ ## Overview
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ - **Model Name**: WizardCoderSQL-15B-V1.0-QLoRA
18
+ - **Repository**: [Hugging Face Repository](https://huggingface.co/WizardLM/WizardCoder-15B-V1.0)
19
+ - **License**: [OpenRAIL-M](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement)
20
+ - **Fine-Tuned Model Name**: WizardCoderSQL-15B-V1.0
21
+ - **Fine-Tuned Dataset**: [bugdaryan/spider-natsql-wikisql-instruct](https://huggingface.co/datasets/bugdaryan/spider-natsql-wikisql-instruct)
22
 
23
+ ## Description
24
+
25
+ This repository contains a LoRA fine-tuned version of the Wizard Coder 15B model. The LoRA attention mechanism has been customized with specific parameters to enhance model performance in certain tasks. Additionally, the fine-tuned model has been merged with custom parameters to create a specialized model for specific use cases.
26
+
27
+ ## Model Details
28
+
29
+ - **Base Model**: Wizard Coder 15B
30
+ - **Fine-Tuned Model Name**: WizardCoderSQL-15B-V1.0-QLoRA
31
+ - **Fine-Tuning Parameters**:
32
+ - QLoRA Parameters:
33
+ - LoRA Attention Dimension (lora_r): 64
34
+ - LoRA Alpha Parameter (lora_alpha): 16
35
+ - LoRA Dropout Probability (lora_dropout): 0.1
36
+ - bitsandbytes Parameters:
37
+ - Use 4-bit Precision Base Model (use_4bit): True
38
+ - Compute Dtype for 4-bit Base Models (bnb_4bit_compute_dtype): float16
39
+ - Quantization Type (bnb_4bit_quant_type): nf4
40
+ - Activate Nested Quantization (use_nested_quant): False
41
+ - TrainingArguments Parameters:
42
+ - Number of Training Epochs (num_train_epochs): 1
43
+ - Enable FP16/BF16 Training (fp16/bf16): False/True
44
+ - Batch Size per GPU for Training (per_device_train_batch_size): 48
45
+ - Batch Size per GPU for Evaluation (per_device_eval_batch_size): 4
46
+ - Gradient Accumulation Steps (gradient_accumulation_steps): 1
47
+ - Enable Gradient Checkpointing (gradient_checkpointing): True
48
+ - Maximum Gradient Norm (max_grad_norm): 0.3
49
+ - Initial Learning Rate (learning_rate): 2e-4
50
+ - Weight Decay (weight_decay): 0.001
51
+ - Optimizer (optim): paged_adamw_32bit
52
+ - Learning Rate Scheduler Type (lr_scheduler_type): cosine
53
+ - Maximum Training Steps (max_steps): -1
54
+ - Warmup Ratio (warmup_ratio): 0.03
55
+ - Group Sequences into Batches with Same Length (group_by_length): True
56
+ - Save Checkpoint Every X Update Steps (save_steps): 0
57
+ - Log Every X Update Steps (logging_steps): 25
58
+ - SFT Parameters:
59
+ - Maximum Sequence Length (max_seq_length): 500
60
+
61
+ ## Usage
62
+
63
+ To use this fine-tuned LoRA model and merged parameters, you can load it using the Hugging Face Transformers library in Python. Here's an example of how to use it:
64
+
65
+ ```python
66
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
67
+ from peft import PeftModel
68
+
69
+ model_name = 'WizardLM/WizardCoder-15B-V1.0'
70
+ adapter_name = 'bugdaryan/WizardCoderSQL-15B-V1.0-QLoRA'
71
+
72
+ base_model = AutoModelForCausalLM.from_pretrained(model_name, device_map='auto')
73
+ model = PeftModel.from_pretrained(base_model, adapter_name)
74
+ model = model.merge_and_unload()
75
+
76
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
77
+
78
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer)
79
+
80
+ tables = "CREATE TABLE sales ( sale_id number PRIMARY KEY, product_id number, customer_id number, salesperson_id number, sale_date DATE, quantity number, FOREIGN KEY (product_id) REFERENCES products(product_id), FOREIGN KEY (customer_id) REFERENCES customers(customer_id), FOREIGN KEY (salesperson_id) REFERENCES salespeople(salesperson_id)); CREATE TABLE product_suppliers ( supplier_id number PRIMARY KEY, product_id number, supply_price number, FOREIGN KEY (product_id) REFERENCES products(product_id)); CREATE TABLE customers ( customer_id number PRIMARY KEY, name text, address text ); CREATE TABLE salespeople ( salesperson_id number PRIMARY KEY, name text, region text ); CREATE TABLE product_suppliers ( supplier_id number PRIMARY KEY, product_id number, supply_price number );"
81
+
82
+ question = 'Find the salesperson who made the most sales.'
83
+
84
+ prompt = f"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. ### Instruction: Convert text to SQLite query: {question} {tables} ### Response:"
85
+
86
+ ans = pipe(prompt, max_new_tokens=200)
87
+ print(ans[0]['generated_text'])
88
+
89
+ ```
90
+
91
+
92
+ ## Disclaimer
93
+
94
+ WizardCoderSQL model follows the same license as WizardCoder. The content produced by any version of WizardCoderSQL is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.