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

Fix exception loading checkpoint #345

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

alecw
Copy link
Contributor

@alecw alecw commented Apr 1, 2024

Addresses the following exception that occurs when re-running with a machine with more memory:

cellbender:remove-background: Running inference...
Traceback (most recent call last):
  File "/opt/conda/bin/cellbender", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/cellbender/base_cli.py", line 123, in main
    cli_dict[args.tool].run(args)
  File "/opt/conda/lib/python3.7/site-packages/cellbender/remove_background/cli.py", line 185, in run
    return main(args)
  File "/opt/conda/lib/python3.7/site-packages/cellbender/remove_background/cli.py", line 219, in main
    posterior = run_remove_background(args)
  File "/opt/conda/lib/python3.7/site-packages/cellbender/remove_background/run.py", line 113, in run_remove_background
    inferred_model, _, _, _ = run_inference(dataset_obj=dataset_obj, args=args)
  File "/opt/conda/lib/python3.7/site-packages/cellbender/remove_background/run.py", line 768, in run_inference
    final_elbo_fail_fraction=args.final_elbo_fail_fraction)
  File "/opt/conda/lib/python3.7/contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "/opt/conda/lib/python3.7/site-packages/cellbender/remove_background/train.py", line 248, in run_training
    best_test_elbo = max(test_elbo)
ValueError: max() arg is an empty sequence

Note that I don't understand the checkpoint code very well, so there may be a cleaner way to do this. I simply eliminated the test_elbo local variable and refer to the list stored in the model directly.

Also, html generation was failing because the way lxml.html.clean needs to be installed has changed, so DockerfileGit contains a fix for that.

@sjfleming
Copy link
Member

This seems like a reasonable fix to me, thanks!

I'm including the lxml_html_clean package as a dependency in requirements.txt in #347 , so I think I would just want your first commit, but not this one: 09646e6

@alecw
Copy link
Contributor Author

alecw commented Apr 10, 2024

OK, I just removed the lxml_html_clean commit.

@sjfleming
Copy link
Member

Looks good to me, thank you @alecw !

@sjfleming sjfleming merged commit 72e6a3f into broadinstitute:dev Apr 22, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants