HeliXonProtein / OmegaFold

OmegaFold Release Code
Apache License 2.0
532 stars 75 forks source link

'Unsupported datatype for constant' when trying to run on a M1 Pro #36

Open cdsnow opened 1 year ago

cdsnow commented 1 year ago

Hi there,

I installed on a M1 Pro machine with 32GB memory like so: conda create --name omega conda activate omega conda install ipython conda install biopython git clone https://github.com/HeliXonProtein/OmegaFold cd OmegaFold ipython setup.py install

and ran into the following error:

(omega) csnow@blizzard tmp % omegafold test_0.fasta test_0_omega INFO:root:Loading weights from /Users/csnow/.cache/omegafold_ckpt/model.pt INFO:root:Constructing OmegaFold INFO:root:Reading test_0.fasta INFO:root:Predicting 1th chain in test_0.fasta INFO:root:86 residues in this chain. /AppleInternal/Library/BuildRoots/560148d7-a559-11ec-8c96-4add460b61a6/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:343: failed assertion `unsupported datatype for constant'

RuiWang1998 commented 1 year ago

Hi!

Thanks for your interests! The support for Apple Silicons has been on beta/prototype from PyTorch, which may have created some issues with our code. We have been looking for solutions, stay tuned!

pb3lab commented 1 year ago

Just to add onto ongoing issues with M1, here is my installation on a MacBook Pro (13-inch, M1, 2020) and the error during a test run with a 45-residue protein

INSTALLATION conda create --name omegafold conda activate omegafold conda install -c conda-forge biopython conda install pytorch torchvision torchaudio -c pytorch-nightly git clone https://github.com/HeliXonProtein/OmegaFold cd OmegaFold python setup.py install

EXECUTION python main.py test.fasta testprot/

OUTPUT INFO:root:Loading weights from /Users/ceramirez/.cache/omegafold_ckpt/model.pt INFO:root:Constructing OmegaFold INFO:root:Reading test.fasta INFO:root:Predicting 1th chain in test.fasta INFO:root:45 residues in this chain. loc("mps_multiply"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":219:0)): error: input types 'tensor<12xf32>' and 'tensor<1xi64>' are not broadcast compatible LLVM ERROR: Failed to infer result type(s).

pb3lab commented 1 year ago

I also checked the PyTorch version and that MPS was available:

COMMAND python -c "import torch; import math; print('PyTorch version: '+torch.__version__); print('MPS available: '+str(torch.backends.mps.is_available())); print('MPS built in PyTorch: '+str(torch.backends.mps.is_built()))"

OUTPUT PyTorch version: 1.13.0.dev20220919 MPS available: True MPS built in PyTorch: True

fnachon commented 1 year ago

I got the same issue with PyTorch 1.2.1 on an M1 Pro. I switched to PyTorch Nightlies : torch-1.14.0.dev20221007 Launching python main.py, it stalled without any error message a few seconds after "INFO:root:100 residues in this chain." So not really working on this platform...

zmactep commented 1 year ago

I have the same issue on my MacBook Pro 14 M1 Max. Torch version is 1.14.0.dev20221017.

% python main.py ~/Downloads/rcsb_pdb_1FSD.fasta ~/Downloads/1FSD_output
INFO:root:Loading weights from /Users/pavel/.cache/omegafold_ckpt/model.pt
INFO:root:Constructing OmegaFold
INFO:root:Reading /Users/pavel/Downloads/rcsb_pdb_1FSD.fasta
INFO:root:Predicting 1th chain in /Users/pavel/Downloads/rcsb_pdb_1FSD.fasta
INFO:root:28 residues in this chain.
loc("mps_multiply"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":219:0)): error: input types 'tensor<12xf32>' and 'tensor<1xi64>' are not broadcast compatible
LLVM ERROR: Failed to infer result type(s).
[1]    81569 abort      python main.py ~/Downloads/rcsb_pdb_1FSD.fasta ~/Downloads/1FSD_output