I have trained a model in the Week 3 assessment of Advanced Computer Vision with TensorFlow and I have saved it as temp_model.h5
Now I need to downgrade Keras and TensorFlow in Google Colab to convert the model to a version that the grader understands
I run the
!pip install tensorflow==2.8.0 --quiet
!pip install keras==2.8.0 --quiet
and the output seems OK. I do “Runtime > Restart Session”. Then I run the code to check the downgrade
import tensorflow as tf
Check if you have the correct Tensorflow version
assert tf.version == ‘2.8.0’, f’You have TF{tf.version}. Please install the grader-compatible Tensorflow and select Runtime > Restart Session’
I get an error - but not an AssertionError - a TypeError - and it’s triggering on the line “import tensorflow as tf”
TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 import tensorflow as tf
2
3 # Check if you have the correct Tensorflow version
4 assert tf.version == ‘2.8.0’, f’You have TF{tf.version}. Please install the grader-compatible Tensorflow and select Runtime > Restart Session’
8 frames
/usr/local/lib/python3.10/dist-packages/google/protobuf/descriptor.py in new(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
551 has_default_value=True, containing_oneof=None, json_name=None,
552 file=None, create_key=None): # pylint: disable=redefined-builtin
→ 553 _message.Message._CheckCalledFromGeneratedFile()
554 if is_extension:
555 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: Changes announced May 6, 2022 | Protocol Buffers Documentation
Can anyone help?
Thanks,
Chris