Commit
·
101e210
1
Parent(s):
156d629
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,20 +1,49 @@
|
|
| 1 |
---
|
| 2 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
-
## Training procedure
|
| 5 |
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
- load_in_8bit: False
|
| 9 |
-
- load_in_4bit: True
|
| 10 |
-
- llm_int8_threshold: 6.0
|
| 11 |
-
- llm_int8_skip_modules: None
|
| 12 |
-
- llm_int8_enable_fp32_cpu_offload: False
|
| 13 |
-
- llm_int8_has_fp16_weight: False
|
| 14 |
-
- bnb_4bit_quant_type: nf4
|
| 15 |
-
- bnb_4bit_use_double_quant: False
|
| 16 |
-
- bnb_4bit_compute_dtype: float16
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
The following `bitsandbytes` quantization config was used during training:
|
| 19 |
- load_in_8bit: False
|
| 20 |
- load_in_4bit: True
|
|
@@ -26,7 +55,39 @@ The following `bitsandbytes` quantization config was used during training:
|
|
| 26 |
- bnb_4bit_use_double_quant: False
|
| 27 |
- bnb_4bit_compute_dtype: float16
|
| 28 |
### Framework versions
|
| 29 |
-
|
| 30 |
- PEFT 0.4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
library_name: peft
|
| 3 |
+
license: llama2
|
| 4 |
+
datasets:
|
| 5 |
+
- TuningAI/Startups_V2
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
pipeline_tag: conversational
|
| 9 |
+
tags:
|
| 10 |
+
- law
|
| 11 |
+
- startups
|
| 12 |
+
- finance
|
| 13 |
+
- tax
|
| 14 |
+
- Algerian
|
| 15 |
---
|
|
|
|
| 16 |
|
| 17 |
+
## Model Name: **Llama2_13B_startup_Assistant**
|
| 18 |
|
| 19 |
+
## Description:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
Llama2_13B_startup_Assistant is a highly specialized language model fine-tuned from Meta's Llama2_13B.
|
| 22 |
+
It has been tailored to assist with inquiries related to Algerian startups, offering valuable insights and guidance in these domains.
|
| 23 |
+
|
| 24 |
+
## Base Model:
|
| 25 |
+
This model is based on the Meta's **meta-llama/Llama-2-13b-chat-hf** architecture,
|
| 26 |
+
making it a highly capable foundation for generating human-like text responses.
|
| 27 |
+
|
| 28 |
+
## Dataset :
|
| 29 |
+
This model was fine-tuned on a custom dataset meticulously curated with more than 200 unique examples.
|
| 30 |
+
The dataset incorporates both manual entries and contributions from GPT3.5, GPT4, and Falcon 180B models.
|
| 31 |
+
|
| 32 |
+
## Fine-tuning Techniques:
|
| 33 |
+
Fine-tuning was performed using QLoRA (Quantized LoRA), an extension of LoRA that introduces quantization for enhanced parameter efficiency.
|
| 34 |
+
The model benefits from 4-bit NormalFloat (NF4) quantization and Double Quantization techniques, ensuring optimized performance.
|
| 35 |
+
|
| 36 |
+
## Performance:
|
| 37 |
+
**Llama2_13B_startup_Assistant** exhibits improved performance and efficiency in addressing queries related to Algerian tax law and startups,
|
| 38 |
+
making it a valuable resource for individuals and businesses navigating these areas.
|
| 39 |
+
|
| 40 |
+
## Limitations:
|
| 41 |
+
|
| 42 |
+
* While highly specialized, this model may not cover every nuanced aspect of Algerian tax law or the startup ecosystem.
|
| 43 |
+
* Accuracy may vary depending on the complexity and specificity of questions.
|
| 44 |
+
* It may not provide legal advice, and users should seek professional consultation for critical legal matters.
|
| 45 |
+
|
| 46 |
+
## Training procedure
|
| 47 |
The following `bitsandbytes` quantization config was used during training:
|
| 48 |
- load_in_8bit: False
|
| 49 |
- load_in_4bit: True
|
|
|
|
| 55 |
- bnb_4bit_use_double_quant: False
|
| 56 |
- bnb_4bit_compute_dtype: float16
|
| 57 |
### Framework versions
|
|
|
|
| 58 |
- PEFT 0.4.0
|
| 59 |
+
```
|
| 60 |
+
! huggingface-cli login
|
| 61 |
+
```
|
| 62 |
+
```python
|
| 63 |
+
from transformers import pipeline
|
| 64 |
+
from transformers import AutoTokenizer
|
| 65 |
+
from peft import PeftModel, PeftConfig
|
| 66 |
+
from transformers import AutoModelForCausalLM , BitsAndBytesConfig
|
| 67 |
+
import torch
|
| 68 |
|
| 69 |
+
#config = PeftConfig.from_pretrained("ayoubkirouane/Llama2_13B_startup_hf")
|
| 70 |
+
bnb_config = BitsAndBytesConfig(
|
| 71 |
+
load_in_4bit=True,
|
| 72 |
+
bnb_4bit_quant_type="nf4",
|
| 73 |
+
bnb_4bit_compute_dtype=getattr(torch, "float16"),
|
| 74 |
+
bnb_4bit_use_double_quant=False)
|
| 75 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 76 |
+
"meta-llama/Llama-2-7b-hf",
|
| 77 |
+
quantization_config=bnb_config,
|
| 78 |
+
device_map={"": 0})
|
| 79 |
+
model.config.use_cache = False
|
| 80 |
+
model.config.pretraining_tp = 1
|
| 81 |
+
model = PeftModel.from_pretrained(model, "TuningAI/Llama2_7B_Cover_letter_generator")
|
| 82 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf" , trust_remote_code=True)
|
| 83 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 84 |
+
tokenizer.padding_side = "right"
|
| 85 |
+
Instruction = "Given a user's information about the target job, you will generate a Cover letter for this job based on this information."
|
| 86 |
+
while 1:
|
| 87 |
+
input_text = input(">>>")
|
| 88 |
+
logging.set_verbosity(logging.CRITICAL)
|
| 89 |
+
prompt = f"### Instruction\n{Instruction}.\n ###Input \n\n{input_text}. ### Output:"
|
| 90 |
+
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer,max_length=400)
|
| 91 |
+
result = pipe(prompt)
|
| 92 |
+
print(result[0]['generated_text'].replace(prompt, ''))
|
| 93 |
+
```
|