File size: 973 Bytes
70cc00b
 
 
 
 
 
 
 
 
 
0bcf92c
70cc00b
0bcf92c
70cc00b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
datasets:
- roneneldan/TinyStories
language:
- en
library_name: transformers
pipeline_tag: text-generation
---

We tried to use the huggingface transformers library to recreate the TinyStories models on Consumer GPU. Output model has 9 million parameters. 

Tweaked code of springtangent (https://github.com/springtangent/tinystoriestrainer/blob/main/tinystories_train.py)

Code credit - springtangent

------ EXAMPLE USAGE ---

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("segestic/Tinystories-0.1-9m")

model = AutoModelForCausalLM.from_pretrained("segestic/Tinystories-0.1-9m")

prompt = "Once upon a time there was"

input_ids = tokenizer.encode(prompt, return_tensors="pt")

# Generate completion
output = model.generate(input_ids, max_length = 1000, num_beams=1)

# Decode the completion
output_text = tokenizer.decode(output[0], skip_special_tokens=True)

# Print the generated text
print(output_text)