Create README.md
Browse filesCreated a README file.
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- llama
|
| 5 |
+
- text-generation
|
| 6 |
+
- instruction-following
|
| 7 |
+
- llama-2
|
| 8 |
+
- lora
|
| 9 |
+
- peft
|
| 10 |
+
- trl
|
| 11 |
+
- sft
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Llama-2-7b-chat-finetune
|
| 15 |
+
|
| 16 |
+
This model is a fine-tuned version of [NousResearch/Llama-2-7b-chat-hf](https://huggingface.co/NousResearch/Llama-2-7b-chat-hf) using the [mlabonne/guanaco-llama2-1k](https://huggingface.co/datasets/mlabonne/guanaco-llama2-1k) dataset. It has been fine-tuned using LoRA (Low-Rank Adaptation) with the PEFT library and the SFTTrainer from TRL.
|
| 17 |
+
|
| 18 |
+
## Model Description
|
| 19 |
+
|
| 20 |
+
This model is intended for text generation and instruction following tasks. It has been fine-tuned on a dataset of 1,000 instruction-following examples.
|
| 21 |
+
|
| 22 |
+
## Intended Uses & Limitations
|
| 23 |
+
|
| 24 |
+
This model can be used for a variety of text generation tasks, including:
|
| 25 |
+
|
| 26 |
+
* Generating creative text formats, like poems, code, scripts, musical pieces, email, letters, etc.
|
| 27 |
+
* Answering your questions in an informative way, even if they are open ended, challenging, or strange.
|
| 28 |
+
* Following your instructions and completing your requests thoughtfully.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
Limitations:
|
| 32 |
+
|
| 33 |
+
* The model may generate biased or harmful content.
|
| 34 |
+
* The model may not be able to follow all instructions perfectly.
|
| 35 |
+
* The model may not be able to generate text that is factually accurate.
|
| 36 |
+
|
| 37 |
+
## Training and Fine-tuning
|
| 38 |
+
|
| 39 |
+
This model was fine-tuned using the following parameters:
|
| 40 |
+
|
| 41 |
+
* LoRA attention dimension (lora_r): 64
|
| 42 |
+
* Alpha parameter for LoRA scaling (lora_alpha): 16
|
| 43 |
+
* Dropout probability for LoRA layers (lora_dropout): 0.1
|
| 44 |
+
* 4-bit precision base model loading (use_4bit): True
|
| 45 |
+
* Number of training epochs (num_train_epochs): 1
|
| 46 |
+
* Batch size per GPU for training (per_device_train_batch_size): 4
|
| 47 |
+
* Learning rate (learning_rate): 2e-4
|
| 48 |
+
|
| 49 |
+
## How to Use
|
| 50 |
+
|
| 51 |
+
You can use this model with the following code:
|
| 52 |
+
```
|
| 53 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 54 |
+
|
| 55 |
+
model_name = "chaitanya42/Llama-2-7b-chat-finetune"
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 57 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 58 |
+
|
| 59 |
+
prompt = "What is a large language model?"
|
| 60 |
+
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=200)
|
| 61 |
+
result = pipe(f"[INST] {prompt} [/INST]")
|
| 62 |
+
print(result[0]['generated_text'])
|
| 63 |
+
```
|