bunnech / cellot

Learning Single-Cell Perturbation Responses using Neural Optimal Transport
BSD 3-Clause "New" or "Revised" License
109 stars 9 forks source link

Request to add commands to run Crossspecies and GBM Dataset #20

Closed Anzoteh96 closed 3 months ago

Anzoteh96 commented 4 months ago

The script in scripts/submit/iid.sh doesn't seem to have any command to run the crossspecies dataset. When I tried running

python ./scripts/train.py --outdir ./results/scrna-crossspecies/model-cellot --config ./configs/tasks/crossspecies.yaml --config ./configs/models/cellot.yaml 

it returns the following result:

Traceback (most recent call last):
  File "[repo_name]/./scripts/train.py", line 80, in <module>
    main(sys.argv)
  File "[repo_name]/./scripts/train.py", line 64, in main
    train(outdir, config)
  File "[repo_name]/cellot/train/train.py", line 129, in train_cellot
    gl = compute_loss_g(f, g, source).mean()
  File "[repo_name]/cellot/models/cellot.py", line 102, in compute_loss_g
    transport = g.transport(source)
  File "[repo_name]/cellot/networks/icnns.py", line 97, in transport
    (output,) = autograd.grad(
  File "/state/partition1/llgrid/pkg/anaconda/python-LLM-2023b/lib/python3.10/site-packages/torch/autograd/__init__.py", line 288, in grad
    grad_outputs_ = _make_grads(t_outputs, grad_outputs_, is_grads_batched=is_grads_batched)
  File "/state/partition1/llgrid/pkg/anaconda/python-LLM-2023b/lib/python3.10/site-packages/torch/autograd/__init__.py", line 71, in _make_grads
    raise RuntimeError("Mismatch in shape: grad_output["
RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([256, 1]) and output[0] has a shape of torch.Size([256, 1, 1]).

A similar outcome is produced when I tried running the following for GBM dataset.

python ./scripts/train.py --outdir ./results/scrna-gbm/model-cellot --config ./configs/tasks/gbm.yaml --config ./configs/models/cellot.yaml 
suxiaoman666888 commented 4 months ago

Excuse me, can you read this file “scrna-crossspecies/hvg-train-only.h5ad” successfully? i tried but failed. thanks.

bunnech commented 4 months ago

Did you run the autoencoder properly and load the right models?

suxiaoman666888 commented 4 months ago

So excited to receive your reply,thanks.i haven't run the model yet,i want to see the data first,and i used the anndata to read this data,but i failed. By the way, I read another file (cl-8h/4i-melanoma_cell_lines-8h.h5ad)successfully by using the same way.

image

bunnech commented 4 months ago

As I mentioned, this might be due to different versions of scanpy and anndata. Please check to potentially try latest version.

Anzoteh96 commented 4 months ago

Also one question -- how do we set the species we want to train/test for the scrna-crossspecies dataset? E.g. should we modify the datasplit.subset.species field in configs/tasks/crossspecies.yaml and datasplit.holdout field in configs/tasks/crossspecies-ood.yaml?

Would be nice if this information can be added to README (or elsewhere).

bunnech commented 4 months ago

Yes