Urinx / alphafold_pytorch

An implementation of the DeepMind's AlphaFold based on PyTorch for research
Apache License 2.0
392 stars 92 forks source link

New error TypeError: 'torch.Device' object is not callable #4

Closed pentadotddot closed 4 years ago

pentadotddot commented 4 years ago

Thank you for the quick update of the code, but still (at least for my configuration) it doesn't work with gpu, running with updated scripts with ./alphafold.sh:

Saving output to T1019s2_out/

Launching model: D 0 Launching model: B 0 Launching model: T 0 Launching model: D 1 Launching model: B 1 Launching model: D 2 Launching model: B 2 Launching model: D 3 Launching model: B 3 All models running, waiting for them to complete

Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Background/2 Background model: tf_model_path/916425 Replica: 2 Device: cuda Model parameters: 1091392 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Background/1 Background model: tf_model_path/916425 Replica: 1 Device: cuda Model parameters: 1815936 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Background/3 Background model: tf_model_path/916425 Replica: 3 Device: cuda Model parameters: 1924992 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Background/0 Background model: tf_model_path/916425 Replica: 0 Device: cuda Model parameters: 1029568 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): File "alphafold.py", line 223, in Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Distogram/1 Distogram model: tf_model_path/873731 Replica: 1 Device: cuda Model parameters: 21182345 run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Distogram/0 Distogram model: tf_model_path/873731 Replica: 0 Device: cuda Model parameters: 21182345 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): File "alphafold.py", line 223, in Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Distogram/2 Distogram model: tf_model_path/873731 Replica: 2 Device: cuda Model parameters: 22381993 run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable Traceback (most recent call last): Input file: test_data/T1019s2.pkl Output dir: T1019s2_out/Distogram/3 Distogram model: tf_model_path/873731 Replica: 3 Device: cuda Model parameters: 22381993 File "alphafold.py", line 223, in run_eval(TARGET_PATH, MODEL_PATH, REPLICA, OUT_DIR, DEVICE) File "alphafold.py", line 18, in run_eval model.load_state_dict(torch.load(model_file, map_location=device)) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 469, in _load result = unpickler.load() File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 437, in persistent_load data_type(size), location) File "/scratch/domeemod/anaconda3/envs/pytorch_env/lib/python3.6/site-packages/torch/serialization.py", line 323, in restore_location result = map_location(storage, location) TypeError: 'torch.Device' object is not callable

My config: pytorch conda env with pytorch 1.4, tensorflow-gpu 2.1, Nvidia Geforce 1070GTX:

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 430.26 Driver Version: 430.26 CUDA Version: 10.2 | |-------------------------------+----------------------+----------------------+

pentadotddot commented 4 years ago

Sorry my bad, I did not have pytorch 1.4 but 0.4, so when I updated it worked:)