Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Support mps cpu #249

Open
wants to merge 5 commits into
base: 4.1-Stable
Choose a base branch
from
Open

Conversation

Tps-F
Copy link
Contributor

@Tps-F Tps-F commented Jun 21, 2023

Overview

I made it compatible with cpu and mps since training only seems to work with cuda devices.

About the change

DistributedDataParallel is not likely to work with CPU or mps, so I used DataParallel.

The reason I'm making the change to dist.init_process_group is that mps may be supported in DDP in the future.

The rest was simply replacing .cuda() with .to()

My English is poor, so if you have any questions, please feel free to ask!

train.py Show resolved Hide resolved
@magic-akari
Copy link
Contributor

I still cannot run train.py on MPS with this Pull Request.

Traceback (most recent call last):
  File "train.py", line 472, in <module>
    main()
  File "train.py", line 66, in main
    run(0, n_gpus, hps)
  File "train.py", line 188, in run
    train_and_evaluate(
  File "train.py", line 261, in train_and_evaluate
    ) = net_g(
  File "/Users/akari/Github/so-vits-svc/.conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/akari/Github/so-vits-svc/.conda/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 153, in forward
    return self.module(*inputs, **kwargs)
  File "/Users/akari/Github/so-vits-svc/.conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/akari/Github/so-vits-svc/models.py", line 410, in forward
    vol = self.emb_vol(vol[:,:,None]).transpose(1,2) if vol!=None and self.vol_embedding else 0
  File "/Users/akari/Github/so-vits-svc/.conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/akari/Github/so-vits-svc/.conda/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
    return F.linear(input, self.weight, self.bias)
RuntimeError: Placeholder storage has not been allocated on MPS device!

Are there any other issues that need to be resolved?

@Tps-F
Copy link
Contributor Author

Tps-F commented Jun 23, 2023

I did not get that error in my environment.
Can you please let me know how you ran it, etc.?

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

Successfully merging this pull request may close these issues.

2 participants