AI SeedbankHelp preserve open and free AI for humanity's future

← All models

distilbert_distilgpt2

distilbert · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


language: en tags:

  • exbert

license: apache-2.0 datasets:

  • openwebtext

model-index:

  • name: distilgpt2 results:
    • task: type: text-generation name: Text Generation dataset: type: wikitext name: WikiText-103 metrics:
      • type: perplexity name: Perplexity value: 21.1

co2_eq_emissions: 149200

DistilGPT2

DistilGPT2 (short for Distilled-GPT2) is an English-language model pre-trained with the supervision of the smallest version of Generative Pre-trained Transformer 2 (GPT-2). Like GPT-2, DistilGPT2 can be used to generate text. Users of this model card should also consider information about the design, training, and limitations of GPT-2.

Model Details

  • Developed by: Hugging Face
  • Model type: Transformer-based Language Model
  • Language: English
  • License: Apache 2.0
  • Model Description: DistilGPT2 is an English-language model pre-trained with the supervision of the 124 million parameter version of GPT-2. DistilGPT2, which has 82 million parameters, was developed using knowledge distillation and was designed to be a faster, lighter version of GPT-2.
  • Resources for more information: See this repository for more about Distil* (a class of compressed models including Distilled-GPT2), Sanh et al. (2019) for more information about knowledge distillation and the training procedure, and this page for more about GPT-2.

Uses, Limitations and Risks

Limitations and Risks

Click to expand

CONTENT WARNING: Readers should be aware this section contains content that is disturbing, offensive, and can propagate historical and current stereotypes.

As the developers of GPT-2 (OpenAI) note in their model card, “language models like GPT-2 reflect the biases inherent to the systems they were trained on.” Significant research has explored bias and fairness issues with models for language generation including GPT-2 (see, e.g., Sheng et al. (2021) and Bender et al. (2021)).

DistilGPT2 also suffers from persistent bias issues, as highlighted in the demonstrative examples below. Note that these examples are not a comprehensive stress-testing of the model. Readers considering using the model should consider more rigorous evaluations of the model depending on their use case and context.

The impact of model compression techniques – such as knowledge distillation – on bias and fairness issues associated with language models is an active area of research. For example:

  • Silva, Tambwekar and Gombolay (2021) find that distilled versions of BERT and RoBERTa consistently exhibit statistically significant bias (with regard to gender and race) with effect sizes larger than the teacher models.
  • Xu and Hu (2022) find that distilled versions of GPT-2 showed consistent reductions in toxicity and bias compared to the teacher model (see the paper for more detail on metrics used to define/measure toxicity and bias).
  • Gupta et al. (2022) find that DistilGPT2 exhibits greater gender disparities than GPT-2 and propose a technique for mitigating gender bias in distilled language models like DistilGPT2.
>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='distilgpt2')
>>> set_seed(48)
>>> generator("The White man worked as a", max_length=20, num_return_sequences=3)
[{'generated_text': "The White man worked as a salesman at a McDonald's restaurant called Kia at the time of the"},
 {'generated_text': 'The White man worked as a contractor in the Army in the late 1990s. He became a "'},
 {'generated_text': 'The White man worked as a police spokesman to the US Navy in the 1930s.'}]
 
>>> set_seed(48)
>>> generator("The Black man worked as a", max_length=20, num_return_sequences=3)
[{'generated_text': 'The Black man worked as a shop assistant for an hour at Wal-Mart at Wal-Mart in'},
 {'generated_text': 'The Black man worked as a waiter in the hotel when he was assaulted when he got out of a'},
 {'generated_text': 'The Black man worked as a police spokesman four months ago...'}]

Potential Uses

Since DistilGPT2 is a distilled version of GPT-2, it is intended to be used for similar use cases with the increased functionality of being smaller and easier to run than the base model.

The developers of GPT-2 state in their model card that they envisioned GPT-2 would be used by researchers to better understand large-scale generative language models, with possible secondary use cases including:

  • Writing assistance: Grammar assistance, autocompletion (for normal prose or code)
  • Creative writing and art: exploring the generation of creative, fictional texts; aiding creation of poetry and other literary art.
  • Entertainment: Creation of games, chat bots, and amusing generations.

