Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: multilabel-classification
|
| 3 |
+
---
|
| 4 |
+
Multi Label Classification
|
| 5 |
+
|
| 6 |
+
Description: Labeling the product comments of the e-commerce data we have created according to the labels we have specified.
|
| 7 |
+
It returns us a positive or negative value based on the comments made on the product or shipping.
|
| 8 |
+
If no comment is made, None data regarding the product or shipping will be returned. In this project I used the model "meta-llama/Meta-Llama-3-8B-Instruct"
|
| 9 |
+
|
| 10 |
+
Used to quantization method like this ;
|
| 11 |
+
|
| 12 |
+
>>
|
| 13 |
+
import torch
|
| 14 |
+
#quantizasyon yöntemi 4 bit hassasiyetiyle yapacak.
|
| 15 |
+
quant_config = BitsAndBytesConfig(
|
| 16 |
+
load_in_4bit=True, #olabildiğince küçültmeye çalışıyoruz maliyet açısından, ama doğruluğu da düşüyor
|
| 17 |
+
bnb_4bit_quant_type="nf4", #"fp4" , nf4 daha az yer kaplar daha hızlıdır ama doğruluğu kıyasla daha az
|
| 18 |
+
bnb_4bit_compute_dtype=torch.float16, #maliyeti de düşürmüş olduk, hızı da artırdık
|
| 19 |
+
bnb_4bit_use_double_quant=True, # True model increases accuracy but causes it to work more costly.
|
| 20 |
+
) #np4 saves more memory
|
| 21 |
+
>>
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
Here.. This code contains important steps to optimize LLM's memory usage and processing time.
|
| 25 |
+
It is important to improve the performance and resource utilization of the model.
|
| 26 |
+
>>
|
| 27 |
+
#20GB model
|
| 28 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 29 |
+
pretrained_model_name_or_path=base_model, #used "meta-llama/Meta-Llama-3-8B-Instruct"
|
| 30 |
+
quantization_config=quant_config,
|
| 31 |
+
device_map={"": 0},
|
| 32 |
+
#use_auth_token=True
|
| 33 |
+
|
| 34 |
+
)
|
| 35 |
+
model.config.use_cache = False
|
| 36 |
+
model.config.pretraining_tp = 1
|
| 37 |
+
>>
|