Spaces:
Sleeping
Sleeping
Christopher Tan commited on
Commit Β·
53398a3
1
Parent(s): 614efbf
Fixing dependencies and added debugging for imports
Browse files- inference_openpi.py +77 -30
- requirements.txt +3 -1
- requirements_openpi.txt +4 -7
- setup.sh +1 -1
inference_openpi.py
CHANGED
|
@@ -17,41 +17,88 @@ os.environ.setdefault("MUJOCO_GL", "egl")
|
|
| 17 |
os.environ.setdefault("PYOPENGL_PLATFORM", "egl")
|
| 18 |
os.environ.setdefault("XDG_RUNTIME_DIR", "/tmp")
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Import OpenPI dependencies (only available in openpi_env)
|
| 21 |
-
|
| 22 |
-
from openpi.
|
| 23 |
-
from
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Import all environment classes
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Video
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Environment registry
|
| 57 |
_ENV_CLASSES = {
|
|
|
|
| 17 |
os.environ.setdefault("PYOPENGL_PLATFORM", "egl")
|
| 18 |
os.environ.setdefault("XDG_RUNTIME_DIR", "/tmp")
|
| 19 |
|
| 20 |
+
# Verify critical dependencies are available
|
| 21 |
+
print("===== Checking OpenPI Environment Dependencies =====", file=sys.stderr, flush=True)
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
import roboeval
|
| 25 |
+
print("β roboeval imported successfully", file=sys.stderr, flush=True)
|
| 26 |
+
except ImportError as e:
|
| 27 |
+
print(f"β roboeval import failed: {e}", file=sys.stderr, flush=True)
|
| 28 |
+
sys.exit(1)
|
| 29 |
+
|
| 30 |
+
try:
|
| 31 |
+
import lerobot
|
| 32 |
+
print("β lerobot imported successfully", file=sys.stderr, flush=True)
|
| 33 |
+
except ImportError as e:
|
| 34 |
+
print(f"β lerobot import failed: {e}", file=sys.stderr, flush=True)
|
| 35 |
+
sys.exit(1)
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
import openpi
|
| 39 |
+
print("β openpi imported successfully", file=sys.stderr, flush=True)
|
| 40 |
+
except ImportError as e:
|
| 41 |
+
print(f"β openpi import failed: {e}", file=sys.stderr, flush=True)
|
| 42 |
+
sys.exit(1)
|
| 43 |
+
|
| 44 |
# Import OpenPI dependencies (only available in openpi_env)
|
| 45 |
+
try:
|
| 46 |
+
from openpi.training.config import Config as PIConfig
|
| 47 |
+
from openpi.policies.policy_config import PIPolicy
|
| 48 |
+
print("β OpenPI config and policy modules imported successfully", file=sys.stderr, flush=True)
|
| 49 |
+
except ImportError as e:
|
| 50 |
+
print(f"β OpenPI config/policy import failed: {e}", file=sys.stderr, flush=True)
|
| 51 |
+
sys.exit(1)
|
| 52 |
+
|
| 53 |
+
try:
|
| 54 |
+
from roboeval.action_modes import JointPositionActionMode
|
| 55 |
+
from roboeval.utils.observation_config import ObservationConfig, CameraConfig
|
| 56 |
+
from roboeval.robots.configs.panda import BimanualPanda
|
| 57 |
+
from roboeval.roboeval_env import CONTROL_FREQUENCY_MAX
|
| 58 |
+
print("β RoboEval core modules imported successfully", file=sys.stderr, flush=True)
|
| 59 |
+
except ImportError as e:
|
| 60 |
+
print(f"β RoboEval core modules import failed: {e}", file=sys.stderr, flush=True)
|
| 61 |
+
sys.exit(1)
|
| 62 |
|
| 63 |
# Import all environment classes
|
| 64 |
+
try:
|
| 65 |
+
from roboeval.envs.manipulation import (
|
| 66 |
+
CubeHandover, CubeHandoverOrientation, CubeHandoverPosition,
|
| 67 |
+
CubeHandoverPositionAndOrientation, VerticalCubeHandover,
|
| 68 |
+
StackTwoBlocks, StackTwoBlocksOrientation, StackTwoBlocksPosition,
|
| 69 |
+
StackTwoBlocksPositionAndOrientation
|
| 70 |
+
)
|
| 71 |
+
from roboeval.envs.lift_pot import (
|
| 72 |
+
LiftPot, LiftPotOrientation, LiftPotPosition, LiftPotPositionAndOrientation,
|
| 73 |
+
)
|
| 74 |
+
from roboeval.envs.lift_tray import (
|
| 75 |
+
LiftTray, DragOverAndLiftTray, LiftTrayOrientation, LiftTrayPosition, LiftTrayPositionAndOrientation,
|
| 76 |
+
)
|
| 77 |
+
from roboeval.envs.pack_objects import (
|
| 78 |
+
PackBox, PackBoxOrientation, PackBoxPosition, PackBoxPositionAndOrientation,
|
| 79 |
+
)
|
| 80 |
+
from roboeval.envs.stack_books import (
|
| 81 |
+
PickSingleBookFromTable, PickSingleBookFromTableOrientation,
|
| 82 |
+
PickSingleBookFromTablePosition, PickSingleBookFromTablePositionAndOrientation,
|
| 83 |
+
StackSingleBookShelf, StackSingleBookShelfPosition, StackSingleBookShelfPositionAndOrientation,
|
| 84 |
+
)
|
| 85 |
+
from roboeval.envs.rotate_utility_objects import (
|
| 86 |
+
RotateValve, RotateValveObstacle, RotateValvePosition, RotateValvePositionAndOrientation,
|
| 87 |
+
)
|
| 88 |
+
print("β RoboEval environment classes imported successfully", file=sys.stderr, flush=True)
|
| 89 |
+
except ImportError as e:
|
| 90 |
+
print(f"β RoboEval environment classes import failed: {e}", file=sys.stderr, flush=True)
|
| 91 |
+
sys.exit(1)
|
| 92 |
|
| 93 |
# Video
|
| 94 |
+
try:
|
| 95 |
+
from moviepy.editor import VideoClip
|
| 96 |
+
print("β moviepy imported successfully", file=sys.stderr, flush=True)
|
| 97 |
+
except ImportError as e:
|
| 98 |
+
print(f"β moviepy import failed: {e}", file=sys.stderr, flush=True)
|
| 99 |
+
sys.exit(1)
|
| 100 |
+
|
| 101 |
+
print("===== All dependencies verified successfully =====", file=sys.stderr, flush=True)
|
| 102 |
|
| 103 |
# Environment registry
|
| 104 |
_ENV_CLASSES = {
|
requirements.txt
CHANGED
|
@@ -5,7 +5,9 @@
|
|
| 5 |
gradio>=4.0.0
|
| 6 |
numpy>=1.22.4,<2.0.0
|
| 7 |
pillow>=11.0.0
|
| 8 |
-
huggingface-hub
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Note: OpenPI and OpenVLA dependencies are installed in separate conda environments
|
| 11 |
# See requirements_openpi.txt and requirements_openvla.txt
|
|
|
|
| 5 |
gradio>=4.0.0
|
| 6 |
numpy>=1.22.4,<2.0.0
|
| 7 |
pillow>=11.0.0
|
| 8 |
+
# Pin huggingface-hub to version compatible with Gradio (HfFolder was removed in 0.26.0+)
|
| 9 |
+
# Gradio 4.x requires huggingface-hub < 0.26.0
|
| 10 |
+
huggingface-hub>=0.20.0,<0.26.0
|
| 11 |
|
| 12 |
# Note: OpenPI and OpenVLA dependencies are installed in separate conda environments
|
| 13 |
# See requirements_openpi.txt and requirements_openvla.txt
|
requirements_openpi.txt
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
# OpenPI environment dependencies
|
| 2 |
-
# PyTorch 2.7.0 for OpenPI
|
| 3 |
-
torch=
|
| 4 |
-
torchvision==0.20.0
|
| 5 |
-
torchaudio==2.7.0
|
| 6 |
|
| 7 |
# JAX and ML utilities
|
| 8 |
jax[cuda12]==0.5.3
|
|
@@ -39,11 +37,10 @@ transformers==4.48.1
|
|
| 39 |
rich>=14.0.0
|
| 40 |
polars>=1.30.0
|
| 41 |
|
| 42 |
-
# Hugging Face
|
| 43 |
datasets==3.6.0
|
| 44 |
-
huggingface-hub
|
| 45 |
diffusers==0.26.3
|
| 46 |
-
tokenizers>=0.19.1
|
| 47 |
|
| 48 |
# Utilities
|
| 49 |
hydra-core==1.3.2
|
|
|
|
| 1 |
# OpenPI environment dependencies
|
| 2 |
+
# PyTorch 2.7.0+ for OpenPI (working version from user's tested setup)
|
| 3 |
+
torch>=2.7.0
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# JAX and ML utilities
|
| 6 |
jax[cuda12]==0.5.3
|
|
|
|
| 37 |
rich>=14.0.0
|
| 38 |
polars>=1.30.0
|
| 39 |
|
| 40 |
+
# Hugging Face (simplified versions)
|
| 41 |
datasets==3.6.0
|
| 42 |
+
huggingface-hub==0.34.4
|
| 43 |
diffusers==0.26.3
|
|
|
|
| 44 |
|
| 45 |
# Utilities
|
| 46 |
hydra-core==1.3.2
|
setup.sh
CHANGED
|
@@ -79,5 +79,5 @@ echo "OpenPI environment ready"
|
|
| 79 |
echo ""
|
| 80 |
echo "===== Setup Complete ====="
|
| 81 |
echo "β Base environment: Gradio + RoboEval"
|
| 82 |
-
echo "β openpi_env: PyTorch 2.7 + OpenPI"
|
| 83 |
echo "βΉ openvla_env: Disabled (uncomment in setup.sh to enable)"
|
|
|
|
| 79 |
echo ""
|
| 80 |
echo "===== Setup Complete ====="
|
| 81 |
echo "β Base environment: Gradio + RoboEval"
|
| 82 |
+
echo "β openpi_env: PyTorch 2.7+ + OpenPI"
|
| 83 |
echo "βΉ openvla_env: Disabled (uncomment in setup.sh to enable)"
|