GuyTevet / motion-diffusion-model

The official PyTorch implementation of the paper "Human Motion Diffusion Model"
MIT License
3.06k stars 330 forks source link

Windows support #1

Open jaykup1 opened 1 year ago

jaykup1 commented 1 year ago

Libraries can't be installed in windows. Can there be windows support for installation?

GuyTevet commented 1 year ago

Hello @jaykup1 ! Unfortunately, we don't have a windows machine on our team. So we welcome you or anyone from the community to contribute this support and will add it to this repo. Meanwhile, I'm keeping this thread open.

yash1120 commented 1 year ago

for me it is working on windows machine @jaykup1 please try with anaconda prompt

jaykup1 commented 1 year ago

for me it is working on windows machine @jaykup1 please try with anaconda prompt

I did and I cant install not windows supported packages. A step by step guide for the workaround for the "ResolvePackageNotFound:" error would be greatly appreciated

TREE-Ind commented 1 year ago

@jaykup1 You'll want to open up the environment.yml and make some adjustments. It has Linux specific package names on the end. For example beautifulsoup4=4.11.1=pyha770c72_0

You need to remove the =pyha770c72_0 from this as it's Linux specific (a byproduct of how Anaconda packages). Do this for each dependency. There are also a couple of Linux specific dependencies that need to removed from the file completely. Do the first step and you should be able to see only the ones that need removed remaining on the ResolvePackage list.

If we get time later we'll post the specific packages that are not needed.

DrMemoryFish commented 1 year ago

@jaykup1 You'll want to open up the environment.yml and make some adjustments. It has Linux specific package names on the end. For example beautifulsoup4=4.11.1=pyha770c72_0

You need to remove the =pyha770c72_0 from this as it's Linux specific (a byproduct of how Anaconda packages). Do this for each dependency. There are also a couple of Linux specific dependencies that need to removed from the file completely. Do the first step and you should be able to see only the ones that need removed remaining on the ResolvePackage list.

If we get time later we'll post the specific packages that are not needed.

To save time here's the code:

name: mdm
channels:
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - beautifulsoup4=4.11.1
  - blas=1.0=mkl
  - brotlipy=0.7.0
  - ca-certificates=2022.9.24
  - catalogue=2.0.8
  - certifi=2022.9.24
  - cffi=1.15.1
  - charset-normalizer=2.1.1
  - colorama=0.4.5
  - cryptography=35.0.0
  - cudatoolkit=11.0.221
  - cycler=0.11.0
  - cymem=2.0.6
  - dataclasses=0.8
  - expat=2.4.9
  - fftw=3.3.9
  - filelock=3.8.0
  - fontconfig=2.13.1
  - gdown=4.5.1
  - giflib=5.2.1
  - glib=2.69.1
  - h5py=3.7.0
  - hdf5=1.10.6
  - icu=58.2
  - idna=3.4
  - intel-openmp=2021.4.0
  - jinja2=3.1.2
  - jpeg=9b
  - kiwisolver=1.4.2
  - langcodes=3.3.0
  - lcms2=2.12
  - libffi=3.3
  - libpng=1.6.37
  - libtiff=4.1.0
  - libuv=1.40.0
  - libwebp=1.2.0
  - libxml2=2.9.14
  - lz4-c=1.9.3
  - markupsafe=2.1.1
  - matplotlib=3.1.3
  - matplotlib-base=3.1.3
  - mkl=2021.4.0
  - mkl-service=2.4.0
  - mkl_fft=1.3.1
  - mkl_random=1.2.2
  - ninja=1.10.2
  - ninja-base=1.10.2
  - numpy=1.21.5
  - numpy-base=1.21.5
  - openssl=1.1.1q
  - packaging=21.3
  - pathy=0.6.2
  - pcre=8.45
  - pillow=9.2.0
  - pip=22.2.2
  - pycparser=2.21
  - pydantic=1.8.2
  - pyopenssl=22.0.0
  - pyparsing=3.0.9
  - pyqt=5.9.2
  - pysocks=1.7.1
  - python=3.7.13
  - python-dateutil=2.8.2
  - python_abi=3.7
  - pytorch=1.7.1
  - qt=5.9.7
  - requests=2.28.1
  - scipy=1.7.3
  - setuptools=63.4.1
  - shellingham=1.5.0
  - sip=4.19.8
  - six=1.16.0
  - smart_open=5.2.1
  - soupsieve=2.3.2.post1
  - spacy=3.3.1
  - spacy-legacy=3.0.10
  - spacy-loggers=1.0.3
  - sqlite=3.39.3
  - tk=8.6.12
  - torchaudio=0.7.2
  - torchvision=0.8.2
  - tornado=6.2
  - tqdm=4.64.1
  - trimesh=3.15.3
  - typer=0.4.2
  - wheel=0.37.1
  - xz=5.2.6
  - zipp=3.8.1
  - zlib=1.2.12
  - zstd=1.4.9
  - pip:
    - blis==0.7.8
    - chumpy==0.70
    - click==8.1.3
    - confection==0.0.2
    - filelock==3.8.0
    - ftfy==6.1.1
    - importlib-metadata==5.0.0
    - lxml==4.9.1
    - murmurhash==1.0.8
    - preshed==3.0.7
    - pycryptodomex==3.15.0
    - regex==2022.9.13
    - smplx==0.1.28
    - srsly==2.4.4
    - thinc==8.0.17
    - typing-extensions==4.1.1
    - urllib3==1.26.12
    - wasabi==0.10.1
    - wcwidth==0.2.5