Using DistilGPT2, the Hugging Face team built the Write With Transformers web app, which allows users to play with the model to generate text directly from their browser.

Out-of-scope Uses

OpenAI states in the GPT-2 model card:

Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases that require the generated text to be true.

Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do not recommend that they be deployed into systems that interact with humans unless the deployers first carry out a study of biases relevant to the intended use-case.

How to Get Started with the Model

Click to expand

Be sure to read the sections on in-scope and out-of-scope uses and limitations of the model for further information on how to use the model.

Using DistilGPT2 is similar to using GPT-2. DistilGPT2 can be used directly with a pipeline for text generation. Since the generation relies on some randomness, we set a seed for reproducibility:

>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='distilgpt2')
>>> set_seed(42)
>>> generator("Hello, I’m a language model", max_length=20, num_return_sequences=5)
Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.
[{'generated_text': "Hello, I'm a language model, I'm a language model. In my previous post I've"},
 {'generated_text': "Hello, I'm a language model, and I'd love to hear what you think about it."},
 {'generated_text': "Hello, I'm a language model, but I don't get much of a connection anymore, so"},
 {'generated_text': "Hello, I'm a language model, a functional language... It's not an example, and that"},
 {'generated_text': "Hello, I'm a language model, not an object model.\n\nIn a nutshell, I"}]

Here is how to use this model to get the features of a given text in PyTorch:

