I'm trying to run model on Kaggle notebook using PyTorch backend. I guess notebook by defaul has both Tensorflow and PyTorch. And because of that package create tensorflow model no matter if environ set to "torch".
Code:
os.environ["KECAM_BACKEND"] = "torch"
import torch
from keras_cv_attention_models import efficientnet
model = efficientnet.EfficientNetV2B0(is_torch_mode=True,
pretrained='imagenet21k', # weights pretrained on imagenet21k
num_classes=num_classes,
classifier_activation=activation_fn,
dropout=0.25,
)
print(f"{isinstance(model, torch.nn.Module) = }")
Output:
torch
>>>> Load pretrained from: /root/.keras/models/efficientnetv2-b0-21k.h5
isinstance(model, torch.nn.Module) = False
I'm trying to run model on Kaggle notebook using PyTorch backend. I guess notebook by defaul has both Tensorflow and PyTorch. And because of that package create tensorflow model no matter if environ set to "torch".
Code:
Output: