3dem / model-angelo

Automatic atomic model building program for cryo-EM maps
MIT License
110 stars 18 forks source link

KeyError when downloading original_no_seq weights #12

Closed cjroberts closed 1 year ago

cjroberts commented 1 year ago

Hi Model-Angelo Team,

I am following your instructions for setting up a shared install on our cluster. (I am trying in my own space first before doing a central install.)

Model-Angelo seems to install correctly and download the original bundle of weights successfully, but when it comes to downloading the original_no_seq bundle I get the following error:

Setting up bundle with name: original_no_seq for the first time.
Traceback (most recent call last):
  File "/gpfs2/well/rescomp/users/iub031/src/model-angelo/model_angelo/utils/setup_weights.py", line 17, in <module>
    model_dst = download_and_install_model(args.bundle_name)
  File "/well/rescomp/users/iub031/conda/skylake/envs/model_angelo/lib/python3.9/site-packages/model_angelo-0.0.1-py3.9.egg/model_angelo/utils/torch_utils.py", line 456, in download_and_install_model
    bundle_name_to_link[bundle_name],
KeyError: 'original_no_seq'

This occurs when sourcing the install script with the --download-weights option.

Please could you help?

KiSchnelle commented 1 year ago

Try replacing in the install script original_no_seq with original_no_sequence. Seems to be the correct key in the download_and_install_model function inside the torch_utils.py

bundle_name_to_link = {
        "original": "https://cloud.mrc-lmb.cam.ac.uk/s/syttED3Axgy2PY8/download/original.zip",
        "original_no_sequence": "https://cloud.mrc-lmb.cam.ac.uk/s/pd67QRmPXBkTJf9/download/original_no_sequence.zip",
        "small_gpu": "https://cloud.mrc-lmb.cam.ac.uk/s/MiTQZfm2o2QDGb5/download/small_gpu.zip",
    }
cjroberts commented 1 year ago

Thanks, @KiSchnelle. If I do this I get the following error after the download of the first file for original_nosequence:

Traceback (most recent call last):
  File "/gpfs2/well/rescomp/users/iub031/src/model-angelo/model_angelo/utils/setup_weights.py", line 17, in <module>
    model_dst = download_and_install_model(args.bundle_name)
  File "/well/rescomp/users/iub031/conda/skylake/envs/model_angelo/lib/python3.9/site-packages/model_angelo-0.0.1-py3.9.egg/model_angelo/utils/torch_utils.py", line 465, in download_and_install_model
    with open(os.path.join(dest, "success.txt"), "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/well/rescomp/users/iub031/model_angelo_weights/hub/checkpoints/model_angelo/original_no_sequence/success.txt'

Model-Angelo has created the directory /well/rescomp/users/iub031/model_angelo_weights/hub/checkpoints/model_angelo/original_no_seq.

There is also a reference to original_no_seq in model_angelo/apps/build_no_seq.py:

    advanced_args.add_argument(
        "--model-bundle-name",
        type=str,
        default="original_no_seq",
        help="Inference model bundle name",
    )

I will try changing the key in the dictionary inside torch_utils.py and check if that works.

jamaliki commented 1 year ago

Hi @cjroberts ,

Sorry, this is a bug I introduced on Friday. If you pull the new code, I have now fixed it. The fix commit is here: 11adfad5ce4890ba53ad3274461a8bfb164e1bf9

Thank you for using ModelAngelo!

Best, Kiarash.

KiSchnelle commented 1 year ago

Thanks!:)

If you run it step by step not with the install script and changed the key in the torch_utlis.py you got to do again the

setup.py install

so the model_angelo-0.0.1-py3.9.egg is build again with the changed code.

cheers Kilian

cjroberts commented 1 year ago

Thank you for the quick fix, @jamaliki!