Nearest Neighbor Model 5.4

I am trying to test the Nearest Neighbor Model, but I keep encountering various errors. I have a simple skinned tube that I animated, simulated, and then exported as an FBX with rig and animation, along with an Alembic simulation, into Unreal Engine. The alignment is perfect, and I can see the deltas in the viewport, but each version of Unreal Engine gives me different errors.

for alembic import i just put -1 in y since maya was z up
https://file.io/qySVb0SZEFEy

in 5.5 it says:

LogPython: Error: ERROR:root:cannot mmap an empty file
LogPython: Error: ERROR:root:Traceback (most recent call last):
File “D:\UE_5.5/Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Content/Python\nearestneighbormodel.py”, line 1359, in train
compute_and_save_deltas(param)
File “D:\UE_5.5/Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Content/Python\nearestneighbormodel.py”, line 881, in compute_and_save_deltas
deltas = np.memmap(param.deltas_path, dtype=param.delta_dtype, mode=‘w+’, shape=(param.num_samples, param.num_sum_deltas * 3))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\reza_niroumand\unreal\ML_Deformer_5_5\Intermediate\PipInstall\Lib\site-packages\numpy\core\memmap.py”, line 267, in new
mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot mmap an empty file

and in unreal 5.4 it says:

LogNearestNeighborModel: Error: HiddenLayerDims is empty, which will lead to bad results. Default hidden layer dims are added for you. Please double check and train model again.

then

LogNearestNeighborModel: Error: At least one section is required. Please create a section using the ‘+’ button.

and finally:

LogPython: Error: ERROR:root:Event device type CUDA does not match blocking stream’s device type CPU.
LogPython: Error: ERROR:root:Traceback (most recent call last):
File “D:\UE_5.4/Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Content/Python\nearestneighbormodel.py”, line 1283, in train
train_and_save_network(param, train_data)
File “D:\UE_5.4/Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Content/Python\nearestneighbormodel.py”, line 1077, in train_and_save_network
batch_loss.backward()
File “D:\reza_niroumand\unreal\ML_Deformer\Intermediate\PipInstall\Lib\site-packages\torch_tensor.py”, line 492, in backward
torch.autograd.backward(
File “D:\reza_niroumand\unreal\ML_Deformer\Intermediate\PipInstall\Lib\site-packages\torch\autograd_init_.py”, line 251, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: Event device type CUDA does not match blocking stream’s device type CPU.

Hi,

In case you still have this issue, can you try with the Neural Morph Model as well?
Does that give a similar error?

UE 5.4 had some issue regarding Pytorch, which caused the error you had in 5.4.
It also showed you didn’t set the hidden layer dimensions. We improved that in 5.5 and automatically fill those in. That’s likely why 5.5 gets a bit further in the code.

But the error in 5.5 is a bit weird. Did you provide any input bones?

You most likely want to use the Neural Morph Model as well if testing just a cylinder.

In 5.6 we are also deprecating the Nearest Neighbor Model as the UX is bad, and we rewrite a new plugin that is inherited from the Neural Morph Model and is much cleaner.

1 Like