Comments (6)
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.
Update: Unfortunately it's not working anymore on Colab as well.
Edit: Works properly with PyTorch and TensorFlow backend on Colab and local Windows machine.
from keras.
Are you satisfied with the resolution of your issue?
Yes
No
from keras.
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.
@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.
Are you satisfied with the resolution of your issue?
Yes
No
from keras.
Related Issues (20)
- To Keras community: What interpretations do you have for these curves? HOT 3
- No module named 'keras.src.engine' HOT 7
- Feature request: keras.ops.linalg.lstsq HOT 4
- Example Doubt HOT 3
- More Customisation in utils.ProgBar HOT 6
- Progress bar crash when empty dataset HOT 1
- Multihead Attention Seed Specification HOT 1
- Unable to make two instances of the MobileNetV3 within the same model HOT 2
- NumPy 2.0 support HOT 3
- Add backend-agnostic worker-process data loading HOT 8
- Keras does not save weights properly HOT 2
- Potential bug in legacy h5 weights loading. HOT 2
- Enable Discussions Tab in Github HOT 1
- FeatureSpace multiple output from one input HOT 3
- `keras.Sequential` sometimes states misleading reason for failing to construct model HOT 2
- Implement tool for saved Keras model file inspection, diff, and patching. HOT 5
- Request for a map function like map_fn in TF and vmap in Jax HOT 5
- AttributeError raised: 'list' object has no attribute 'dtype' when running the official example of SparseCategoricalAccuracy, TopKCategoricalAccuracy, SparseTopKCategoricalAccuracy HOT 2
- ValueError: (F1Score|FBetaScore) expects 2D inputs with shape (batch_size, output_dim).
- `plot_model` does not work for all models in `keras.applications` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras.