Any plans to support keras3?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- keras, python
- Domain
- machine-learning
Research direction
Start by reproducing the failure in import_utils/keras3_import_test.py and trace the import through quantization/quantize_layers/helper.py and tensorflow_model_optimization/python/core/keras/compat.py. Map which tfmot features, including quantization, need Keras 3 support; done means the import test and the relevant features work with Keras 3 without the shown ModuleNotFoundError.
Written by the indexing model from the issue text.
Description
System information
- TensorFlow version (you are using): 2.12.0
- Are you willing to contribute it (Yes/No): Yes
Motivation
Keras3 is the latest version and it supports multiple backends including Pytorch.
Describe the feature
Supporting keras3 when using different tfmot features including quanitization.
Are there any plans to provide support for keras3? and what needs to be done to support it?
Currently running
import keras
import tensorflow_model_optimization as tfmot
fails with
======================================================================
ERROR: test_qat (__main__.KerasImportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File " import_utils/keras3_import_test.runfiles/nuro/learning/py_utils/import_utils/keras3_import_test.py", line 40, in test_qat
import learning.quantization.quantize_layers.helper as qat_helper
File " import_utils/keras3_import_test.runfiles/nuro/learning/quantization/quantize_layers/helper.py", line 4, in <module>
import tensorflow_model_optimization as tfmot
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/__init__.py", line 86, in <module>
from tensorflow_model_optimization.python.core.api import clustering
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/api/__init__.py", line 16, in <module>
from tensorflow_model_optimization.python.core.api import clustering
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/api/clustering/__init__.py", line 16, in <module>
from tensorflow_model_optimization.python.core.api.clustering import keras
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/api/clustering/keras/__init__.py", line 19, in <module>
from tensorflow_model_optimization.python.core.clustering.keras.cluster import cluster_scope
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/clustering/keras/cluster.py", line 22, in <module>
from tensorflow_model_optimization.python.core.clustering.keras import cluster_wrapper
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/clustering/keras/cluster_wrapper.py", line 23, in <module>
from tensorflow_model_optimization.python.core.clustering.keras import clustering_centroids
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/clustering/keras/clustering_centroids.py", line 22, in <module>
from tensorflow_model_optimization.python.core.keras.compat import keras
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/keras/compat.py", line 41, in <module>
keras = _get_keras_instance()
File " import_utils/keras3_import_test.runfiles/nuro/external/pypi__tensorflow_model_optimization_0_8_0/tensorflow_model_optimization/python/core/keras/compat.py", line 33, in _get_keras_instance
version_fn = getattr(tf.keras, 'version', None)
File " import_utils/keras3_import_test.runfiles/nuro/external/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 58, in __getattr__
module = self._load()
File " import_utils/keras3_import_test.runfiles/nuro/external/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 41, in _load
module = importlib.import_module(self.__name__)
File "external/local_config_python/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'keras.api'
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 349
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tensorflow/model-optimization
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
tensorflow/model-optimization#1301 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
tensorflow/model-optimization#1272 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 50/100
tensorflow/model-optimization#1270 · 2 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
tensorflow/model-optimization#1241 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
tensorflow/model-optimization#1182 · 1 comment ·
All issues in tensorflow/model-optimization
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·