Unable to use "mixed_float16" in Object detect API
@laxmareddyp がすでに取り組んでいます。
2024年6月2日 から。
評価
この issue はまだ評価されていません。
説明
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [√] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
- [√] I am reporting the issue to the correct repository. (Model Garden official or research directory)
- [√] I checked to make sure that this issue has not already been filed.
1. The entire URL of the file you are using
https://github.com/tensorflow/models/tree/master/research/object_detection
2. Describe the bug
I'm trying to use "mixed_float16" to speed up my training on RTX 4090. Following the guide of official document of mixed_precision , I add the code: mixed_precision.set_global_policy('mixed_float16') in front of tf.compat.v1.app.run() in my train_tf2.py. However, the tensorflow reborted the following error:
return _compute_losses_and_predictions_dicts(model, features, labels,
File "/root/miniconda3/lib/python3.8/site-packages/object_detection/model_lib_v2.py", line 130, in _compute_losses_and_predictions_dicts *
losses_dict = model.loss(
File "/root/miniconda3/lib/python3.8/site-packages/object_detection/meta_architectures/center_net_meta_arch.py", line 3967, in loss *
object_center_loss = self._compute_object_center_loss(
File "/root/miniconda3/lib/python3.8/site-packages/object_detection/meta_architectures/center_net_meta_arch.py", line 3099, in _compute_object_center_loss *
loss += object_center_loss(
File "/root/miniconda3/lib/python3.8/site-packages/object_detection/core/losses.py", line 94, in __call__ *
return self._compute_loss(prediction_tensor, target_tensor, **params)
File "/root/miniconda3/lib/python3.8/site-packages/object_detection/core/losses.py", line 855, in _compute_loss *
negative_loss = (tf.math.pow((1 - target_tensor), self._beta)*
TypeError: Input 'y' of 'Mul' Op has type float16 that does not match type float32 of argument 'x'.
I also tried to add this code: tf.compat.v2.keras.mixed_precision.set_global_policy('mixed_float16') , which I modified on the basis of tf.compat.v2.keras.mixed_precision.set_global_policy('mixed_bfloat16') found in the file model_lib_v2.py
or add Environment variables by os.environ['TF_ENABLE_AUTO_MIXED_PRECISION'] = '1', which was suggesd in this answer
But all of my attempt have failed with above error. I want to know how to solve this issue.
3. Steps to reproduce
add the code: mixed_precision.set_global_policy('mixed_float16') in front of tf.compat.v1.app.run() in my train_tf2.py.
4. Expected behavior
The model can be trained in "mixed precision" mode.
5. Additional context
None
6. System information
- OS Platform and Distribution : Linux Ubuntu 22.04
- TensorFlow installed from (source or binary): source
- TensorFlow version (use command below): 2.13.1
- Python version: 3.8.10
- CUDA/cuDNN version: 12.2(cuda) / 8.6.0.163(cudnn)
- GPU model and memory: NVIDIA GeForce RTX 4090 24G
- 主要言語
- Python
- スター
- 77.6k
- フォーク
- 44.8k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tensorflow/models のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
tensorflow/models#13653 ·
-
object_detection_tutorial.ipynb pretrained model "resnet50 imagenet"再び着手できるかも @laxmareddyp が 202 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンtype:support
tensorflow/models#13634 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
-
Tag version compatible with Tensorflow 2.20再び着手できるかも @bharatjetti が 277 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンmodels:official type:bug
tensorflow/models#13607 · コメント 1 件 · 担当者 1 名 ·
-
models:research type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
tensorflow/models#13600 ·
-
Installation Issues on Python 3.13再び着手できるかも @bharatjetti が 246 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンmodels:official type:bug
tensorflow/models#13587 · コメント 9 件 · 担当者 1 名 ·
tensorflow/models の issue をすべて見る
似ている issue
-
cli good first issue help wanted python up-for-grabs
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
andrewsiah/agentswarm-data-tasks#36 ·
メンテナーはふだん 1 日以内に返信
-
bug drawing-tools
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
cofade/open-garden-planner#827 ·
メンテナーはふだん 1 日以内に返信
-
Methodology pageオープンdocumentation site texts
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
Krasnopjorovs/temet#66 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信