Coder Social home page Coder Social logo

Comments (6)

Star9daisy avatar Star9daisy commented on May 18, 2024 1

Hi @veb-101, the MobileViT_v1_Block you create in colab looks similar to an official example here:
https://keras.io/examples/vision/image_classification_with_vision_transformer/

The calculation process is almost the same. So I compare yours with those in it. In short, you could change the following lines to make your codes work:

# Comment out this line
# self.patch_size_h, self.patch_size_w = kops.cast(self.patch_size_h, dtype="int32"), kops.cast(self.patch_size_w, dtype="int32")

# Replace ops.floor_divide with //
# n_patches_h = ops.floor_divide(height, self.patch_size_h)
# n_patches_w = ops.floor_divide(width, self.patch_size_w)
n_patches_h = height // self.patch_size_h
n_patches_w = width // self.patch_size_w

from keras.

veb-101 avatar veb-101 commented on May 18, 2024

Update: Unfortunately it's not working anymore on Colab as well.

colab link

Edit: Works properly with PyTorch and TensorFlow backend on Colab and local Windows machine.

from keras.

google-ml-butler avatar google-ml-butler commented on May 18, 2024

Are you satisfied with the resolution of your issue?
Yes
No

from keras.

veb-101 avatar veb-101 commented on May 18, 2024

I've simplified the Colab code further and added print statements for debugging. The code fails all the time on the reshape(...) function, and if I skip reshaping, then the transpose fails with the same error.

Shapes must be 1D sequences of concrete values of integer type, got (None, 32, 32, 144).

from keras.

veb-101 avatar veb-101 commented on May 18, 2024

@Star9daisy Thanks, it works. I was able to complete my first pretrained model port to Keras 3 finally

Such a small solution, and I was doing something extreme.

from keras.

google-ml-butler avatar google-ml-butler commented on May 18, 2024

Are you satisfied with the resolution of your issue?
Yes
No

from keras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.