Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead. #234

Closed
gilons opened this issue Dec 22, 2024 · 4 comments

Comments

@gilons
Copy link

gilons commented Dec 22, 2024

Hi there, I'm trying to run some examples in the example repository.
This example examples/tutorials/sph_liquid.py

And I got this error

Traceback (most recent call last):
  File "/Users/gilesfokam/workspace/personal/Genesis/examples/tutorials/sph_liquid.py", line 29, in <module>
    liquid = scene.add_entity(
             ^^^^^^^^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/utils/misc.py", line 38, in wrapper
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/scene.py", line 351, in add_entity
    entity = self._sim._add_entity(morph, material, surface, visualize_contact)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/simulator.py", line 140, in _add_entity
    entity = self.sph_solver.add_entity(self.n_entities, material, morph, surface)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/solvers/sph_solver.py", line 140, in add_entity
    entity = SPHEntity(
             ^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/entities/sph_entity.py", line 16, in __init__
    super().__init__(
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/entities/particle_entity.py", line 69, in __init__
    self.sample()
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/engine/entities/particle_entity.py", line 259, in sample
    self._init_particles_offset = (gs.tensor(particles).contiguous() - gs.tensor(origin)).contiguous()
                                   ^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in tensor
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/grad/creation_ops.py", line 64, in torch_op_wrapper
    gs_tensor = from_torch(torch_tensor, dtype, requires_grad, detach=True, scene=scene)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gilesfokam/.pyenv/versions/3.12.8/lib/python3.12/site-packages/genesis/grad/creation_ops.py", line 92, in from_torch
    gs_tensor = Tensor(torch_tensor.to(gs.device).to(dtype), scene=scene).clone()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

My system description
Screenshot 2024-12-22 at 10 56 58

@zhouxian
Copy link
Collaborator

This seems fixed in the main repo. Could you clone the repo and do pip install -e .? We will update the pypi version soon

@gilons
Copy link
Author

gilons commented Dec 22, 2024 via email

@x4080
Copy link

x4080 commented Dec 22, 2024

Whats the minimum memory needed to run on apple silicon ?

@zhouxian
Copy link
Collaborator

zhouxian commented Dec 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants