CoolFace
Modelpublic

distily/short_gpt2

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes25downloads
Model Card

Summary

Distilled with Distily library using teacher model gpt2 on dataset wikimedia/wikipedia.

<!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment.

Model description

More information needed

Intended uses & limitations

More information needed -->

Model Architecture:

  • —Architecture: GPT2LMHeadModel
  • —Total Parameters: 81,912,576
  • —Data Type (dtype): torch.bfloat16
  • —Model Size: 0.16 GB

Evaluation Metrics Comparison

stepepochenwikipplfrwikippllossruntimesamples_per_secondsteps_per_secondtinystoriespplzhwikippl
teacher eval43.2561.2511.687519.125
002018634629120.0122045790683136.021.0022102.149497.89612.2379999220736.043705587204096.0
25000.0101299008.06422528.05.8065101.986198.05312.25745824.014483456.0
50000.02026880.096256.03.3113102.951697.13312.1424160.0493568.0
75000.03031216.08096.02.1560103.023697.06512.133692.042752.0
100000.0404608.03664.01.7825102.375297.6812.21388.0888.0
125000.0505358.01632.01.4664102.187197.8612.232272.0308.0
150000.0606288.01176.01.3488102.600797.46512.183228.0260.0
175000.0707255.01040.01.2932102.154297.89112.236199.0215.0
200000.0808216.0892.01.1570102.107397.93612.242173.0149.0
225000.0909178.0740.01.0350102.076597.96612.246146.0141.0
250000.1010155.0524.00.9676102.101997.94112.243122.5139.0
275000.1111142.0560.00.9230102.025698.01512.252114.0130.0
300000.1212137.0470.00.8998102.336597.71712.215108.5138.0
325000.1313134.0476.00.8740102.391197.66512.208104.0140.0
350000.1414129.0496.00.8657102.215397.83312.229102.5141.0
375000.1515127.0464.00.8513102.048997.99212.24997.0117.0
400000.1616108.0446.00.7522102.933197.1512.14493.0104.0
425000.171799.5374.00.6850103.108896.98512.12382.0116.0
450000.181890.5346.00.6316102.790397.28512.16173.5113.0
475000.191982.5320.00.5960102.598897.46712.18371.0101.0
500000.202078.5306.00.5676102.593697.47212.18472.5106.0
525000.212179.5290.00.5424102.586397.47912.18564.592.0
550000.222276.0270.00.5280102.630797.43712.1865.087.0
575000.232376.5272.00.5278101.963998.07412.25964.5102.0
600000.242477.5268.00.5286102.092197.95112.24462.7599.5
625000.252575.5264.00.5204102.067997.97412.24763.2583.0
650000.262676.0260.00.5176102.179597.86712.23361.590.5
675000.272774.5256.00.5112102.576497.48812.18662.2593.5
700000.282873.5258.00.5128101.956998.08112.2662.079.0
725000.292975.0250.00.5053101.938298.09912.26264.096.0
750000.303072.5238.00.5068102.040798.012.2561.588.5
775000.313173.5256.00.5085102.054297.98712.24864.586.5
800000.323270.5238.00.4699102.404297.65212.20754.7598.5
825000.333368.0242.00.4574102.268497.78212.22355.5160.0
850000.343464.5218.00.4490102.327797.72512.21652.077.5
875000.353566.5203.00.4394102.113497.9312.24151.2567.5
900000.363663.75212.00.4310102.043897.99712.2551.2588.5
925000.373765.5209.00.4262101.998498.04112.25549.75103.5
950000.383865.0204.00.4274102.078197.96412.24646.2583.0
975000.393964.5201.00.4192102.069297.97312.24750.594.5
1000000.404064.5203.00.4207102.128397.91612.2449.088.0
1025000.414163.0209.00.4184102.22497.82412.22848.0125.0
1050000.424262.75193.00.4166102.191897.85512.23246.076.0
1075000.434362.75197.00.4128102.171997.87412.23447.0113.0
1100000.444464.5191.00.4118103.099296.99412.12449.082.0
1125000.454565.0213.00.4128102.729697.34312.16847.0111.5
1150000.464668.5207.00.4301102.17897.86812.23449.0108.0
1175000.474765.0217.00.4372102.230297.81812.22750.25124.0
1200000.484865.5210.00.4351102.295297.75612.2251.0139.0
1225000.494966.0272.00.4352102.194197.85312.23250.5226.0
1250000.505167.0240.00.4387101.97898.0612.25849.071.0
1275000.515266.5224.00.4396101.901498.13412.26749.75100.0
1300000.525365.5227.00.4354102.124497.9212.2450.75146.0
1325000.535466.0209.00.4286102.021898.01812.25252.25101.5
1350000.545564.5220.00.4361101.907498.12812.26651.25181.0
1375000.555666.5223.00.4288102.074497.96812.24649.0103.0
1400000.565766.5232.00.4287102.116297.92812.24149.25127.5
1425000.575866.5220.00.4299101.946198.09112.26149.588.5
1450000.585965.5217.00.4238101.957298.0812.2648.75177.0
1475000.596064.0205.00.4109101.949798.08812.26148.75128.0
1500000.606163.5224.00.4051102.020598.0212.25248.5117.5
1525000.616263.25202.00.4000101.931898.10512.26347.5160.0
1550000.626363.75195.00.4052102.020398.0212.25248.75100.0
1575000.636463.75212.00.4014101.893598.14212.26849.25113.0
1600000.646562.75198.00.3988101.917898.11812.26544.5132.0
1625000.656664.5192.00.3918102.030398.0112.25145.5100.0
1650000.666762.5202.00.3958102.362797.69212.21147.7588.5
1675000.676862.5191.00.3883102.153797.89212.23644.7580.5
1700000.686963.5195.00.3880102.072897.96912.24651.091.5
1725000.697060.75201.00.3863101.923598.11312.26447.590.5
1750000.707161.5189.00.3806101.937698.09912.26246.582.5
1775000.717258.75171.00.3512101.984498.05412.25742.7566.0
1800000.727355.5161.00.3218101.88198.15412.26939.2554.0
1825000.737454.25149.00.3148101.983998.05512.25738.7547.75
1850000.747553.5160.00.3133101.987598.05112.25638.7545.0
1875000.757654.75160.00.3114101.976298.06212.25838.043.75
1900000.767753.75147.00.3075101.997298.04212.25538.038.25
1925000.777854.0157.00.3057101.943198.09412.26238.048.0
1950000.787953.25149.00.3058101.977898.06112.25837.041.0
1975000.798054.0152.00.3032102.005998.03412.25437.2540.0
2000000.808153.75151.00.3033102.061597.9812.24837.2547.25
2025000.818253.0146.00.2957102.011698.02812.25436.7539.0
2050000.828352.5139.00.2903102.144997.912.23836.535.75
2075000.838452.0142.00.2894102.012698.02712.25336.2538.25
2100000.848552.25142.00.2883102.093897.94912.24436.037.25
2125000.858652.5141.00.2874101.951598.08612.26136.037.0
2150000.868752.25140.00.2873101.942798.09412.26236.036.0
2175000.878851.75141.00.2863102.011498.02812.25436.035.5
2200000.888952.0141.00.2854102.042497.99912.2536.035.75
2225000.899052.5143.00.2853102.036898.00412.2536.035.25
2250000.909152.0142.00.2849102.11597.92912.24135.7535.0
2275000.919252.0141.00.2851102.045597.99612.24936.035.25
2300000.929352.0141.00.2846102.027398.01312.25235.7535.25
2325000.939452.0141.00.2843101.96198.07712.2635.7535.0
2350000.949552.0141.00.2844102.018898.02112.25335.7535.25
2375000.959652.0141.00.2845102.071497.97112.24635.7535.25
2400000.969752.0141.00.2844102.037198.00412.2535.7535.25
2425000.979852.0141.00.2844102.036398.00412.25135.7535.25
2450000.989952.0141.00.2844102.025498.01512.25235.7535.25
2475001.052.0141.00.2846102.572897.49212.18635.7535.25

