Aaah I got the issue. I was running an old version of timm in the environment where I exported and a new version of timm in the environment where it was imported. Hence the exported model did not have the .flatten attribute.
Again, thanks for the help! Sorry for not updating first :).