Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
LinghaoChan committed Oct 24, 2024
1 parent 8347fd1 commit ccc1958
Show file tree
Hide file tree
Showing 50 changed files with 7,239 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Ignore compiled binaries
*.exe
*.dll
*.so
*.dylib
*.npy

# Ignore build artifacts
build/
dist/
node_modules/

# Ignore IDE and editor files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace

# Ignore system files
.DS_Store
Thumbs.db

# Ignore log files
*.log

# Ignore temporary files
*.tmp
*.bak
*.swp

**/*.pyc
*.pyc
*.out
*.sh
*.png
*.pth
*.pt
*.ipynb

test.py

data/
vis-*/
checkpoints/
tmp/
*.tar.gz
16 changes: 16 additions & 0 deletions 1gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: 'NO'
downcast_bf16: 'no'
machine_rank: 0
main_training_function: main
mixed_precision: no
num_machines: 1
num_processes: 1
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
main_process_port: 21000
57 changes: 57 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#--------------------------------------------
# MotionCLR
# Copyright (c) 2024 IDEA. All Rights Reserved.
# Licensed under the IDEA License, Version 1.0 [see LICENSE for details]
#--------------------------------------------

IDEA License 1.0

This License Agreement (as may be amended in accordance with this License Agreement, “License”), between you, or your employer or other entity (if you are entering into this agreement on behalf of your employer or other entity) (“Licensee” or “you”) and the International Digital Economy Academy (“IDEA” or “we”) applies to your use of any computer program, algorithm, source code, object code, or software that is made available by IDEA under this License (“Software”) and any specifications, manuals, documentation, and other written information provided by IDEA related to the Software (“Documentation”).

By downloading the Software or by using the Software, you agree to the terms of this License. If you do not agree to this License, then you do not have any rights to use the Software or Documentation (collectively, the “Software Products”), and you must immediately cease using the Software Products. If you are agreeing to be bound by the terms of this License on behalf of your employer or other entity, you represent and warrant to IDEA that you have full legal authority to bind your employer or such entity to this License. If you do not have the requisite authority, you may not accept the License or access the Software Products on behalf of your employer or other entity.

1. LICENSE GRANT

a. You are granted a non-exclusive, worldwide, transferable, sublicensable, irrevocable, royalty free and limited license under IDEA’s copyright interests to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Software solely for your non-commercial research purposes.

b. The grant of rights expressly set forth in this Section 1 (License Grant) are the complete grant of rights to you in the Software Products, and no other licenses are granted, whether by waiver, estoppel, implication, equity or otherwise. IDEA and its licensors reserve all rights not expressly granted by this License.

c. If you intend to use the Software Products for any commercial purposes, you must request a license from IDEA, which IDEA may grant to you in its sole discretion.

2. REDISTRIBUTION AND USE

a. If you distribute or make the Software Products, or any derivative works thereof, available to a third party, you shall provide a copy of this Agreement to such third party.

b. You must retain in all copies of the Software Products that you distribute the following attribution notice: "MotionCLR is licensed under the IDEA License 1.0, Copyright (c) IDEA. All Rights Reserved."

d. Your use of the Software Products must comply with applicable laws and regulations (including trade compliance laws and regulations).

e. You will not, and will not permit, assist or cause any third party to use, modify, copy, reproduce, create derivative works of, or distribute the Software Products (or any derivative works thereof, works incorporating the Software Products, or any data produced by the Software), in whole or in part, for in any manner that infringes, misappropriates, or otherwise violates any third-party rights.

3. DISCLAIMER OF WARRANTY

UNLESS REQUIRED BY APPLICABLE LAW, THE SOFTWARE PRODUCTS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SOFTWARE PRODUCTS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SOFTWARE PRODUCTS AND ANY OUTPUT AND RESULTS.

4. LIMITATION OF LIABILITY

IN NO EVENT WILL IDEA OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF IDEA OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.

5. INDEMNIFICATION

You will indemnify, defend and hold harmless IDEA and our subsidiaries and affiliates, and each of our respective shareholders, directors, officers, employees, agents, successors, and assigns (collectively, the “IDEA Parties”) from and against any losses, liabilities, damages, fines, penalties, and expenses (including reasonable attorneys’ fees) incurred by any IDEA Party in connection with any claim, demand, allegation, lawsuit, proceeding, or investigation (collectively, “Claims”) arising out of or related to: (a) your access to or use of the Software Products (as well as any results or data generated from such access or use); (b) your violation of this License; or (c) your violation, misappropriation or infringement of any rights of another (including intellectual property or other proprietary rights and privacy rights). You will promptly notify the IDEA Parties of any such Claims, and cooperate with IDEA Parties in defending such Claims. You will also grant the IDEA Parties sole control of the defense or settlement, at IDEA’s sole option, of any Claims. This indemnity is in addition to, and not in lieu of, any other indemnities or remedies set forth in a written agreement between you and IDEA or the other IDEA Parties.

6. TERMINATION; SURVIVAL

a. This License will automatically terminate upon any breach by you of the terms of this License.

b. If you institute litigation or other proceedings against IDEA or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Software Products, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted.