prefix: /disk2/guytevet/anaconda3/envs/mdm-venv
jaykup1 commented 1 year ago

@TREE-Ind @AbdullahJames Thank you both. All working now.

TREE-Ind commented 1 year ago

2022-10-06 15_37_34-Blender

We were able to successfully run the full sample code including mesh visualization on Windows :D

@GuyTevet Thank you for the amazing work btw :D

DrMemoryFish commented 1 year ago

@TREE-Ind can you show me how you have done this? I'm looking into this right now and seeing that you've achieved this, it would be great if you shared you're process and troubleshooting.

TREE-Ind commented 1 year ago

We've documented the process to getting it working on Windows and will try to do a post sometime soon that goes through each step.

jaykup1 commented 1 year ago

@TREE-Ind can you show me how you have done this? I'm looking into this right now and seeing that you've achieved this, it would be great if you shared you're process and troubleshooting.

  1. generate with prompt (python -m sample --model_path ./save/humanml_trans_enc_512/model000200000.pt --text_prompt "the person walked forward and is picking up his toolbox." --motion_length 9.8)
  2. Render SMPL mesh (python -m visualize.render_mesh --input_path ./save/humanml_trans_enc_512/samples_humanml_trans_enc_512_000200000_seed10_the_person_walked_forward_and_is_picking_up_his_toolbox/sample00_rep00.mp4)
  3. Open Blender
  4. If you like Install Stop-motion-OBJ (https://github.com/neverhood311/Stop-motion-OBJ)
  5. Import obj files to blender (Import -> Mesh Sequence with Stop-motion-OBJ addon installed)

I'm looking for a way to export fbx with animation (trying through joints2smpl right now). Any help would be great.

DrMemoryFish commented 1 year ago

@TREE-Ind thank you so much!!!

TREE-Ind commented 1 year ago

@jaykup1 Looks like you've gotten to pretty much the same place as us including doing the mesh sequence. It's pretty awesome to see the visualized animation.

You might have luck exporting the mesh sequence as an alembic but looks like fbx is not supported. For us the issue will be that the animation is still only mesh data. Our goal is actually to get joint data, apply it to a skeleton, and then export the fbx.

jaykup1 commented 1 year ago

@jaykup1 Looks like you've gotten to pretty much the same place as us including doing the mesh sequence. It's pretty awesome to see the visualized animation.

You might have luck exporting the mesh sequence as an alembic but looks like fbx is not supported. For us the issue will be that the animation is still only mesh data. Our goal is actually to get joint data, apply it to a skeleton, and then export the fbx.

Smpl actually has unity and blender addons, exporting joints data through joints2smpl gave me errors but I think that is the way to go.

DrMemoryFish commented 1 year ago

@jaykup1 Step 2 doesn't seem to work for me, it returns:

(mdm) E:\AI\motion-diffusion-model>python -m visualize.render_mesh --input_path ./save/humanml_trans_enc_512/samples_humanml_trans_enc_512_000200000_seed10_the_person_walked_forward_and_is_picking_up_his_toolbox/sample00_rep00.mp4
./body_models/
WARNING: You are using a SMPL model, with only 10 shape coefficients.
Traceback (most recent call last):
  File "C:\Users\Abdullah\miniconda3\envs\mdm\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Abdullah\miniconda3\envs\mdm\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\AI\motion-diffusion-model\visualize\render_mesh.py", line 26, in <module>
    device=params.device, cuda=params.cuda)
  File "E:\AI\motion-diffusion-model\visualize\vis_utils.py", line 24, in __init__
    self.j2s = joints2smpl(num_frames=self.num_frames, device_id=device, cuda=cuda)
  File "E:\AI\motion-diffusion-model\visualize\simplify_loc2rot.py", line 42, in __init__
    device=self.device)
  File "E:\AI\motion-diffusion-model\visualize\joints2smpl\src\smplify.py", line 69, in __init__
    dtype=torch.float32).to(device)
  File "E:\AI\motion-diffusion-model\visualize\joints2smpl\src\prior.py", line 127, in __init__
    gmm = pickle.load(f, encoding='latin1')
