Simply cannot run the example code.

#8
by FenixInDarkSolo - opened

The running machine is runpod's A40. (48G vram, 50G ram, 50GB storage)
I copy the example code and save it as test.py, then drag it on the runpod server.
Simply run it and get the error...

python test.py
Loading checkpoint shards: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7/7 [00:07<00:00,  1.01s/it]
Traceback (most recent call last):
  File "/workspace/test.py", line 32, in <module>
    output = model.generate_from_batch(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/root/.cache/huggingface/modules/transformers_modules/allenai/Molmo-7B-D-0924/b42b79548195a798866e64213a83e5b989074e69/modeling_molmo.py", line 2213, in generate_from_batch
    out = super().generate(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py", line 2048, in generate
    result = self._sample(
  File "/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py", line 3008, in _sample
    outputs = self(**model_inputs, return_dict=True)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/root/.cache/huggingface/modules/transformers_modules/allenai/Molmo-7B-D-0924/b42b79548195a798866e64213a83e5b989074e69/modeling_molmo.py", line 2107, in forward
    outputs = self.model.forward(
  File "/root/.cache/huggingface/modules/transformers_modules/allenai/Molmo-7B-D-0924/b42b79548195a798866e64213a83e5b989074e69/modeling_molmo.py", line 1869, in forward
    image_features, cls_embed = self.vision_backbone(images, image_masks)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/root/.cache/huggingface/modules/transformers_modules/allenai/Molmo-7B-D-0924/b42b79548195a798866e64213a83e5b989074e69/modeling_molmo.py", line 1378, in forward
    image_features, cls_embed = self.encode_image(images)
  File "/root/.cache/huggingface/modules/transformers_modules/allenai/Molmo-7B-D-0924/b42b79548195a798866e64213a83e5b989074e69/modeling_molmo.py", line 1346, in encode_image
    mask = ~torch.all(images.view(B * T, N, D) == -1, dim=(1, 2), keepdim=True)
TypeError: all() received an invalid combination of arguments - got (Tensor, keepdim=bool, dim=tuple), but expected one of:
 * (Tensor input, *, Tensor out)
      didn't match because some of the keywords were incorrect: keepdim, dim
 * (Tensor input, int dim, bool keepdim, *, Tensor out)
 * (Tensor input, name dim, bool keepdim, *, Tensor out)
Ai2 org

My guess this is because you are using an older version of torch, trying upgrading to 2.2 or later.

chrisc36 changed discussion status to closed

Sign up or log in to comment