autogluon / autogluon/autogluon
[BUG] Knowledge Distillation tutorial is broken with KeyError: 'learner_class'
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 21h 29m
- Merged PRs (30d)
- 57
Description
**Bug Report Checklist**
- [x] I confirmed bug exists on the latest stable version of AutoGluon.
**Describe the bug**
The Knowledge Distillation in AutoMM tutorial is broken. When trying to load the teacher model using `MultiModalPredictor.load("ag_distillation_sample_teacher/")`, it fails with `KeyError: 'learner_class'`. This happens because the downloaded model's assets.json file is missing the "learner_class" key that's required in the current version.
**Expected behavior**
The tutorial should run without errors, allowing users to load the teacher model and use it for distillation.
**To Reproduce**
Just follow the tutorial steps at https://auto.gluon.ai/stable/tutorials/multimodal/advanced_topics/model_distillation.html:
```python
import datasets
from datasets import load_dataset
import sklearn
from sklearn.model_selection import train_test_split
from autogluon.multimodal import MultiModalPredictor
# Download and unzip the teacher model
!wget --quiet https://automl-mm-bench.s3.amazonaws.com/unit-tests/distillation_sample_teacher.zip -O distillation_sample_teacher.zip
!unzip -q -o distillation_sample_teacher.zip -d .
# This line fails with KeyError: 'learner_class'
teacher_predictor = MultiModalPredictor.load("ag_distillation_sample_teacher/")
```
**Screenshots / Logs**
```
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[6], line 3
1 from autogluon.multimodal import MultiModalPredictor
----> 3 teacher_predictor = MultiModalPredictor.load("ag_distillation_sample_teacher/")
File ~/autogluon/multimodal/src/autogluon/multimodal/predictor.py:849, in MultiModalPredictor.load(cls, path, resume, verbosity)
847 assets = json.load(fp)
848 learner_class = BaseLearner
--> 849 if assets["learner_class"] == "MatchingLearner":
850 learner_class = MatchingLearner
851 elif assets["learner_class"] == "EnsembleLearner":
KeyError: 'learner_class'
```
Contributor guide
Assessment
This issue has not been assessed yet.