broadinstitute / CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
https://cellbender.rtfd.io
BSD 3-Clause "New" or "Revised" License
297 stars 54 forks source link

issue running train.py AttributeError: module 'pyro.optim' has no attribute 'OneCycleLR' #221

Closed rLannes closed 1 year ago

rLannes commented 1 year ago

Hi,

I cannot manage to get CellBender to run. I tried to fix the error, but to no success do far.

Any help appreciated!

log:


cellbender:remove-background: Command:
cellbender remove-background --input ../cellRanger_count/L459_1554_S83_count/outs/raw_feature_bc_matrix.h5 --output L459_1554_S83_cellBender_ok.h5 --cuda --expected-cells 5000 --total-droplets-included 25000 --fpr 0.01 --epochs 150
cellbender:remove-background: 2023-05-22 14:00:04
cellbender:remove-background: Running remove-background
cellbender:remove-background: Loading data from file ../cellRanger_count/L459_1554_S83_count/outs/raw_feature_bc_matrix.h5
cellbender:remove-background: CellRanger v3 format
cellbender:remove-background: Trimming dataset for inference.
cellbender:remove-background: Including 15156 genes that have nonzero counts.
/lab/Software/cellbender/CellBender/cellbender/remove_background/data/dataset.py:1436: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
  empty_log_counts = mode(np.round(np.log1p(counts[counts > cut]),
cellbender:remove-background: Prior on counts in empty droplets is 1210
cellbender:remove-background: Prior on counts for cells is 5289
cellbender:remove-background: Excluding barcodes with counts below 605
cellbender:remove-background: Using 5000 probable cell barcodes, plus an additional 20000 barcodes, and 51931 empty droplets.
cellbender:remove-background: Largest surely-empty droplet has 1525 UMI counts.
Traceback (most recent call last):
  File "/lab/Software/conda_install_dir/envs/tf212/bin/cellbender", line 33, in <module>
    sys.exit(load_entry_point('cellbender', 'console_scripts', 'cellbender')())
  File "/lab/Software/cellbender/CellBender/cellbender/base_cli.py", line 101, in main
    cli_dict[args.tool].run(args)
  File "/lab/Software/cellbender/CellBender/cellbender/remove_background/cli.py", line 109, in run
    main(args)
  File "/lab/Software/cellbender/CellBender/cellbender/remove_background/cli.py", line 204, in main
    run_remove_background(args)
  File "/lab/Software/cellbender/CellBender/cellbender/remove_background/cli.py", line 166, in run_remove_background
    inferred_model = run_inference(dataset_obj, args)
  File "/lab/Software/cellbender/CellBender/cellbender/remove_background/train.py", line 298, in run_inference
    scheduler = pyro.optim.OneCycleLR(scheduler_args)
AttributeError: module 'pyro.optim' has no attribute 'OneCycleLR'
rLannes commented 1 year ago

I was on python 3.8 this explain why.

sjfleming commented 1 year ago

Yes, you already figured it out @rLannes . Just in case anyone else runs into this problem, the issue is that with the current version of pyro, the new pytorch 2.0 had changed something that broke pyro's ability to find the learning rate schedulers. This has already been fixed in a development branch of pyro, and so this might be fixed soon. However, for the time being we are still recommending the use of python 3.7, which will mean that pytorch will be on a version < 2.0.

Eventually I plan to move to python 3.8 so that we can use newer versions of pytorch (see #203 ).