Resource Usage Comparison

  • —VRAM Use: 7.2012 GB

`# Distillation (Teacher -> Student) Architecture Difference:

  • —Architecture: GPT2LMHeadModel -> GPT2LMHeadModel
  • —Total Parameters: 124,439,808 -> 81,912,576
  • —Data Type (dtype): 124439808 -> torch.bfloat16
  • —Model Size: 0.24 GB -> 0.16 GB

<details> <summary>Module Diff Details</summary>

diff
--- teacher model modules
+++ student model modules
@@ -4,7 +4,7 @@
     (wpe): Embedding(1024, 768)
     (drop): Dropout(p=0.1, inplace=False)
     (h): ModuleList(
-      (0-11): 12 x GPT2Block(
+      (0-5): 6 x GPT2Block(
         (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
         (attn): GPT2FlashAttention2(
           (c_attn): Conv1D()

</details> <br/>

Train Dataset

Trained on 521,350,663 tokens from the wikimedia/wikipedia dataset.

  • —Num Samples: 990,000
  • —Subset: 20231101.en
  • —Split: train

Training Objective

DistillationObjective(logits_loss_component=LossComponent(label=logits, weight=1, loss_fn=kl))

Hyperparameters

The following hyperparameters were used during training:

<details> <summary>Expand</summary>

  • —learning_rate: 0.0001
  • —trainbatchsize: 4
  • —evalbatchsize: 8
  • —seed: 42
  • —optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • —lrschedulertype: cosine
  • —lrschedulerwarmup_ratio: 0.5
  • —num_epochs: 1.0
  • —distillationobjective: `DistillationObjective(logitslosscomponent=LossComponent(label=logits, weight=1, lossfn=kl))`
  • —train_embeddings: True
  • —lrscheduler: `<torch.optim.lrscheduler.LambdaLR object at 0x7fd9b01df220>`
  • —studentmodelnameorpath: None
  • —studentconfignameorpath: distilbert/distilgpt2
  • —studentmodelconfig: None
  • —reinitialize_weights: None
  • —copyteachermodules: [('lm_head', False)]
  • —studentmodelas_bitnet: False
  • —studentmodelcompile: False
  • —dropout: None
  • —teachermodelnameorpath: gpt2
  • —teacherloadin_8bit: False
  • —teacherloadin_4bit: False
  • —teachermodelcompile: False
  • —dataset_uri: wikimedia/wikipedia
  • —dataset_subset: 20231101.en
  • —dataset_split: train
  • —datasetcolumnname: text
  • —datasetsamplesize: 1000000
  • —datasettestsize: 0.01
  • —gradientaccumulationsteps: 1
  • —weight_decay: 0.0
  • —maxgradnorm: 1.0
  • —warmup_ratio: 0.5
  • —warmup_steps: 0
  • —gradient_checkpointing: True

</details> <br/>

Framework Versions

  • —Distily 0.2.0
  • —Transformers 4.44.0
  • —Pytorch 2.3.0
  • —Datasets 2.21.0