Skip to content

Fix AttributeError: 'EfficientNetFeatures' object has no attribute 'act1' in newer timm versions#21

Open
n3ural wants to merge 1 commit intogangweix:mainfrom
n3ural:main
Open

Fix AttributeError: 'EfficientNetFeatures' object has no attribute 'act1' in newer timm versions#21
n3ural wants to merge 1 commit intogangweix:mainfrom
n3ural:main

Conversation

@n3ural
Copy link

@n3ural n3ural commented Feb 18, 2025

Newer versions of timm do not support model.act1, leading to the following error:
AttributeError: 'EfficientNetFeatures' object has no attribute 'act1'

To resolve this, I updated the code to use model.bn1.act instead of model.act1, ensuring compatibility with the latest timm versions.

Changes:
Replaced self.act1 = model.act1 with self.act1 = model.bn1.act

Impact:
Fixes compatibility with newer timm versions.
Prevents runtime errors due to missing attributes.

Testing:
Verified that the modified code runs without errors on the latest timm version.

Let me know if any additional changes are required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant