Closed onefish51 closed 1 year ago
fixed it by:
gradcam_np = gradcam[0][1].numpy().astype(np.float32)
avg_gradcam = getAttMap(norm_img, gradcam_np, blur=True)
Seems to be a pytorch-related issue: https://github.com/pytorch/pytorch/issues/2246.
try to transformer the data to numpy, works fine.
通过以下方式修复它:
gradcam_np = gradcam[0][1].numpy().astype(np.float32) avg_gradcam = getAttMap(norm_img, gradcam_np, blur=True)
projects/img2llm-vqa/img2llm_vqa.py resized_img = raw_image.resize((int(w scaling_factor), int(h scaling_factor))) norm_img = np.float32(resized_img) / 255 gradcam = samples['gradcams'].reshape(24,24)
avg_gradcam = getAttMap(norm_img, gradcam, blur=True) An error is also reported here, why? Connot interpret 'torch.float32' as a data type
when I tested
examples/blip2_instructed_generation.ipynb
a error occurred :