Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

TypeError: 'int' object is not subscriptable #23

Open
M-Amrollahi opened this issue Nov 27, 2022 · 8 comments
Open

TypeError: 'int' object is not subscriptable #23

M-Amrollahi opened this issue Nov 27, 2022 · 8 comments

Comments

@M-Amrollahi
Copy link

I have just run the colab and install the requirements. How can I resolve this?

TypeError                                 Traceback (most recent call last)
[<ipython-input-16-75c695310352>](https://localhost:8080/#) in <module>
     20 
     21 # Restore checkpoint.
---> 22 model = model_lib.Model(config)
     23 checkpoint = tf.train.Checkpoint(
     24     model=model, global_step=tf.Variable(0, dtype=tf.int64))

[/content/pix2seq/models/ar_model.py](https://localhost:8080/#) in __init__(self, config, **kwargs)
     50     else:
     51       self.encoder = ResNetTransformer(
---> 52           config.image_size[0], config.image_size[1], config.resnet_variant,
     53           config.resnet_depth, config.resnet_width_multiplier,
     54           config.resnet_sk_ratio, config.num_encoder_layers, config.dim_att,

TypeError: 'int' object is not subscriptable
@hesamira
Copy link

Hi,
I have also faced this error.
Please, help us.
Thanks.

@chentingpc
Copy link
Contributor

Looks like the image size should be a tuple instead of int, eg (320, 320) instead of 320. can you try to modify that and see if that works?

@M-Amrollahi
Copy link
Author

That solves the issue.

But I do not see any bbox on the result. The image and result are the same and there is no bbox or label on the image.

@saxenasaurabh
Copy link
Contributor

Updating the image_size seems to work for me. This is what I tried:

del config.model.image_size
del config.task.image_size
del config.tasks[0]["image_size"]

config.model.image_size = (640, 640)
config.task.image_size = (640, 640)
config.tasks[0]["image_size"] = (640, 640)

@shamitb
Copy link

shamitb commented Mar 18, 2023

Still doesnt work for me tried to make the image_size a tuple:
config.model.image_size = (640, 640)

@shamitb
Copy link

shamitb commented Mar 19, 2023

With above changes I get this error:


TypeError Traceback (most recent call last)
in
28
29 # Restore checkpoint.
---> 30 model = model_lib.Model(config)
31 checkpoint = tf.train.Checkpoint(
32 model=model, global_step=tf.Variable(0, dtype=tf.int64))

10 frames
/usr/local/lib/python3.9/dist-packages/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
513 for kwarg in kwargs:
514 if kwarg not in allowed_kwargs:
--> 515 raise TypeError(error_message, kwarg)
516
517

TypeError: ('Keyword argument not understood:', 'synchronized')

@saxenasaurabh
Copy link
Contributor

@shamitb could you please paste the full stacktrace?

@bruce2233
Copy link

same error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants