Views
No views yet
| Dataset | Split | # samples |
|---|---|---|
| SQuAD1.1 | train | 90.6K |
| SQuAD1.1 | eval | 11.1k |
3.8.51Memory: 64 GiB
2GPUs: 1 GeForce GTX 3090, with 24GiB memory
3GPU driver: 455.23.05, CUDA: 11.1379MB (original BERT: 420MB)| Metric | # Value | # Original (Table 2) | Variation |
|---|---|---|---|
| EM | 81.69 | 80.8 | +0.89 |
| F1 | 88.72 | 88.5 | +0.22 |
pip install nn_pruningtransformers library almost as usual: you just have to call optimize_model when the pipeline has loaded.1from transformers import pipeline
2from nn_pruning.inference_model_patcher import optimize_model
3
4qa_pipeline = pipeline(
5 "question-answering",
6 model="madlag/bert-base-uncased-squadv1-x1.84-f88.7-d36-hybrid-filled-v1",
7 tokenizer="madlag/bert-base-uncased-squadv1-x1.84-f88.7-d36-hybrid-filled-v1"
8)
9
10print("/home/lagunas/devel/hf/nn_pruning/nn_pruning/analysis/tmp_finetune parameters: 218.0M")
11print(f"Parameters count (includes only head pruning, not feed forward pruning)={int(qa_pipeline.model.num_parameters() / 1E6)}M")
12qa_pipeline.model = optimize_model(qa_pipeline.model, "dense")
13
14print(f"Parameters count after complete optimization={int(qa_pipeline.model.num_parameters() / 1E6)}M")
15predictions = qa_pipeline({
16 'context': "Frédéric François Chopin, born Fryderyk Franciszek Chopin (1 March 1810 – 17 October 1849), was a Polish composer and virtuoso pianist of the Romantic era who wrote primarily for solo piano.",
17 'question': "Who is Frederic Chopin?",
18})
19print("Predictions", predictions)