Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF2.5 class_weight error #162

Open
Pengling2022 opened this issue Nov 17, 2023 · 0 comments
Open

TF2.5 class_weight error #162

Pengling2022 opened this issue Nov 17, 2023 · 0 comments

Comments

@Pengling2022
Copy link

Dear Dr. S.Mostafa Mousavi,
hello!

I have encountered some tough problems in the process of trying to improve EQTransformer. I hope to get your reply.

I can successfully run Tensorflow=2.0.0+EQTransformer=0.1.59, but I can't use the GPU because my GPU is RTX3060

It is found that RTX3060 only supports CUDA>=11.1, in which case Tensorflow>=2.4 is required. An error occurs when I try to use Tensorflow=2.5.0+EQTransformer=0.1.61: class_weight is only supported for Models with a single output.

The specific location of the error is:
trainer.py
history = model.fit_generator(generator=training_generator,
validation_data=validation_generator,
use_multiprocessing=args['use_multiprocessing'],
workers=multiprocessing.cpu_count(),
callbacks=callbacks,
epochs=args['epochs'],
class_weight={0: 0.11, 1: 0.89})
data_adapter.py
def _class_weights_map_fn(*data):
"""Convert class_weight to sample_weight."""
x, y, sw = unpack_x_y_sample_weight(data)

if nest.is_nested(y):
raise ValueError(
"class_weight is only supported for Models with a single output.")

I inquired the source code and found that this error was actually caused by TF update, but I had to use GPU again, so is there any good solution? Did you encounter this error with TF=2.5.0?

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant