gabe-zhang commited on
Commit
8416351
·
verified ·
1 Parent(s): cc5927f

Add sample code for loading the adapter

Browse files
Files changed (1) hide show
  1. README.md +14 -3
README.md CHANGED
@@ -23,14 +23,25 @@ pipeline_tag: summarization
23
  This is a **LoRA fine-tuned adapter** built on [**meta-llama/Llama-3.2-1B-Instruct**](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct). It is designed for scientific paper summarization tasks and leverages **Low-Rank Adaptation (LoRA)** to enhance model performance efficiently while maintaining a low computational overhead.
24
 
25
 
26
- ## **Performance Comparison**
27
  | Model | ROUGE-1 | ROUGE-2 | ROUGE-3 | ROUGE-L |
28
  |---------------------------|----------|----------|----------|----------|
29
  | **Llama-3.2-1B-Instruct** | 36.69 | 7.47 | 1.95 | 19.36 |
30
  | **Llama-PaperSummarization-LoRA** | **41.56** | **11.31** | **2.67** | **21.86** |
31
 
32
- The model was evaluated on a **6K-sample test set** using **ROUGE scores** with the following settings:
33
- - **Decoding Strategy**: Beam search (beam size = 4)
 
 
 
 
 
 
 
 
 
 
 
34
 
35
 
36
  ## **Dataset**
 
23
  This is a **LoRA fine-tuned adapter** built on [**meta-llama/Llama-3.2-1B-Instruct**](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct). It is designed for scientific paper summarization tasks and leverages **Low-Rank Adaptation (LoRA)** to enhance model performance efficiently while maintaining a low computational overhead.
24
 
25
 
26
+ ### **Performance comparison**
27
  | Model | ROUGE-1 | ROUGE-2 | ROUGE-3 | ROUGE-L |
28
  |---------------------------|----------|----------|----------|----------|
29
  | **Llama-3.2-1B-Instruct** | 36.69 | 7.47 | 1.95 | 19.36 |
30
  | **Llama-PaperSummarization-LoRA** | **41.56** | **11.31** | **2.67** | **21.86** |
31
 
32
+ The model was evaluated on a **6K-sample test set** using **ROUGE scores** with beam search (beam size = 4).
33
+
34
+
35
+ ### **How to load**
36
+ ```python
37
+ from transformers import LlamaForCausalLM, AutoTokenizer
38
+ from peft import PeftModel
39
+
40
+ base_model = LlamaForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
41
+ peft_model_id = "gabe-zhang/Llama-PaperSummarization-LoRA"
42
+ model = PeftModel.from_pretrained(base_model, peft_model_id)
43
+ model.merge_and_unload()
44
+ ```
45
 
46
 
47
  ## **Dataset**