c. The following sections survive termination of this License: 2 (Redistribution and use), 3 (Disclaimers of Warranty), 4 (Limitation of Liability), 5 (Indemnification), 6 (Termination; Survival), 7 (Trademarks) and 8 (Applicable Law; Dispute Resolution).

7. TRADEMARKS

Licensee has not been granted any trademark license as part of this License and may not use any name or mark associated with IDEA without the prior written permission of IDEA, except to the extent necessary to make the reference required by the attribution notice of this Agreement.

8. APPLICABLE LAW; DISPUTE RESOLUTION

This License will be governed and construed under the laws of the People’s Republic of China without regard to conflicts of law provisions. The parties expressly agree that the United Nations Convention on Contracts for the International Sale of Goods will not apply. Any suit or proceeding arising out of or relating to this License will be brought in the courts, as applicable, in Shenzhen, Guangdong, and each party irrevocably submits to the jurisdiction and venue of such courts.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

[Ling-Hao Chen](https://lhchen.top/)$^*$, [Wenxun Dai](https://github.com/Dai-Wenxun), [Xuan Ju](https://juxuan27.github.io/), [Shunlin Lu](https://shunlinlu.github.io), [Lei Zhang](https://leizhang.org)

$^*$Internship at IDEA Research. †Correspondence.
$^*$ Internship at IDEA Research. †Correspondence.

## 🤩 Abstract
> This research delves into analyzing the attention mechanism of diffusion models in human motion generation. Previous motion diffusion models lack explicit modeling of the word-level text-motion correspondence and explainability. Regarding these issues, we propose an attention-based motion diffusion model, namely MotionCLR, with CLeaR modeling of attention mechanisms. Based on the proposed model, we thoroughly analyze the formulation of the attention mechanism theoretically and empirically. Importantly, we highlight that the self-attention mechanism works to find the fine-grained word-sequence correspondence and activate the corresponding timesteps in the motion sequence. Besides, the cross-attention mechanism aims to measure the sequential similarity between frames and order the sequentiality of motion features. Motivated by these key insights, we propose versatile simple yet effective motion editing methods via manipulating attention maps, such as motion (de)-emphasizing, in-place motion replacement, and example-based motion generation \etc. For further verification of the explainability of the attention mechanism, we additionally explore the potential of action-counting and grounded motion generation ability via attention maps.
> This research delves into analyzing the attention mechanism of diffusion models in human motion generation. Previous motion diffusion models lack explicit modeling of the word-level text-motion correspondence and explainability. Regarding these issues, we propose an attention-based motion diffusion model, namely MotionCLR, with CLeaR modeling of attention mechanisms. Based on the proposed model, we thoroughly analyze the formulation of the attention mechanism theoretically and empirically. Importantly, we highlight that the self-attention mechanism works to find the fine-grained word-sequence correspondence and activate the corresponding timesteps in the motion sequence. Besides, the cross-attention mechanism aims to measure the sequential similarity between frames and order the sequentiality of motion features. Motivated by these key insights, we propose versatile simple yet effective motion editing methods via manipulating attention maps, such as motion (de)-emphasizing, in-place motion replacement, and example-based motion generation *etc.*. For further verification of the explainability of the attention mechanism, we additionally explore the potential of action-counting and grounded motion generation ability via attention maps.




```
conda install ffmpeg
```
1 change: 1 addition & 0 deletions assets/motion_lens.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
160
1 change: 1 addition & 0 deletions assets/prompts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a man jumps.
26 changes: 26 additions & 0 deletions config/diffuser_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dpmsolver:
scheduler_class: DPMSolverMultistepScheduler
additional_params:
algorithm_type: sde-dpmsolver++
use_karras_sigmas: true

ddpm:
scheduler_class: DDPMScheduler
additional_params:
variance_type: fixed_small
clip_sample: false

ddim:
scheduler_class: DDIMScheduler
additional_params:
clip_sample: false

deis:
scheduler_class: DEISMultistepScheduler
additional_params:
num_train_timesteps: 1000

pndm:
scheduler_class: PNDMScheduler
additional_params:
num_train_timesteps: 1000
14 changes: 14 additions & 0 deletions config/evaluator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
unit_length: 4
max_text_len: 20
text_enc_mod: bigru
estimator_mod: bigru
dim_text_hidden: 512
dim_att_vec: 512
dim_z: 128
dim_movement_enc_hidden: 512
dim_movement_dec_hidden: 512
dim_movement_latent: 512
dim_word: 300
dim_pos_ohot: 15
dim_motion_hidden: 1024
dim_coemb_hidden: 512
22 changes: 22 additions & 0 deletions datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from .t2m_dataset import HumanML3D,KIT

from os.path import join as pjoin
__all__ = [
'HumanML3D', 'KIT', 'get_dataset',]

def get_dataset(opt, split='train', mode='train', accelerator=None):
if opt.dataset_name == 't2m' :
dataset = HumanML3D(opt, split, mode, accelerator)
elif opt.dataset_name == 'kit' :
dataset = KIT(opt,split, mode, accelerator)
else:
raise KeyError('Dataset Does Not Exist')

if accelerator:
accelerator.print('Completing loading %s dataset' % opt.dataset_name)
else:
print('Completing loading %s dataset' % opt.dataset_name)

return dataset

Loading

0 comments on commit ccc1958

Please sign in to comment.