AnirudhRajagopalan1201
commited on
Commit
•
b059692
1
Parent(s):
0a4ba23
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,59 @@
|
|
1 |
---
|
2 |
-
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
datasets:
|
3 |
+
- roneneldan/TinyStories
|
4 |
---
|
5 |
+
---
|
6 |
+
Model trained on the TinyStories Dataset, replicating https://arxiv.org/abs/2305.07759, based on LLaMA architecture.
|
7 |
+
|
8 |
+
---
|
9 |
+
Hyperparams used to train this model:
|
10 |
+
```
|
11 |
+
"batch_size": 32,
|
12 |
+
|
13 |
+
"block_size": 256,
|
14 |
+
|
15 |
+
"lr": 5e-4,
|
16 |
+
|
17 |
+
"num_hidden_layers": 8,
|
18 |
+
|
19 |
+
"num_attention_heads": 8,
|
20 |
+
|
21 |
+
"hidden_size": 160,
|
22 |
+
|
23 |
+
"dropout": 0.1,
|
24 |
+
|
25 |
+
"weight_decay": 0.01,
|
26 |
+
|
27 |
+
"epochs": 1,
|
28 |
+
|
29 |
+
"eval_interval": 200,
|
30 |
+
|
31 |
+
"eval_steps": 50,
|
32 |
+
|
33 |
+
"vocab_size": 50257,
|
34 |
+
|
35 |
+
"warmup_tokens": 10000,
|
36 |
+
|
37 |
+
"gradient_accumulation_steps": 16,
|
38 |
+
```
|
39 |
+
---
|
40 |
+
EXAMPLE USAGE
|
41 |
+
```py
|
42 |
+
!pip install --quiet transformers
|
43 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
44 |
+
from huggingface_hub import notebook_login, login
|
45 |
+
import os
|
46 |
+
|
47 |
+
#login to hf to check for llama access
|
48 |
+
hf_token = os.getenv('HF_TOKEN')
|
49 |
+
login(token=hf_token)
|
50 |
+
|
51 |
+
model = AutoModelForCausalLM.from_pretrained('AnirudhRajagopalan1201/tinyllama-20M')
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf")
|
53 |
+
prompt = "Lily likes cats and dogs. She asked her mom for a dog and her mom said no, so instead she asked"
|
54 |
+
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
55 |
+
output = model.generate(input_ids, temperature=0.1, max_length = 100, do_sample=True)
|
56 |
+
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
57 |
+
print(output_text)
|
58 |
+
|
59 |
+
```
|