[Discussion] successfull tf2 automatic upgrade
- Dominant language
- Python
- Stars
- 28.4k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Just wanted to let you know that I upgraded spleeter with tensorflow 2 using `tf_upgrade_v2 --intree ./ --outtree ./ --reportfile report.txt` from `tf2` branch and it is working fine.
Of course the script just replace older function by `tf.compat.v1` so it is not the most optimal option..
Here is the report:
```
TensorFlow 2.0 Upgrade Script
-----------------------------
Converted 31 files
Detected 3 issues that require attention
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
File: ./spleeter/separator.py
--------------------------------------------------------------------------------
./spleeter/separator.py:325:16: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
File: ./tests/test_ffmpeg_adapter.py
--------------------------------------------------------------------------------
./tests/test_ffmpeg_adapter.py:79:8: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
File: ./tests/test_eval.py
--------------------------------------------------------------------------------
./tests/test_eval.py:68:12: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
================================================================================
Detailed log follows:
================================================================================
================================================================================
Input tree: './'
================================================================================
--------------------------------------------------------------------------------
Processing file './setup.py'
outputting to './setup.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/dataset.py'
outputting to './spleeter/dataset.py'
--------------------------------------------------------------------------------
176:20: INFO: Added keywords to args of function 'tf.shape'
241:53: INFO: Renamed 'tf.string_join' to 'tf.strings.join'
256:19: INFO: Added keywords to args of function 'tf.reduce_min'
257:16: INFO: Added keywords to args of function 'tf.shape'
266:15: INFO: Added keywords to args of function 'tf.reduce_any'
267:12: INFO: Added keywords to args of function 'tf.shape'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/__init__.py'
outputting to './spleeter/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/__main__.py'
outputting to './spleeter/__main__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/separator.py'
outputting to './spleeter/separator.py'
--------------------------------------------------------------------------------
325:16: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/resources/__init__.py'
outputting to './spleeter/resources/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/utils/configuration.py'
outputting to './spleeter/utils/configuration.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/utils/logging.py'
outputting to './spleeter/utils/logging.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/utils/__init__.py'
outputting to './spleeter/utils/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/utils/tensor.py'
outputting to './spleeter/utils/tensor.py'
--------------------------------------------------------------------------------
46:19: INFO: Added keywords to args of function 'tf.shape'
72:17: INFO: Added keywords to args of function 'tf.reduce_min'
73:17: INFO: Added keywords to args of function 'tf.reduce_max'
115:35: INFO: Added keywords to args of function 'tf.shape'
117:13: INFO: Added keywords to args of function 'tf.pad'
120:13: INFO: Added keywords to args of function 'tf.shape'
124:35: INFO: Added keywords to args of function 'tf.shape'
135:17: INFO: Added keywords to args of function 'tf.shape'
140:16: INFO: Added keywords to args of function 'tf.shape'
178:53: INFO: Added keywords to args of function 'tf.shape'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/utils/estimator.py'
outputting to './spleeter/utils/estimator.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/__init__.py'
outputting to './spleeter/model/__init__.py'
--------------------------------------------------------------------------------
221:22: INFO: Added keywords to args of function 'tf.reduce_mean'
226:22: INFO: Added keywords to args of function 'tf.reduce_mean'
227:20: INFO: Added keywords to args of function 'tf.reduce_mean'
227:20: INFO: Renamed keyword argument for tf.reduce_mean from keep_dims to keepdims
236:15: INFO: Added keywords to args of function 'tf.reduce_sum'
278:27: INFO: Added keywords to args of function 'tf.transpose'
280:20: INFO: Added keywords to args of function 'tf.transpose'
335:12: INFO: Added keywords to args of function 'tf.transpose'
341:19: INFO: Added keywords to args of function 'tf.transpose'
343:24: INFO: Added keywords to args of function 'tf.shape'
362:30: INFO: Added keywords to args of function 'tf.shape'
388:28: INFO: Added keywords to args of function 'tf.reduce_mean'
392:25: INFO: Added keywords to args of function 'tf.shape'
412:21: INFO: Added keywords to args of function 'tf.reduce_sum'
425:24: INFO: Added keywords to args of function 'tf.shape'
433:31: INFO: Added keywords to args of function 'tf.shape'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/provider/__init__.py'
outputting to './spleeter/model/provider/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/provider/github.py'
outputting to './spleeter/model/provider/github.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/functions/blstm.py'
outputting to './spleeter/model/functions/blstm.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/functions/__init__.py'
outputting to './spleeter/model/functions/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/model/functions/unet.py'
outputting to './spleeter/model/functions/unet.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/audio/adapter.py'
outputting to './spleeter/audio/adapter.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/audio/__init__.py'
outputting to './spleeter/audio/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/audio/ffmpeg.py'
outputting to './spleeter/audio/ffmpeg.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/audio/spectrogram.py'
outputting to './spleeter/audio/spectrogram.py'
--------------------------------------------------------------------------------
37:18: INFO: Added keywords to args of function 'tf.transpose'
39:12: INFO: Added keywords to args of function 'tf.transpose'
62:8: INFO: Added keywords to args of function 'tf.shape'
64:8: INFO: Added keywords to args of function 'tf.shape'
65:14: INFO: Removed argument align_corners for function tf.image.resize_images
65:14: INFO: Renamed 'tf.image.resize_images' to 'tf.image.resize'
70:11: INFO: Renamed 'tf.image.resize_image_with_crop_or_pad' to 'tf.image.resize_with_crop_or_pad'
83:13: INFO: Renamed 'tf.random_uniform' to 'tf.random.uniform'
102:8: INFO: Added keywords to args of function 'tf.shape'
103:8: INFO: Added keywords to args of function 'tf.shape'
105:14: INFO: Removed argument align_corners for function tf.image.resize_images
105:14: INFO: Renamed 'tf.image.resize_images' to 'tf.image.resize'
111:11: INFO: Added keywords to args of function 'tf.pad'
125:21: INFO: Renamed 'tf.random_uniform' to 'tf.random.uniform'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/audio/convertor.py'
outputting to './spleeter/audio/convertor.py'
--------------------------------------------------------------------------------
26:11: INFO: Added keywords to args of function 'tf.cond'
27:8: INFO: Added keywords to args of function 'tf.shape'
74:25: INFO: Added keywords to args of function 'tf.reduce_max'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/commands/evaluate.py'
outputting to './spleeter/commands/evaluate.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/commands/__init__.py'
outputting to './spleeter/commands/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/commands/separate.py'
outputting to './spleeter/commands/separate.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './spleeter/commands/train.py'
outputting to './spleeter/commands/train.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './tests/test_github_model_provider.py'
outputting to './tests/test_github_model_provider.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './tests/__init__.py'
outputting to './tests/__init__.py'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './tests/test_ffmpeg_adapter.py'
outputting to './tests/test_ffmpeg_adapter.py'
--------------------------------------------------------------------------------
79:8: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './tests/test_separator.py'
outputting to './tests/test_separator.py'
--------------------------------------------------------------------------------
45:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
66:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
83:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
101:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Processing file './tests/test_eval.py'
outputting to './tests/test_eval.py'
--------------------------------------------------------------------------------
68:12: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
```
Contributor guide
Research direction
Start by reviewing the tf2 branch and the tf_upgrade_v2 report, then inspect the listed files, especially spleeter/separator.py and spleeter/model/__init__.py. Run the reported tests, including tests/test_ffmpeg_adapter.py and tests/test_eval.py; done means TensorFlow 2 compatibility is confirmed and the three manual-check warnings have been addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100