_pickle.UnpicklingError: the STRING opcode argument must be quoted

(mdm) E:\AI\motion-diffusion-model>

i tried another way, and got this:

(mdm) E:\AI\motion-diffusion-model>python -m visualize.render_mesh --input_path E:\AI\motion-diffusion-model\save\humanml_trans_enc_512\samples_humanml_trans_enc_512_000200000_seed10_the_person_walked_forward_and_is_picking_up_his_toolbox\sample00_rep01.mp4
./body_models/
WARNING: You are using a SMPL model, with only 10 shape coefficients.
Traceback (most recent call last):
  File "C:\Users\Abdullah\miniconda3\envs\mdm\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Abdullah\miniconda3\envs\mdm\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\AI\motion-diffusion-model\visualize\render_mesh.py", line 26, in <module>
    device=params.device, cuda=params.cuda)
  File "E:\AI\motion-diffusion-model\visualize\vis_utils.py", line 24, in __init__
    self.j2s = joints2smpl(num_frames=self.num_frames, device_id=device, cuda=cuda)
  File "E:\AI\motion-diffusion-model\visualize\simplify_loc2rot.py", line 42, in __init__
    device=self.device)
  File "E:\AI\motion-diffusion-model\visualize\joints2smpl\src\smplify.py", line 69, in __init__
    dtype=torch.float32).to(device)
  File "E:\AI\motion-diffusion-model\visualize\joints2smpl\src\prior.py", line 127, in __init__
    gmm = pickle.load(f, encoding='latin1')
_pickle.UnpicklingError: the STRING opcode argument must be quoted

(mdm) E:\AI\motion-diffusion-model>
TREE-Ind commented 1 year ago

@AbdullahJames In order to fix this error we had to change the encoding of the gmm_08.pkl file to Unix. You can do this by opening the file in Notepad++

2022-10-08 09_02_50-D__motion-diffusion-model_visualize_joints2smpl_smpl_models_gmm_08 pkl - Notepad

DrMemoryFish commented 1 year ago

@AbdullahJames In order to fix this error we had to change the encoding of the gmm_08.pkl file to Unix. You can do this by opening the file in Notepad++

