
이 에러는 모델이 float32 데이터 타입을 사용하지만, 실제로 float64 데이터 타입을 사용하고 있기 때문입니다.
해결 방법은 다음과 같습니다:
1. 모델을 로드할 때 float64 데이터 타입을 사용하도록 설정합니다.
#hostingforum.kr
python
model.load_weights('model.h5', dtype='float64')
2. 모델을 로드한 후, 모든 레이어의 데이터 타입을 float32로 변경합니다.
#hostingforum.kr
python
for layer in model.layers:
layer.dtype = tf.float32
3. 모델을 로드한 후, 모든 레이어의 데이터 타입을 float64로 변경합니다.
#hostingforum.kr
python
for layer in model.layers:
layer.dtype = tf.float64
4. 모델을 로드한 후, 모든 레이어의 데이터 타입을 float32로 변경하고, tf.keras.mixed_precision.experimental.DynamicLossScaling을 사용합니다.
#hostingforum.kr
python
from tensorflow.keras.mixed_precision import experimental as mixed_precision
policy = mixed_precision.Policy('mixed_float16')
mixed_precision.set_global_policy(policy)
for layer in model.layers:
layer.dtype = tf.float32
5. 모델을 로드한 후, 모든 레이어의 데이터 타입을 float64로 변경하고, tf.keras.mixed_precision.experimental.DynamicLossScaling을 사용합니다.
#hostingforum.kr
python
from tensorflow.keras.mixed_precision import experimental as mixed_precision
policy = mixed_precision.Policy('mixed_float16')
mixed_precision.set_global_policy(policy)
for layer in model.layers:
layer.dtype = tf.float64
이러한 방법 중 하나를 사용하면, mb_scrub 관련된 에러를 해결할 수 있습니다.
2025-07-13 14:31