Lei-bw commited on
Commit
a66de90
·
verified ·
1 Parent(s): c49159b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -3
README.md CHANGED
@@ -30,11 +30,27 @@ This model is quantized in 8-bit and trained with question and answer pairs for
30
 
31
  ```python
32
  from peft import PeftModel, PeftConfig
33
- from transformers import AutoModelForCausalLM
34
 
35
- config = PeftConfig.from_pretrained("Be-12/text-to-sql-fm")
 
 
 
36
  base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2b")
37
- model = PeftModel.from_pretrained(base_model, "Be-12/text-to-sql-fm")
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
  ## Training Details
 
30
 
31
  ```python
32
  from peft import PeftModel, PeftConfig
33
+ from transformers import AutoModelForCausalLM, AutoTokenizer
34
 
35
+ # Load the PEFT configuration
36
+ config = PeftConfig.from_pretrained("Lei-bw/text-to-sql-fm")
37
+
38
+ # Load the base model
39
  base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2b")
40
+
41
+ # Load the fine-tuned model using PEFT
42
+ model = PeftModel.from_pretrained(base_model, "Lei-bw/text-to-sql-fm")
43
+
44
+ # Load the tokenizer
45
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
46
+
47
+ # Example usage
48
+ text = "What is the average salary of employees in the sales department?"
49
+ inputs = tokenizer(text, return_tensors="pt")
50
+ outputs = model.generate(**inputs)
51
+ generated_text = tokenizer.decode(outputs[0])
52
+
53
+ print(generated_text)
54
  ```
55
 
56
  ## Training Details