2022-10-08 09_02_50-D__motion-diffusion-model_visualize_joints2smpl_smpl_models_gmm_08 pkl - Notepad

how exactly do we do that? I'm not familiar with this.

ghost commented 1 year ago

@AbdullahJames In order to fix this error we had to change the encoding of the gmm_08.pkl file to Unix. You can do this by opening the file in Notepad++ 2022-10-08 09_02_50-D__motion-diffusion-model_visualize_joints2smpl_smpl_models_gmm_08 pkl - Notepad

how exactly do we do that? I'm not familiar with this.

image Double click both circled and set to Unix and UTF-8, then save/overwrite

Notepad++ can be downloaded here, it's a great free editor! https://notepad-plus-plus.org/downloads/

DrMemoryFish commented 1 year ago

@AbdullahJames In order to fix this error we had to change the encoding of the gmm_08.pkl file to Unix. You can do this by opening the file in Notepad++ 2022-10-08 09_02_50-D__motion-diffusion-model_visualize_joints2smpl_smpl_models_gmm_08 pkl - Notepad

how exactly do we do that? I'm not familiar with this.

image Double click both circled and set to Unix and UTF-8, then save/overwrite

Notepadd++ can be downloaded here, it's a great free editor! https://notepad-plus-plus.org/downloads/

thank you! got it working

DrMemoryFish commented 1 year ago

