need help to resolve this: Numpy is not available
RuntimeError Traceback (most recent call last)
in <cell line: 0>()
----> 1 res = model.chat(tokenizer, image_file, ocr_type='ocr')
4 frames
~/.cache/huggingface/modules/transformers_modules/ucaslcl/GOT-OCR2_0/979938bf89ccdc949c0131ddd3841e24578a4742/modeling_GOT.py in chat(self, tokenizer, image_file, ocr_type, ocr_box, ocr_color, render, save_render_file, print_prompt, gradio_input, stream_flag)
557 inputs = tokenizer([prompt])
558
--> 559 image_tensor_1 = image_processor_high(image)
560
561 input_ids = torch.as_tensor(inputs.input_ids).cuda()
~/.cache/huggingface/modules/transformers_modules/ucaslcl/GOT-OCR2_0/979938bf89ccdc949c0131ddd3841e24578a4742/modeling_GOT.py in call(self, item)
138 )
139 def call(self, item):
--> 140 return self.transform(item)
141
142
/usr/local/lib/python3.11/dist-packages/torchvision/transforms/transforms.py in call(self, img)
93 def call(self, img):
94 for t in self.transforms:
---> 95 img = t(img)
96 return img
97
/usr/local/lib/python3.11/dist-packages/torchvision/transforms/transforms.py in call(self, pic)
135 Tensor: Converted image.
136 """
--> 137 return F.to_tensor(pic)
138
139 def repr(self) -> str:
/usr/local/lib/python3.11/dist-packages/torchvision/transforms/functional.py in to_tensor(pic)
164 # handle PIL Image
165 mode_to_nptype = {"I": np.int32, "I;16": np.int16, "F": np.float32}
--> 166 img = torch.from_numpy(np.array(pic, mode_to_nptype.get(pic.mode, np.uint8), copy=True))
167
168 if pic.mode == "1":
RuntimeError: Numpy is not available
I have same issue.
try to add numpy in requirement.txt and install it. It may resolve your issue.
Solved by pip install numpy==1.26.4 --upgrade
.
Note that it needs numpy<2
otherwise raising another error.
Could you please update README.md file.