Skip to content

Commit 2015d65

Browse files
authored
Merge pull request #123 from aws-neuron/fazhangm/fix/hf_pretrained_clip_large_inference_on_inf2
fix: Fix the error tuple' object has no attribute 'pooler_output' in hf_pretrained_clip_large_inference_on_inf2.ipynb
2 parents f532a05 + f06246b commit 2015d65

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

torch-neuronx/inference/hf_pretrained_clip_large_inference_on_inf2.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"\n",
9595
"# Create the input preprocessor and model\n",
9696
"processor = CLIPProcessor.from_pretrained(model_name)\n",
97-
"model = CLIPModel.from_pretrained(model_name, return_dict=False)\n",
97+
"model = CLIPModel.from_pretrained(model_name, return_dict=True)\n",
9898
"model.eval()\n",
9999
"\n",
100100
"# Get text captions for the model to classify the image against\n",
@@ -146,7 +146,7 @@
146146
"output_neuron = model_neuron(*example)\n",
147147
"\n",
148148
"# Compare the results\n",
149-
"cpu_top5 = output_cpu[0][0].softmax(dim=-1).topk(5)\n",
149+
"cpu_top5 = output_cpu.logits_per_image[0].softmax(dim=-1).topk(5)\n",
150150
"neuron_top5 = output_neuron[0][0].softmax(dim=-1).topk(5)\n",
151151
"\n",
152152
"print('CPU top 5 classifications')\n",

0 commit comments

Comments
 (0)