Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
base_model: unsloth/tinyllama-bnb-4bit
|
| 4 |
+
license: mit
|
| 5 |
+
datasets:
|
| 6 |
+
- yahma/alpaca-cleaned
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
tags:
|
| 11 |
+
- Instruct
|
| 12 |
+
- TinyLlama
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Steps to try the model:
|
| 16 |
+
|
| 17 |
+
### prompt Template
|
| 18 |
+
```python
|
| 19 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 20 |
+
|
| 21 |
+
### Instruction:
|
| 22 |
+
{}
|
| 23 |
+
|
| 24 |
+
### Input:
|
| 25 |
+
{}
|
| 26 |
+
|
| 27 |
+
### Response:
|
| 28 |
+
{}"""
|
| 29 |
+
```
|
| 30 |
+
### load the model
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from peft import PeftModel, PeftConfig
|
| 34 |
+
from transformers import AutoModelForCausalLM ,AutoTokenizer
|
| 35 |
+
|
| 36 |
+
config = PeftConfig.from_pretrained("damerajee/Tinyllama-sft-small")
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained("unsloth/tinyllama")
|
| 38 |
+
tokenizer=AutoTokenizer.from_pretrained("damerajee/Tinyllama-sft-small")
|
| 39 |
+
model = PeftModel.from_pretrained(model, "damerajee/Tinyllama-sft-small")l")
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
### Inference
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
inputs = tokenizer(
|
| 46 |
+
[
|
| 47 |
+
alpaca_prompt.format(
|
| 48 |
+
"i want to learn machine learning help me",
|
| 49 |
+
"", # input
|
| 50 |
+
"", # output
|
| 51 |
+
)
|
| 52 |
+
]*1, return_tensors = "pt").to("cuda")
|
| 53 |
+
|
| 54 |
+
outputs = model.generate(**inputs, max_new_tokens = 312, use_cache = True)
|
| 55 |
+
tokenizer.batch_decode(outputs)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
# Model Information
|
| 59 |
+
The base model [unsloth/tinyllama-bnb-4bit](https://huggingface.co/unsloth/tinyllama-bnb-4bit)was Instruct finetuned using [Unsloth](https://github.com/unslothai/unsloth)
|
| 60 |
+
|
| 61 |
+
# Training Details
|
| 62 |
+
|
| 63 |
+
The model was trained for 1 epoch on a free goggle colab which took about 1 hour and 30 mins approximately
|