GPT-2 Small

https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf

Lucid port of transformers/gpt2, converted to Lucid-native safetensors.

Available weights

Tag Params GFLOPs Size Source
WEBTEXT (default) 124.4M โ€” 474.71 MB transformers

Usage

import lucid
import lucid.models as models
from lucid.models.weights import Gpt2SmallWeights

# default tag
model = models.gpt2_small(pretrained=True)

# explicit tag (enum or string)
model = models.gpt2_small(weights=Gpt2SmallWeights.WEBTEXT)
model = models.gpt2_small(pretrained="WEBTEXT")

# feed token ids (tokenize with the matching lucid.utils.tokenizer)
input_ids = lucid.tensor([[101, 7592, 2088, 102]], dtype=lucid.int64)
out = model(input_ids)
hidden = out.last_hidden_state  # (B, T, hidden_size)

Conversion

Converted from transformers/gpt2 via python -m tools.convert_weights gpt2_small --tag WEBTEXT. Key mapping + numerical parity verified against the source.

License

mit โ€” inherited from the original weights.

Citation

Radford et al., "Language Models are Unsupervised Multitask Learners", 2019 (GPT-2).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support