Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- roneneldan/TinyStories
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
library_name: transformers
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
---
|
9 |
+
|
10 |
+
We tried to use the huggingface transformers library to recreate the TinyStories models on Consumer GPU. Output model has 9 million parameters.
|
11 |
+
Tweaked code of springtangent (https://github.com/springtangent/tinystoriestrainer/blob/main/tinystories_train.py)
|
12 |
+
Code credit - springtangent
|
13 |
+
|
14 |
+
------ EXAMPLE USAGE ---
|
15 |
+
|
16 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
17 |
+
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("segestic/Tinystories-0.1-9m")
|
19 |
+
|
20 |
+
model = AutoModelForCausalLM.from_pretrained("segestic/Tinystories-0.1-9m")
|
21 |
+
|
22 |
+
prompt = "Once upon a time there was"
|
23 |
+
|
24 |
+
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
25 |
+
|
26 |
+
# Generate completion
|
27 |
+
output = model.generate(input_ids, max_length = 1000, num_beams=1)
|
28 |
+
|
29 |
+
# Decode the completion
|
30 |
+
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
31 |
+
|
32 |
+
# Print the generated text
|
33 |
+
print(output_text)
|