ConvNextV2 weight not initialized
#1
by
IMvision12
- opened
Code Used:
from transformers import AutoImageProcessor, ConvNextV2ForImageClassification
import torch
from datasets import load_dataset
dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]
image_processor = AutoImageProcessor.from_pretrained("facebook/convnextv2-atto-1k-224")
model = ConvNextV2ForImageClassification.from_pretrained("facebook/convnextv2-atto-1k-224")
inputs = image_processor(image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])
Platform: kaggle
Some weights of the model checkpoint at facebook/convnextv2-atto-1k-224 were not used when initializing ConvNextV2ForImageClassification: ['convnextv2.encoder.stages.1.layers.1.grn.bias', 'convnextv2.encoder.stages.3.layers.0.grn.weight', 'convnextv2.encoder.stages.3.layers.0.grn.bias', 'convnextv2.encoder.stages.3.layers.1.grn.bias', 'convnextv2.encoder.stages.2.layers.4.grn.bias', 'convnextv2.encoder.stages.2.layers.3.grn.bias', 'convnextv2.encoder.stages.3.layers.1.grn.weight', 'convnextv2.encoder.stages.2.layers.5.grn.bias', 'convnextv2.encoder.stages.2.layers.4.grn.weight', 'convnextv2.encoder.stages.2.layers.5.grn.weight', 'convnextv2.encoder.stages.2.layers.0.grn.bias', 'convnextv2.encoder.stages.2.layers.0.grn.weight', 'convnextv2.encoder.stages.0.layers.1.grn.bias', 'convnextv2.encoder.stages.1.layers.1.grn.weight', 'convnextv2.encoder.stages.2.layers.2.grn.bias', 'convnextv2.encoder.stages.2.layers.1.grn.bias', 'convnextv2.encoder.stages.0.layers.0.grn.bias', 'convnextv2.encoder.stages.2.layers.1.grn.weight', 'convnextv2.encoder.stages.0.layers.1.grn.weight', 'convnextv2.encoder.stages.0.layers.0.grn.weight', 'convnextv2.encoder.stages.2.layers.2.grn.weight', 'convnextv2.encoder.stages.1.layers.0.grn.weight', 'convnextv2.encoder.stages.1.layers.0.grn.bias', 'convnextv2.encoder.stages.2.layers.3.grn.weight']
- This IS expected if you are initializing ConvNextV2ForImageClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing ConvNextV2ForImageClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of ConvNextV2ForImageClassification were not initialized from the model checkpoint at facebook/convnextv2-atto-1k-224 and are newly initialized: ['convnextv2.encoder.stages.0.layers.1.grn.beta', 'convnextv2.encoder.stages.1.layers.0.grn.gamma', 'convnextv2.encoder.stages.2.layers.1.grn.beta', 'convnextv2.encoder.stages.1.layers.1.grn.beta', 'convnextv2.encoder.stages.1.layers.1.grn.gamma', 'convnextv2.encoder.stages.2.layers.3.grn.gamma', 'convnextv2.encoder.stages.0.layers.1.grn.gamma', 'convnextv2.encoder.stages.3.layers.0.grn.beta', 'convnextv2.encoder.stages.2.layers.5.grn.gamma', 'convnextv2.encoder.stages.1.layers.0.grn.beta', 'convnextv2.encoder.stages.2.layers.2.grn.beta', 'convnextv2.encoder.stages.2.layers.1.grn.gamma', 'convnextv2.encoder.stages.2.layers.0.grn.beta', 'convnextv2.encoder.stages.0.layers.0.grn.beta', 'convnextv2.encoder.stages.2.layers.2.grn.gamma', 'convnextv2.encoder.stages.3.layers.1.grn.gamma', 'convnextv2.encoder.stages.2.layers.3.grn.beta', 'convnextv2.encoder.stages.2.layers.5.grn.beta', 'convnextv2.encoder.stages.2.layers.4.grn.gamma', 'convnextv2.encoder.stages.2.layers.0.grn.gamma', 'convnextv2.encoder.stages.3.layers.0.grn.gamma', 'convnextv2.encoder.stages.2.layers.4.grn.beta', 'convnextv2.encoder.stages.3.layers.1.grn.beta', 'convnextv2.encoder.stages.0.layers.0.grn.gamma']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
IMvision12
changed discussion status to
closed