Skip to main content

No project description provided

Project description

TinyModel is a 44M parameter model trained on TinyStories V2 for mechanistic interpretability.

It has 4 layers, uses ReLU activations, and has no layernorms.

It was trained for 3 epochs on a preprocessed version of TinyStoriesV2.

from tiny_model import TinyModel, tokenizer

lm = TinyModel()

# for inference
tok_ids, attn_mask = tokenizer(['Once upon a time', 'In the forest'])
logprobs = lm(tok_ids)

# or
lm.generate('Once upon a time, Ada was happily walking through a magical forest with')

# To decode tok_ids you can use
tokenizer.decode(tok_ids)

Tokenization is done as follows:

  • the top-10K most frequent tokens using the GPT-NeoX tokenizer are selected and sorted by frequency.
  • To tokenize a document, first tokenize with the GPT-NeoX tokenizer. Then replace tokens not in the top 10K tokens with a special [UNK] token id. All token ids are then mapped to be between 1 and 10K, roughly sorted from most frequent to least.
  • Finally, prepend the document with a [BEGIN] token id.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinystoriesmodel-0.1.0.tar.gz (73.8 kB view details)

Uploaded Source

Built Distribution

tinystoriesmodel-0.1.0-py3-none-any.whl (72.8 kB view details)

Uploaded Python 3

File details

Details for the file tinystoriesmodel-0.1.0.tar.gz.

File metadata

  • Download URL: tinystoriesmodel-0.1.0.tar.gz
  • Upload date:
  • Size: 73.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-35-generic

File hashes

Hashes for tinystoriesmodel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 831370936bc5b0bcf8f7fc721658e222a6f01e0fecd81555b6275aa7cbc6f01f
MD5 43beff79e944fcdf9708fbc25b201bd5
BLAKE2b-256 39161a26a275659405f61290a4b1080f4296db4bda220b90d0ebe0c0c89b9846

See more details on using hashes here.

File details

Details for the file tinystoriesmodel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tinystoriesmodel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 72.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-35-generic

File hashes

Hashes for tinystoriesmodel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccd5ad77f44631d5253d4d2faeebcf9954af0a2ed698f0ccc74b69b045a9a885
MD5 0952d4f1e8445954eeb92ae27206537d
BLAKE2b-256 289910e2de89f299fd5fd89a808550c25b1296b9b8c093f43ae7ee72e7e2d688

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page