--- library_name: lucid license: mit tags: - causal-lm - gpt2 - lucid datasets: - webtext pipeline_tag: text-generation --- # GPT-2 Medium (causal-LM) > https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf [Lucid](https://github.com/ChanLumerico/lucid) port of `transformers/gpt2-medium`, converted to Lucid-native safetensors. ## Available weights | Tag | Params | GFLOPs | Size | Source | |---|---|---|---|---| | `WEBTEXT` *(default)* | 354.8M | — | 1549.89 MB | transformers | ## Usage ```python import lucid import lucid.models as models from lucid.models.weights import GPT2MediumLMWeights # default tag model = models.gpt2_medium_lm(pretrained=True) # explicit tag (enum or string) model = models.gpt2_medium_lm(weights=GPT2MediumLMWeights.WEBTEXT) model = models.gpt2_medium_lm(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) logits = out.logits # (B, T, vocab_size) ``` ## Conversion Converted from `transformers/gpt2-medium` via `python -m tools.convert_weights gpt2_medium_lm --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). ```