Deep SSM model error


I have developed SSM models for bones previously and I am really happy with the results.
I now would like to augment the model applying the deepssm framework.

I am running shapeworks 6.5 on a Mac with an intel processor.

I am trying to run the example script ‘’ and everything works as expected until the Torch starts fitting the model and it crashes.
Errors occur both when running the code in the terminal or in the studio.

Specifically, it crashes when the prompt is showing:

Step 10. Train DeepSSM model.
********************* WARNING ****************************
Pytorch is running on your CPU!
This will be very slow. If your machine has a GPU,
please reinstall Pytorch to your shapeworks conda
environment with the correct CUDA version.

Loading data loaders…
Defining net…
Beginning training on device = cpu

Training_Stage Epoch LR Train_Err Train_Rel_Err Val_Err Val_Rel_Err Sec Epoch 1/10
This occurs exactly in the script ‘DeepSSUtils/’ in the line:
“for img, pca, mdl, names in train_loader:”

I was wondering if this problem is due to an incompatibility between the processor and Torch?
Have you seen other users with similar problems?
If so how is it possible to fix this?

Thank you very much,
Best wishes,

P.s. I have logged all the error; if helpful I can provide them.

It should run on intel mac with no errors, albeit slowly since there is only cpu support for pytorch on Mac.

Is there an exception thrown or more to the error?

Hello Alan Morris,

Thank you very much for your prompt response.
Basically, the errors I are due to the fact that I am trying to run the code directly from the ‘’.

If, as I should have, ran the code using ‘’ no errors occured and the code was produced all the results correctly.

So the question then becomes why does the code not work when the code is run directly from ‘’.

To run it I comment all the references to the arg function and choose the lines related to the ‘tiny_test’ or the whole test.

Everything runs as expected until ‘step 10’ when the ‘train_loader’ is called in the script ‘DeepSSMUtils/’ in the line:

                             'for img, pca, mdl, names in train_loader:'

The code then presents really strange behaviour creating a new ‘Output’ folder inside the ‘deep_ssm/data’ folder. It then starts downloading the data from the shapeworks server and goes through the steps in the code in ‘’ code again and it crashes.

I am sorry for such a long convoluted question.
But is there anyway to fix this problem?
Why are torch data loaders corrupted leading to all these errors?

Thank you very much,
Best wishes,


If you want to run directly, you’ll need to pass in the appropriate args that it’s expecting, or modify the script so that they are not necessary. For example, when I run:

python deep_ssm --tiny_test

The args object passed to Run_Pipeline is

args = Namespace(use_case='deep_ssm', use_subsample=False, num_subsample=3, interactive=False, use_single_scale=False, mesh_mode=False, tiny_test=True, verify=False, clean=False, option_set='tiny_test_multiscale')