Closed freke closed 2 weeks ago
Hi, @freke thank you for bringing this to our attention.
The issue was that Google Colab's default TensorFlow version was recently updated to 2.17, while MCT supports versions up to 2.15.x. We resolved this in #1154 by updating the package version verification process.
This update will be included in MCT v2.2.0. In the meantime, you can use pip install mct-nightly
instead of pip install model-compression-toolkit
.
Issue Type
Bug
Source
pip (model-compression-toolkit)
MCT Version
Running on Google Colab
OS Platform and Distribution
Running on Google Colab
Python version
3.10
Describe the issue
Error trying to run the example in colab, get the error "cannot import name 'TFOpLambda' from 'keras.src.layers.core'" Most if not all PyTorch examples have the same issue, same error as #1144 (for Keras)
Expected behaviour
To be able to run the example code with out issues.
Code to reproduce the issue
Log output
ImportError Traceback (most recent call last) in <cell line: 1>()
----> 1 import model_compression_toolkit as mct
2 from model_compression_toolkit.core.pytorch.pytorch_device_config import get_working_device
3 from timm.data import create_loader, resolve_data_config
4 from typing import Iterator, Tuple, List
5 import torchvision
8 frames /usr/local/lib/python3.10/dist-packages/model_compression_toolkit/core/keras/back2framework/keras_model_builder.py in
23 if version.parse(tf.version) >= version.parse("2.13"):
24 from keras import Input
---> 25 from keras.src.layers.core import TFOpLambda
26 from keras.src.engine.base_layer import TensorFlowOpLayer, Layer
27 else:
ImportError: cannot import name 'TFOpLambda' from 'keras.src.layers.core' (/usr/local/lib/python3.10/dist-packages/keras/src/layers/core/init.py)