Open pjbull opened 2 years ago
This also arises if we are training a model that has labels which are a subset of the zamba labels, which means we "resume training" instead of replacing the head. This stems from the fact that finetune_from
is still None in this case; we should instead do model_class(finetune_from={official_ckpt})
rather than load from checkpoint
In addition: we may want super().load_from_checkpoint
instead here to avoid re-passing through the init with the timm weight download:
https://github.com/drivendataorg/zamba/blob/7fb2a0f9599bf55bf2f538d6a0a736963cb9d9eb/zamba/models/efficientnet_models.py#L27
The code has changed a lot. Has this bug been resolved? I'm trying to work on this if it's not resolved.
@papapizzachess yes this bug still exists and the code sections in the issue description are still correct.
We currently use
load_from_checkpoint
in ourModelManager
to initialize models when doing inference. This can cause the models to download the pretrained imagenet weights from the internet even thought we don't need those. To address this, we need a parameter that we pass in to the__init__
of the model to indicate we are doing inference/loading from a checkpoint, and then we need to pass this paramter toload_from_checkpoint
in theModelManager
.We should check across all of our models for this behavior, but this is how it works for the
time_distributed
model:Here is where we need to pass a parameter indicating that we're doing inference: https://github.com/drivendataorg/zamba/blob/7fb2a0f9599bf55bf2f538d6a0a736963cb9d9eb/zamba/models/model_manager.py#L98-L101
Here is where we need to use that param to skip intializing from timm: https://github.com/drivendataorg/zamba/blob/7fb2a0f9599bf55bf2f538d6a0a736963cb9d9eb/zamba/models/efficientnet_models.py#L23-L27