Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input multiple sequences per image #17

Open
qihao067 opened this issue Sep 14, 2022 · 1 comment
Open

Input multiple sequences per image #17

qihao067 opened this issue Sep 14, 2022 · 1 comment

Comments

@qihao067
Copy link

qihao067 commented Sep 14, 2022

Hello, fantastic work on Pix2seq v1 and v2.

I have a question regarding handling multiple sequences for one image. In the following code, it seems that we can input multiple sequences by using a tensor with size (bsz, instances, seqlen). The current version use seq with size (bsz, seqlen).

seq: `int` sequence in shape of (bsz, seqlen),

or (bsz, instances, seqlen) if there are multiple sequences per image.

(https://github.com/google-research/pix2seq/blob/6d45f77fcbb1905aca3e42678a2a079907ad17d0/models/ar_model.py#L84-#L85)

I tried this but it failed:

`ValueError: Exception encountered when calling layer "ar_decoder" " f"(type AutoregressiveDecoder).

    in user code:
    
        File "/pix2seq/architectures/transformers.py", line 684, in call  *
            _, seqlen = get_shape(tokens)
    
        ValueError: too many values to unpack (expected 2)
    
    
    Call arguments received by layer "ar_decoder" "                 f"(type AutoregressiveDecoder):
      • tokens=tf.Tensor(shape=(32, 3, 500), dtype=int64)
      • encoded=tf.Tensor(shape=(32, 1600, 512), dtype=float32)
      • training=True


Call arguments received by layer "model" "                 f"(type Model):
  • images=tf.Tensor(shape=(32, 640, 640, 3), dtype=float32)
  • seq=tf.Tensor(shape=(32, 500), dtype=int64)
  • training=True`

Do you have any idea? Have you tried to use multiple sequences and how to do that?

Thank you!!!

@chentingpc
Copy link
Collaborator

chentingpc commented Sep 15, 2022 via email

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

No branches or pull requests

2 participants