GPT-2 Medium
Lucid port of transformers/gpt2-medium,
converted to Lucid-native safetensors.
Available weights
| Tag | Params | GFLOPs | Size | Source |
|---|---|---|---|---|
WEBTEXT (default) |
354.8M | โ | 1353.57 MB | transformers |
Usage
import lucid
import lucid.models as models
from lucid.models.weights import Gpt2MediumWeights
# default tag
model = models.gpt2_medium(pretrained=True)
# explicit tag (enum or string)
model = models.gpt2_medium(weights=Gpt2MediumWeights.WEBTEXT)
model = models.gpt2_medium(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-medium via
python -m tools.convert_weights gpt2_medium --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).