Skip to content

[Bug] Imcompatible with TimmClassifier #418

@Weiyun1025

Description

@Weiyun1025

Describe the bug

if the architecture or teacher of SingleTeacherDistill is a instance of TimmClassifier, the ckpt can not be load correctly.

To Reproduce

from mmengine.config import Config
from mmrazor.registry import MODELS
from mmengine.runner import load_checkpoint, save_checkpoint

model = MODELS.build(Config.fromfile('./debug_config.py')['model'])

save_checkpoint(model.state_dict(), './temp.pth')
load_checkpoint(model, './temp.pth', strict=True)

Config

student = dict(
    _scope_='mmcls',
    type='TimmClassifier',
    model_name='deit_tiny_patch16_224',
)

teacher = dict(
    _scope_='mmcls',
    type='TimmClassifier',
    model_name='cait_s24_224',
)

model = dict(
    _scope_='mmrazor',
    type='SingleTeacherDistill',
    architecture=student,
    teacher=teacher,
    distiller=dict(
        type='ConfigurableDistiller',
    ),
)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions