SwastikM commited on
Commit
2923e41
1 Parent(s): 041b028

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -29
README.md CHANGED
@@ -28,50 +28,38 @@ Generate Python code that accomplishes the task instructed.
28
 
29
  Parameter Efficient Finetuning(PEFT) a 4bit quantized Llama-2-7b-Chat from TheBloke/Llama-2-7b-Chat-GPTQ on flytech/python-codes-25k dataset.
30
 
31
-
32
- - **Model type:**
33
  - **Language(s) (NLP):** English
34
  - **License:** openrail
35
- - **Finetuned from model [facebook/bart-large-cnn](https://huggingface.co/facebook/bart-large-cnn?text=The+tower+is+324+metres+%281%2C063+ft%29+tall%2C+about+the+same+height+as+an+81-storey+building%2C+and+the+tallest+structure+in+Paris.+Its+base+is+square%2C+measuring+125+metres+%28410+ft%29+on+each+side.+During+its+construction%2C+the+Eiffel+Tower+surpassed+the+Washington+Monument+to+become+the+tallest+man-made+structure+in+the+world%2C+a+title+it+held+for+41+years+until+the+Chrysler+Building+in+New+York+City+was+finished+in+1930.+It+was+the+first+structure+to+reach+a+height+of+300+metres.+Due+to+the+addition+of+a+broadcasting+aerial+at+the+top+of+the+tower+in+1957%2C+it+is+now+taller+than+the+Chrysler+Building+by+5.2+metres+%2817+ft%29.+Excluding+transmitters%2C+the+Eiffel+Tower+is+the+second+tallest+free-standing+structure+in+France+after+the+Millau+Viaduct.)**
36
- - **Dataset:** [gretelai/synthetic_text_to_sql](https://huggingface.co/datasets/gretelai/synthetic_text_to_sql)
 
 
37
 
38
  ## Intended uses & limitations
39
 
40
- Addressing the power of LLM in fintuned downstream task. Implemented as a personal Project.
41
 
42
  ### How to use
43
 
44
- ```python
45
- query_question_with_context = """sql_prompt: Which economic diversification efforts in
46
- the 'diversification' table have a higher budget than the average budget for all economic diversification efforts in the 'budget' table?
47
- sql_context: CREATE TABLE diversification (id INT, effort VARCHAR(50), budget FLOAT); CREATE TABLE
48
- budget (diversification_id INT, diversification_effort VARCHAR(50), amount FLOAT);"""
49
- ```
50
 
51
- # Use a pipeline as a high-level helper
52
  ```python
53
- from transformers import pipeline
54
-
55
- sql_generator = pipeline("text2text-generation", model="SwastikM/bart-large-nl2sql")
56
-
57
- sql = sql_generator(query_question_with_context)[0]['generated_text']
58
-
59
- print(sql)
60
  ```
61
-
62
- # Load model directly
63
-
64
  ```python
65
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
 
66
 
67
- tokenizer = AutoTokenizer.from_pretrained("SwastikM/bart-large-nl2sql")
68
- model = AutoModelForSeq2SeqLM.from_pretrained("SwastikM/bart-large-nl2sql")
 
 
69
 
70
- inputs = tokenizer(query_question_with_context, return_tensors="pt").input_ids
71
- outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
 
72
 
73
- sql = tokenizer.decode(outputs[0], skip_special_tokens=True)
74
- print(sql)
75
  ```
76
 
77
 
 
28
 
29
  Parameter Efficient Finetuning(PEFT) a 4bit quantized Llama-2-7b-Chat from TheBloke/Llama-2-7b-Chat-GPTQ on flytech/python-codes-25k dataset.
30
 
 
 
31
  - **Language(s) (NLP):** English
32
  - **License:** openrail
33
+ - **Qunatization:** GPTQ 4bit
34
+ - **PEFT:** LoRA
35
+ - **Finetuned from model [TheBloke/Llama-2-7b-Chat-GPTQ](https://huggingface.co/TheBloke/Llama-2-7B-Chat-GPTQ)**
36
+ - **Dataset:** [flytech/python-codes-25k](https://huggingface.co/datasets/flytech/python-codes-25k)
37
 
38
  ## Intended uses & limitations
39
 
40
+ Addressing the efficay of Quantization and PEFT. Implemented as a personal Project.
41
 
42
  ### How to use
43
 
44
+ The quantized model is finetuned as PEFT. We have the trained Adapter. <br>The trained adpated needs to be merged with Base Model on which it was trained.
 
 
 
 
 
45
 
 
46
  ```python
47
+ instruction = """model_input = "Help me set up my daily to-do list!""""
 
 
 
 
 
 
48
  ```
 
 
 
49
  ```python
50
+ from peft import PeftModel, PeftConfig
51
+ from transformers import AutoModelForCausalLM
52
 
53
+ config = PeftConfig.from_pretrained("SwastikM/Llama-2-7B-Chat-text2code")
54
+ model = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-7b-Chat-GPTQ")
55
+ model = PeftModel.from_pretrained(model, "SwastikM/Llama-2-7B-Chat-text2code")
56
+ tokenizer = AutoTokenizer.from_pretrained("SwastikM/Llama-2-7B-Chat-text2code")
57
 
58
+ inputs = tokenizer(instruction, return_tensors="pt").input_ids.to('cuda')
59
+ outputs = model.generate(inputs, max_new_tokens=500, do_sample=False, num_beams=1)
60
+ code = tokenizer.decode(outputs[0], skip_special_tokens=True)
61
 
62
+ print(code)
 
63
  ```
64
 
65