-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: support wallx model #2593
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
Open
wut19
wants to merge
9
commits into
huggingface:main
Choose a base branch
from
wut19:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,589
−2
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b5968a5
support wallx
vincentccc 68f986b
fix bugs in flow
tongwu19 1a69c16
incorporate wallx model into lerobot
tongwu19 9598144
update the policy methods
tongwu19 0657af2
reduce to least config and params & pass lerobot basic test
tongwu19 0fe20e3
fixed dtype bugs
tongwu19 24ea927
add wallx dependencies
tongwu19 427dd37
update
tongwu19 65da53d
remove flash-attn requirement && fix bug in inference and fast mode
tongwu19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # WALL-OSS | ||
|
|
||
| This repository contains the Hugging Face port of **WALL-OSS**, a Vision-Language-Action model for cross-embodiment robotic control based on Qwen2.5-VL with flow matching/FAST action prediction. | ||
|
|
||
| --- | ||
|
|
||
| ## Model Overview | ||
|
|
||
| | Feature | Description | | ||
| | -------------------- | ------------------------------------------------------------------------ | | ||
| | Base Model | Qwen2.5-VL (Vision-Language Model) | | ||
| | Action Prediction | Flow Matching (diffusion) or FAST (discrete tokens) | | ||
| | Architecture | Mixture of Experts (MoE) with action-specific routing | | | ||
| | Multi-Modal Inputs | Vision (images/videos), Language, Proprioception | | ||
| --- | ||
|
|
||
| ## Citation | ||
|
|
||
| If you use this work, please cite: | ||
|
|
||
| ```bibtex | ||
| @article{zhai2025igniting, | ||
| title = {Igniting VLMs Toward the Embodied Space}, | ||
| author = {Zhai, Andy and Liu, Brae and Fang, Bruno and Cai, Chalse and Ma, Ellie and Yin, Ethan and Wang, Hao and Zhou, Hugo and Wang, James and Shi, Lights and Liang, Lucy and Wang, Make and Wang, Qian and Gan, Roy and Yu, Ryan and Li, Shalfun and Liu, Starrick and Chen, Sylas and Chen, Vincent and Xu, Zach}, | ||
| journal = {arXiv preprint arXiv:2509.11766}, | ||
| year = {2025} | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## License | ||
|
|
||
| This port follows the **Apache 2.0 License**. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| # Copyright 2025 Physical Intelligence and The HuggingFace Inc. team. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from .configuration_wall_x import WallXConfig | ||
| from .modeling_wall_x import WallXPolicy | ||
| from .processor_wall_x import make_wall_x_pre_post_processors | ||
|
|
||
| __all__ = ["WallXConfig", "WallXPolicy", "make_wall_x_pre_post_processors"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| # Copyright 2025 HuggingFace Inc. team. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from dataclasses import dataclass, field | ||
|
|
||
| from lerobot.configs.policies import PreTrainedConfig | ||
| from lerobot.configs.types import FeatureType, NormalizationMode, PolicyFeature | ||
| from lerobot.optim.optimizers import AdamWConfig | ||
| from lerobot.optim.schedulers import CosineDecayWithWarmupSchedulerConfig | ||
|
|
||
|
|
||
| @PreTrainedConfig.register_subclass("wall_x") | ||
| @dataclass | ||
| class WallXConfig(PreTrainedConfig): | ||
| """ | ||
| Configuration class for Wall-X policy. | ||
|
|
||
| Wall-X is based on Qwen2.5-VL with action prediction capabilities using flow matching. | ||
| It supports cross-embodiment robotic control through unified action representations. | ||
|
|
||
| This config supports multi-modal learning with vision, language, and action data. | ||
| """ | ||
|
|
||
| # ==================== Input / Output Structure ==================== | ||
| n_obs_steps: int = 1 | ||
| chunk_size: int = 32 # action_horizon in wall-x | ||
| n_action_steps: int = 32 | ||
|
|
||
| # Action dimension - wall-x uses 20 | ||
| max_action_dim: int = 20 | ||
| max_state_dim: int = 20 # For proprioception | ||
|
|
||
| normalization_mapping: dict[str, NormalizationMode] = field( | ||
| default_factory=lambda: { | ||
| "VISUAL": NormalizationMode.IDENTITY, | ||
| "STATE": NormalizationMode.MEAN_STD, | ||
| "ACTION": NormalizationMode.MEAN_STD, | ||
| } | ||
| ) | ||
|
|
||
| # ==================== Action Prediction ==================== | ||
| # Pretrained model paths | ||
| pretrained_name_or_path: str = "x-square-robot/wall-oss-flow" | ||
pkooij marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Tokenizer settings | ||
| action_tokenizer_path: str | None = "physical-intelligence/fast" | ||
|
|
||
| # Action prediction mode: "diffusion" or "fast" | ||
| prediction_mode: str = "diffusion" | ||
|
|
||
| # Attention Implementation, options: "eager", "flash_attention_2", "sdpa" | ||
| # NOTE: flash-attn==2.7.4.post1 is required for flash_attention_2 implementation | ||
| attn_implementation: str = "eager" | ||
|
|
||
| # ==================== Optimizer Presets ==================== | ||
| optimizer_lr: float = 2e-5 | ||
| optimizer_betas: tuple[float, float] = (0.9, 0.95) | ||
| optimizer_eps: float = 1e-8 | ||
| optimizer_weight_decay: float = 0.01 | ||
| optimizer_grad_clip_norm: float = 1.0 | ||
|
|
||
| scheduler_warmup_steps: int = 1000 | ||
| scheduler_decay_steps: int = 100000 | ||
| scheduler_decay_lr: float = 1e-6 | ||
|
|
||
| def __post_init__(self): | ||
| super().__post_init__() | ||
|
|
||
| # Input validation | ||
| if self.n_action_steps > self.chunk_size: | ||
| raise ValueError( | ||
| f"The chunk size is the upper bound for the number of action steps per model invocation. Got " | ||
| f"{self.n_action_steps} for `n_action_steps` and {self.chunk_size} for `chunk_size`." | ||
| ) | ||
|
|
||
| if self.prediction_mode not in ["diffusion", "fast"]: | ||
| raise ValueError( | ||
| f"prediction_mode must be 'diffusion' or 'fast', got {self.prediction_mode}" | ||
| ) | ||
|
|
||
| # Assign use_fast_tokenizer based on prediction_mode | ||
| if self.prediction_mode == "fast": | ||
| self.use_fast_tokenizer = True | ||
| elif self.prediction_mode == "diffusion": | ||
| self.use_fast_tokenizer = False | ||
| self.action_tokenizer_path = None # disable action tokenizer for diffusion mode | ||
| else: | ||
| raise ValueError( | ||
| f"prediction_mode must be 'diffusion' or 'fast', got {self.prediction_mode}" | ||
| ) | ||
|
|
||
| def validate_features(self) -> None: | ||
| """Validate and set up input/output features.""" | ||
| image_features = [key for key, feat in self.input_features.items() if feat.type == FeatureType.VISUAL] | ||
| if not image_features: | ||
| raise ValueError( | ||
| "Wall-X policy requires at least one visual input feature. " | ||
| "No features of type FeatureType.VISUAL found in input_features." | ||
| ) | ||
|
|
||
| if "observation.state" not in self.input_features: | ||
| state_feature = PolicyFeature( | ||
| type=FeatureType.STATE, | ||
| shape=(self.max_state_dim,), # Padded to max_state_dim | ||
| ) | ||
| self.input_features["observation.state"] = state_feature | ||
| else: | ||
| state_shape = self.input_features["observation.state"].shape | ||
| state_dim = state_shape[0] if state_shape else 0 | ||
| if state_dim > self.max_state_dim: | ||
| raise ValueError( | ||
| f"State dimension {state_dim} exceeds max_state_dim {self.max_state_dim}. " | ||
| f"Either reduce state dimension or increase max_state_dim in config." | ||
| ) | ||
|
|
||
| if "action" not in self.output_features: | ||
| action_feature = PolicyFeature( | ||
| type=FeatureType.ACTION, | ||
| shape=(self.max_action_dim,), # Padded to max_action_dim | ||
| ) | ||
| self.output_features["action"] = action_feature | ||
| else: | ||
| action_shape = self.output_features["action"].shape | ||
| action_dim = action_shape[0] if action_shape else 0 | ||
| if action_dim > self.max_action_dim: | ||
| raise ValueError( | ||
| f"Action dimension {action_dim} exceeds max_action_dim {self.max_action_dim}. " | ||
| f"Either reduce action dimension or increase max_action_dim in config." | ||
| ) | ||
|
|
||
| def get_optimizer_preset(self) -> AdamWConfig: | ||
| return AdamWConfig( | ||
| lr=self.optimizer_lr, | ||
| betas=self.optimizer_betas, | ||
| eps=self.optimizer_eps, | ||
| weight_decay=self.optimizer_weight_decay, | ||
| grad_clip_norm=self.optimizer_grad_clip_norm, | ||
| ) | ||
|
|
||
| def get_scheduler_preset(self): | ||
| return CosineDecayWithWarmupSchedulerConfig( | ||
| peak_lr=self.optimizer_lr, | ||
| decay_lr=self.scheduler_decay_lr, | ||
| num_warmup_steps=self.scheduler_warmup_steps, | ||
| num_decay_steps=self.scheduler_decay_steps, | ||
| ) | ||
|
|
||
| @property | ||
| def observation_delta_indices(self) -> list: | ||
| return None | ||
|
|
||
| @property | ||
| def action_delta_indices(self) -> list: | ||
| return list(range(self.chunk_size)) | ||
|
|
||
| @property | ||
| def reward_delta_indices(self) -> None: | ||
| return None | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| # Copyright 2025 HuggingFace Inc. team. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """ | ||
| Wall-X Constants and Configuration Data. | ||
| """ | ||
|
|
||
| CAMERA_NAME_MAPPING = { | ||
| "face_view": "front view", | ||
| "left_wrist_view": "left wrist view", | ||
| "right_wrist_view": "right wrist view", | ||
| "move1_view": "move view", | ||
| "move2_view": "move view", | ||
| "wall_view": "wall view", | ||
| "top_view": "top view", | ||
| } | ||
|
|
||
| RESOLUTION = 256 | ||
|
|
||
| # Parameters for preprocessing | ||
| MAX_PIXELS = 16384 * 28 * 28 | ||
| MIN_PIXELS = 4 * 28 * 28 | ||
| IMAGE_FACTOR = 28 | ||
| PRIORITY_ORDER = None | ||
| GENERATE_SUBTASK_RATIO = 0.0 | ||
| MODEL_TYPE = "qwen2_5" | ||
|
|
||
| TOKENIZER_MAX_LENGTH = 768 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.