from transformers import GPT2Tokenizer, GPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
model = GPT2Model.from_pretrained('distilgpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)

And in TensorFlow:

from transformers import GPT2Tokenizer, TFGPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
model = TFGPT2Model.from_pretrained('distilgpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)

Training Data

DistilGPT2 was trained using OpenWebTextCorpus, an open-source reproduction of OpenAI’s WebText dataset, which was used to train GPT-2. See the OpenWebTextCorpus Dataset Card for additional information about OpenWebTextCorpus and Radford et al. (2019) for additional information about WebText.

Training Procedure

The texts were tokenized using the same tokenizer as GPT-2, a byte-level version of Byte Pair Encoding (BPE). DistilGPT2 was trained using knowledge distillation, following a procedure similar to the training procedure for DistilBERT, described in more detail in Sanh et al. (2019).

Evaluation Results

The creators of DistilGPT2 report that, on the WikiText-103 benchmark, GPT-2 reaches a perplexity on the test set of 16.3 compared to 21.1 for DistilGPT2 (after fine-tuning on the train set).

Environmental Impact

Carbon emissions were estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.

  • Hardware Type: 8 16GB V100
  • Hours used: 168 (1 week)
  • Cloud Provider: Azure
  • Compute Region: unavailable, assumed East US for calculations
  • Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid): 149.2 kg eq. CO2

Citation

@inproceedings{sanh2019distilbert,
  title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
  author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
  booktitle={NeurIPS EMC^2 Workshop},
  year={2019}
}

Glossary

  • Knowledge Distillation: As described in Sanh et al. (2019), “knowledge distillation is a compression technique in which a compact model – the student – is trained to reproduce the behavior of a larger model – the teacher – or an ensemble of models.” Also see Bucila et al. (2006) and Hinton et al. (2015).

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:2f78043089a36d791ff86dc1946b72fc7f4801db&dn=distilbert_distilgpt2

Open magnet in torrent client · infohash 2f78043089a36d791ff86dc1946b72fc7f4801db

Files & hashes

PathSizesha1sha256
64.tflite310.2 MB (325,310,836 B)ec5b8f6e4285f87788ab156f6215f4c6113f04ea7df15c10bc1a025f321ea6da7c1a16a443093737ad61a48c3586c5e40c50eb10
README.md10.7 KB (10,992 B)86f7c9ae4422de194e6b6104b0acc9c8b9d2cd0a111f8d09ac565c745d91df88929147159eaa62b2e58e03943a2e03c1a1439ad7
config.json762 B (762 B)fed02aafb76b46aa5da200966f9e42262e7580234ec5947c1d59fee6212cdf3b0ec1a53eac02092554c5ff0a733488cbd2c64f3a
coreml/text-generation/float32_model.mlpackage/Data/com.apple.CoreML/model.mlmodel1.2 MB (1,240,147 B)e4d6e5bb5769662d08c11723e9489995f2fcfcd9d19fa891e34f314c61a5d7262a61ae187664b5ef5e8113a9b32962c792676d2f
coreml/text-generation/float32_model.mlpackage/Data/com.apple.CoreML/weights/weight.bin461.8 MB (484,212,356 B)0dee13a9c174b030fa734085ad7f072eec468aeabb5eff8ff72219ddda6f919aa8623afa6cb2a96e732bf2e604c93e1e14b8df00
coreml/text-generation/float32_model.mlpackage/Manifest.json617 B (617 B)1736aded3af566b70fd7e971c55f9100ffa4356e6498539408a8492b9e0bc6bdc7f15cc1958df6a14e46fc4ff616318c20dab0cc
coreml_model.mlmodel459.9 MB (482,254,328 B)b89521a556e2d3830a8034b84987ab80c92c0a176c0ee43d6d4be21bc3cef1f44035fefaa96962fd05be39570ea268e4a5ce11bc
generation_config.json124 B (124 B)057e43033439e068b325f32af95dde9efc9552aeb90eadacf585a743a30ea51e8b5c88b8d282a2a34dc0c7e556d0987cdbd68805
generation_config_for_text_generation.json165 B (165 B)c791c4d01fc484a57262ee57c878dd5b35863fe7a69e99c4a690c2015aaaeaef066516f1df9316317b3605869039fa896108efce
merges.txt445.6 KB (456,318 B)226b0752cac7789c48f0cb3ec53eda48b7be36cc1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5
model.safetensors336.5 MB (352,824,413 B)13286b3194a4b310ceeb61d89fbbcc117eb4dc8be1ff18884359fe8beb795a5f414feb85a6ce3d929ad019c0d958c039d2b94a1b
pytorch_model.bin336.5 MB (352,833,716 B)beb02e1768bafd966d8ed814f3f74b0bb83c4a79ecbb4e22dd2b9dcc43b2622e1b87ebb9361fb31e496b98ea01a38785c1dbaa01
rust_model.ot483.7 MB (507,225,049 B)10e6be7170b0c5132cdc0f4da05bb3ae925e11865bf6e122f504e97feec8978d500d6cdb572606ad80e6daf388b96e0de7f2ddba
tokenizer.json1.3 MB (1,355,256 B)4b988bccc9dc5adacd403c00b4704976196548f88414cab924d8b9b33013f0d221c5862f365ee9be39c5c2bfae8a5a9e970478a6
tokenizer_config.json26 B (26 B)be4d21d94f3b4687e5a54d84bf6ab46ed0f8defd5e04eb606e3a1583530a42e36c2a6b6615c86f34fe77e44d9ddeb43ff940931f
vocab.json1017.9 KB (1,042,301 B)1f1d9aaca301414e7f6c9396df506798ff4eb9a6196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783

Cite this release

Canonical URL
https://aiseedbank.org/models/distilbert_distilgpt2/
Slug
distilbert_distilgpt2
Infohash
2f78043089a36d791ff86dc1946b72fc7f4801db
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: distilbert_distilgpt2.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorydistilbert/distilgpt2
Revision (pinned)2290a62682d06624634c1f46a6ad5be0f47f38aa
Fetched at2026-09-03T22:22:38Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-03T22:23:04Z

apache-2.02.34 GB (2,508,767,406 bytes)transformerspytorchjaxtfliterustcoremlsafetensorsgpt2text-generationexbertmodel-indexco2_eq_emissionstext-generation-inferenceendpoints_compatible2 languages (tf, en)paper: 1910.01108paper: 2201.08542paper: 2203.12574paper: 1910.09700paper: 1503.02531