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

Tensorboard is not working #203

Closed
wsnoble opened this issue Jul 2, 2023 · 4 comments
Closed

Tensorboard is not working #203

wsnoble opened this issue Jul 2, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@wsnoble
Copy link
Contributor

wsnoble commented Jul 2, 2023

When I train a model with tensorboard turned on, I get a numpy error about mismatched dimensions:

casanovo --mode=train --config config.yaml --peak_path=target.train.100k.mgf --peak_path_val=target.train.100k.mgf
...
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

The full stderr output, as well as the input file and the config file, are attached. This same command works fine if I turn off tensorboard output in the config file.

stderr.txt
config.txt
target.train.100k.mgf.txt

@bittremieux bittremieux added the bug Something isn't working label Jul 3, 2023
@bittremieux
Copy link
Collaborator

Can you try to change metric_value in this line to metric_value.cpu() and see if it works then?

@wsnoble
Copy link
Contributor Author

wsnoble commented Jul 7, 2023

I tried this:

                   metric_value = metrics.get(key, np.nan)
                    if not np.isnan(metric_value):
                        self.tb_summarywriter.add_scalar(
                            descr, metric_value.cpu(), metrics["step"]
                        )

The behavior remains unchanged.

@cfmelend
Copy link
Contributor

cfmelend commented Jul 13, 2023

Was able to replicate this bug and prevent it from occurring with the same workaround that @wsnoble mentions in the original post (ie. remove the tb_summarywriter config parameter/set it to None).

@cfmelend cfmelend mentioned this issue Jul 14, 2023
@cfmelend cfmelend linked a pull request Jul 14, 2023 that will close this issue
@bittremieux
Copy link
Collaborator

Apparently it works on dev, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants