File size: 1,407 Bytes
facb666 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ---
library_name: lucid
license: mit
tags:
- base
- gpt2
- lucid
datasets:
- webtext
pipeline_tag: feature-extraction
---
# GPT-2 XL
> https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf
[Lucid](https://github.com/ChanLumerico/lucid) port of `transformers/gpt2-xl`,
converted to Lucid-native safetensors.
## Available weights
| Tag | Params | GFLOPs | Size | Source |
|---|---|---|---|---|
| `WEBTEXT` *(default)* | 1557.6M | — | 5941.87 MB | transformers |
## Usage
```python
import lucid
import lucid.models as models
from lucid.models.weights import GPT2XLargeWeights
# default tag
model = models.gpt2_xlarge(pretrained=True)
# explicit tag (enum or string)
model = models.gpt2_xlarge(weights=GPT2XLargeWeights.WEBTEXT)
model = models.gpt2_xlarge(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-xl` via
`python -m tools.convert_weights gpt2_xlarge --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).
```
|