@TREE-Ind can you show me how you have done this? I'm looking into this right now and seeing that you've achieved this, it would be great if you shared you're process and troubleshooting.

  1. generate with prompt (python -m sample --model_path ./save/humanml_trans_enc_512/model000200000.pt --text_prompt "the person walked forward and is picking up his toolbox." --motion_length 9.8)
  2. Render SMPL mesh (python -m visualize.render_mesh --input_path ./save/humanml_trans_enc_512/samples_humanml_trans_enc_512_000200000_seed10_the_person_walked_forward_and_is_picking_up_his_toolbox/sample00_rep00.mp4)
  3. Open Blender
  4. If you like Install Stop-motion-OBJ (https://github.com/neverhood311/Stop-motion-OBJ)
  5. Import obj files to blender (Import -> Mesh Sequence with Stop-motion-OBJ addon installed)

I'm looking for a way to export fbx with animation (trying through joints2smpl right now). Any help would be great.

thank you! after some trouble shooting, i got it working in my free time.

DrMemoryFish commented 1 year ago

is the way to add physics to the flesh? or change the character model?

GuyTevet commented 1 year ago

@AbdullahJames yes there are some options but maybe it deserves another thread. Please open a new issue for this.

DrMemoryFish commented 1 year ago

@AbdullahJames yes there are some options but maybe it deserves another thread. Please open a new issue for this.

done

yaman20010 commented 1 year ago

@GuyTevet thank you very much

Natotela commented 1 year ago

@jaykup1 You'll want to open up the environment.yml and make some adjustments. It has Linux specific package names on the end. For example beautifulsoup4=4.11.1=pyha770c72_0 You need to remove the =pyha770c72_0 from this as it's Linux specific (a byproduct of how Anaconda packages). Do this for each dependency. There are also a couple of Linux specific dependencies that need to removed from the file completely. Do the first step and you should be able to see only the ones that need removed remaining on the ResolvePackage list. If we get time later we'll post the specific packages that are not needed.

To save time here's the code:

name: mdm
channels:
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - beautifulsoup4=4.11.1
  - blas=1.0=mkl
  - brotlipy=0.7.0
  - ca-certificates=2022.9.24
  - catalogue=2.0.8
  - certifi=2022.9.24
  - cffi=1.15.1
  - charset-normalizer=2.1.1
  - colorama=0.4.5
  - cryptography=35.0.0
  - cudatoolkit=11.0.221
  - cycler=0.11.0
  - cymem=2.0.6
  - dataclasses=0.8
  - expat=2.4.9
  - fftw=3.3.9
  - filelock=3.8.0
  - fontconfig=2.13.1
  - gdown=4.5.1
  - giflib=5.2.1
  - glib=2.69.1
  - h5py=3.7.0
  - hdf5=1.10.6
  - icu=58.2
  - idna=3.4
  - intel-openmp=2021.4.0
  - jinja2=3.1.2
  - jpeg=9b
  - kiwisolver=1.4.2
  - langcodes=3.3.0
  - lcms2=2.12
  - libffi=3.3
  - libpng=1.6.37
  - libtiff=4.1.0
  - libuv=1.40.0
  - libwebp=1.2.0
  - libxml2=2.9.14
  - lz4-c=1.9.3
  - markupsafe=2.1.1
  - matplotlib=3.1.3
  - matplotlib-base=3.1.3
  - mkl=2021.4.0
  - mkl-service=2.4.0
  - mkl_fft=1.3.1
  - mkl_random=1.2.2
  - ninja=1.10.2
  - ninja-base=1.10.2
  - numpy=1.21.5
  - numpy-base=1.21.5
  - openssl=1.1.1q
  - packaging=21.3
  - pathy=0.6.2
  - pcre=8.45
  - pillow=9.2.0
  - pip=22.2.2
  - pycparser=2.21
  - pydantic=1.8.2
  - pyopenssl=22.0.0
  - pyparsing=3.0.9
  - pyqt=5.9.2
  - pysocks=1.7.1
  - python=3.7.13
  - python-dateutil=2.8.2
  - python_abi=3.7
  - pytorch=1.7.1
  - qt=5.9.7
  - requests=2.28.1
  - scipy=1.7.3
  - setuptools=63.4.1
  - shellingham=1.5.0
  - sip=4.19.8
  - six=1.16.0
  - smart_open=5.2.1
  - soupsieve=2.3.2.post1
  - spacy=3.3.1
  - spacy-legacy=3.0.10
  - spacy-loggers=1.0.3
  - sqlite=3.39.3
  - tk=8.6.12
  - torchaudio=0.7.2
  - torchvision=0.8.2
  - tornado=6.2
  - tqdm=4.64.1
  - trimesh=3.15.3
  - typer=0.4.2
  - wheel=0.37.1
  - xz=5.2.6
  - zipp=3.8.1
  - zlib=1.2.12
  - zstd=1.4.9
  - pip:
    - blis==0.7.8
    - chumpy==0.70
    - click==8.1.3
    - confection==0.0.2
    - filelock==3.8.0
    - ftfy==6.1.1
    - importlib-metadata==5.0.0
    - lxml==4.9.1
    - murmurhash==1.0.8
    - preshed==3.0.7
    - pycryptodomex==3.15.0
    - regex==2022.9.13
    - smplx==0.1.28
    - srsly==2.4.4
    - thinc==8.0.17
    - typing-extensions==4.1.1
    - urllib3==1.26.12
    - wasabi==0.10.1
    - wcwidth==0.2.5
prefix: /disk2/guytevet/anaconda3/envs/mdm-venv

10x, I've tried it in win10, anaconda3, I'm still getting some errors. During the create env I noticed: Examining conflict for numpy scipy: 95%|███████████████████████████████████████████▌ | 89/94 [01:51<00:00, 5.87it/s]-failed

then in the end tons of conflicts logging, which finalized with these lines: Package catalogue conflicts for: spacy=3.3.1 -> catalogue[version='>=2.0.6,<2.1.0'] spacy=3.3.1 -> srsly[version='>=2.4.3,<3.0.0'] -> catalogue[version='>=2.0.1,<2.1.0|>=2.0.3,<2.1.0|>=2.0.4,<3.0.0|>=2.0.4,<2.1.0'] catalogue=2.0.8The following specifications were found to be incompatible with your system:

Your installed version is: 0

Note that strict channel priority may have removed packages required for satisfiability.

This is the second time in a row, first time I tried the installed version was: not available and I can't activate env, nor python -m spacy download en_core_web_sm