Skip to content

Commit 55698e3

Browse files
authored
Remove usage of SparseAutoModel.log_model_load (#2232)
1 parent d636d35 commit 55698e3

7 files changed

+6
-19
lines changed

integrations/huggingface-transformers/tutorials/sentiment-analysis/docs-sentiment-analysis-python-custom-teacher-rottentomatoes.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,11 @@
364364
"model_kwargs = {\"config\": model_config}\n",
365365
"model_kwargs[\"state_dict\"], s_delayed = SparseAutoModel._loadable_state_dict(model_path)\n",
366366
"model = AutoModelForSequenceClassification.from_pretrained(model_path,**model_kwargs,)\n",
367-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed) # prints metrics on sparsity profile\n",
368367
"\n",
369368
"# initialize teacher using familiar HF AutoModel\n",
370369
"teacher_kwargs = {\"config\": teacher_config}\n",
371370
"teacher_kwargs[\"state_dict\"], t_delayed = SparseAutoModel._loadable_state_dict(teacher_path)\n",
372-
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path,**teacher_kwargs,)\n",
373-
"SparseAutoModel.log_model_load(teacher, teacher_path, \"teacher\", t_delayed)"
371+
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path,**teacher_kwargs,)"
374372
]
375373
},
376374
{

integrations/huggingface-transformers/tutorials/sentiment-analysis/docs-sentiment-analysis-python-sst2.ipynb

+1-5
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,7 @@
440440
"\n",
441441
"teacher_kwargs = {'config':teacher_config}\n",
442442
"teacher_kwargs[\"state_dict\"], t_delayed = SparseAutoModel._loadable_state_dict(teacher_path)\n",
443-
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path, **teacher_kwargs,)\n",
444-
"\n",
445-
"# optional - prints metrics about sparsity profiles of the models\n",
446-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed)\n",
447-
"SparseAutoModel.log_model_load(teacher, teacher_path, \"teacher\", t_delayed)"
443+
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path, **teacher_kwargs,)"
448444
]
449445
},
450446
{

integrations/huggingface-transformers/tutorials/text-classification/docs-text-classification-python-custom-teacher-tweeteval.ipynb

+1-4
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,7 @@
515515
"# initialize model using familiar HF AutoModel\n",
516516
"model_kwargs = {\"config\": config}\n",
517517
"model_kwargs[\"state_dict\"], s_delayed = SparseAutoModel._loadable_state_dict(model_path)\n",
518-
"model = AutoModelForSequenceClassification.from_pretrained(model_path, **model_kwargs,)\n",
519-
"\n",
520-
"# prints metrics on sparsity profile\n",
521-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed)"
518+
"model = AutoModelForSequenceClassification.from_pretrained(model_path, **model_kwargs,)"
522519
]
523520
},
524521
{

integrations/huggingface-transformers/tutorials/text-classification/docs-text-classification-python-qqp.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,11 @@
375375
"model_kwargs = {\"config\": model_config}\n",
376376
"model_kwargs[\"state_dict\"], s_delayed = SparseAutoModel._loadable_state_dict(model_path)\n",
377377
"model = AutoModelForSequenceClassification.from_pretrained(model_path, **model_kwargs,)\n",
378-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed) # prints metrics on sparsity profile\n",
379378
"\n",
380379
"# initialize teacher using familiar HF AutoModel\n",
381380
"teacher_kwargs = {\"config\": teacher_config}\n",
382381
"teacher_kwargs[\"state_dict\"], t_delayed = SparseAutoModel._loadable_state_dict(teacher_path)\n",
383-
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path, **teacher_kwargs,)\n",
384-
"SparseAutoModel.log_model_load(teacher, teacher_path, \"teacher\", t_delayed) # prints metrics on sparsity profile"
382+
"teacher = AutoModelForSequenceClassification.from_pretrained(teacher_path, **teacher_kwargs,)\n"
385383
]
386384
},
387385
{

integrations/huggingface-transformers/tutorials/text-classification/docs-text-classification-python-sick.ipynb

-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@
361361
"model_kwargs = {\"config\": config}\n",
362362
"model_kwargs[\"state_dict\"], s_delayed = SparseAutoModel._loadable_state_dict(model_path)\n",
363363
"model = AutoModelForSequenceClassification.from_pretrained(model_path,**model_kwargs,)\n",
364-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed) # prints metrics on sparsity profile\n",
365364
"\n",
366365
"# FYI: there is a factory function called SparseAutoModel that does the same as above\n",
367366
"# model, teacher = SparseAutoModel.text_classification_from_pretrained_distil(\n",

integrations/huggingface-transformers/tutorials/token-classification/docs-token-classification-python-conll2003.ipynb

+1-1
Large diffs are not rendered by default.

integrations/huggingface-transformers/tutorials/token-classification/docs-token-classification-python-custom-teacher-wnut.ipynb

+1-2
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,7 @@
587587
"# initialize model\n",
588588
"model_kwargs = {\"config\": config}\n",
589589
"model_kwargs[\"state_dict\"], s_delayed = SparseAutoModel._loadable_state_dict(model_path)\n",
590-
"model = AutoModelForTokenClassification.from_pretrained(model_path, **model_kwargs,)\n",
591-
"SparseAutoModel.log_model_load(model, model_path, \"student\", s_delayed) # prints metrics on sparsity profile"
590+
"model = AutoModelForTokenClassification.from_pretrained(model_path, **model_kwargs,)"
592591
]
593592
},
594593
{

0 commit comments

Comments
 (0)