File size: 2,708 Bytes
3c2c20e
 
 
 
 
 
 
847dbd8
1dcb715
 
3372f6b
3c2c20e
 
 
d68412d
 
3c2c20e
65fd071
fbe235f
65fd071
d68412d
1dcb715
 
 
 
 
 
 
 
 
 
 
 
 
b2d6c93
 
1dcb715
 
 
 
b2d6c93
 
 
 
 
 
efb5694
b2d6c93
 
 
 
 
 
 
 
1dcb715
 
 
 
 
d68412d
1dcb715
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
license: apache-2.0
language:
- en
pipeline_tag: text-classification
---

# Fine-tune and Train a custom dataset for sentiment_analysis on top of Vicuna
Vicuna_finetune_sentiment_analysis through PEFT and LoRA.

To Run the app: https://huggingface.co/spaces/RinInori/vicuna_finetuned_6_sentiments

Github fine-tune code link: https://github.com/hennypurwadi/Vicuna_finetune_sentiment_analysis

#Fine-tuned Vicuna model for sentiment analysis, trained using dataset from Kaggle: 
https://www.kaggle.com/datasets/praveengovi/emotions-dataset-for-nlp

#### BASE_MODEL = "TheBloke/vicuna-7B-1.1-HF"

#### LORA_WEIGHTS = "RinInori/vicuna_finetuned_6_sentiments" 

Vicuna is created by fine-tuning a LLaMA base model using approximately 70K user-shared conversations gathered from ShareGPT.com with public APIs.
To find more about Vicuna here: https://lmsys.org/blog/2023-03-30-vicuna/

To train a custom dataset on top of Vicuna if we don’t have good access to data-center grade GPU, is to fine-tune it through PEFT and LoRA.

PEFT = parameter-Efficient Fine_Tuning of Billion-Scale Models on Low-Resource hardware.

LoRA = Low-Rank Adaptation of Large Language Models is a training method that accelerates the training of large models while consuming less memory. 
It adds pairs of rank-decomposition weight matrices (called update matrices) to existing weights, and only trains those newly added weights.

---
### To RUN APP: https://huggingface.co/spaces/RinInori/vicuna_finetuned_6_sentiments

-----------------

![Image description](https://github.com/hennypurwadi/Vicuna_finetune_sentiment_analysis/blob/main/vicuna_result_correct.jpg?raw=true)

-----------------

![Image description](https://github.com/hennypurwadi/Vicuna_finetune_sentiment_analysis/blob/main/vicuna_predict_result.jpg?raw=true)

-----------------

### instruction="Classify the text as one of the emotions If it's not clear, choose the emotion that is closest to: joy,sadness,anger, fear, love, surprise."

#### Seems LLM doesn't like to follow the instruction, and has it's own decision:

![Image description](https://github.com/hennypurwadi/Vicuna_finetune_sentiment_analysis/blob/main/result.jpg?raw=true)

-----------------
### Model Hub: https://huggingface.co/RinInori/vicuna_finetuned_6_sentiments

-----------------

Ref: https://www.youtube.com/watch?v=Us5ZFp16PaU 

Ref: https://arxiv.org/abs/2106.09685

Ref: https://huggingface.co/docs/diffusers/training/lora#lowrank-adaptation-of-large-language-models-lora

Ref: Hutchinson, B., Ostendorf, M., & Fazel, M. (2011, September). Low Rank Language Models for Small Training Sets. IEEE Signal Processing Letters, 18(9), 489–492. https://doi.org/10.1109/lsp.2011.2160850