
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)

{"language": ["en"], "library_name": "transformers", "datasets": ["roneneldan/TinyStories"], "pipeline_tag": "text-generation"}
transformers pytorch gpt_neo text-generation en dataset:roneneldan/TinyStories autotrain_compatible endpoints_compatible region:us