Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dexbotic/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from collections import deque
import logging
import requests
import math

import numpy as np
import cv2

logger = logging.getLogger(__name__)


class DexClient:
def __init__(self,
Expand Down Expand Up @@ -86,4 +89,4 @@ def delta_action(self, last_action, delta_action):
action = client.act(
observation,
"What action should the robot take to put both moka pots on the stove?")
print("Action taken:", action)
logger.info("Action taken: %s", action)
9 changes: 5 additions & 4 deletions dexbotic/rl/_embodied_cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from __future__ import annotations

import json
import logging
import os

import torch.multiprocessing as mp
from omegaconf import OmegaConf

logger = logging.getLogger(__name__)

from rlinf.config import validate_cfg
from rlinf.runners.embodied_runner import EmbodiedRunner
from rlinf.scheduler import Cluster
Expand All @@ -25,12 +28,10 @@ def run_embodied_rl(cfg) -> None:

register_all()

print(
"[Dexbotic RL] Launching from Dexbotic entrypoint with RLinf as backend."
)
logger.info("[Dexbotic RL] Launching from Dexbotic entrypoint with RLinf as backend.")

cfg = validate_cfg(cfg)
print(json.dumps(OmegaConf.to_container(cfg, resolve=True), indent=2))
logger.info(json.dumps(OmegaConf.to_container(cfg, resolve=True), indent=2))

cluster = Cluster(
cluster_cfg=cfg.cluster, distributed_log_dir=cfg.runner.per_worker_log_path
Expand Down
7 changes: 5 additions & 2 deletions playground/example_navila_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

"""
import argparse
import logging
from collections import deque
from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional

logger = logging.getLogger(__name__)

from dexbotic.data.dataset.transform.common import Pipeline, ToDict, ToList, ToNumpy
from dexbotic.data.dataset.transform.multimodal import LoadMultiModal
from dexbotic.exp.navila_exp import (
Expand Down Expand Up @@ -139,7 +142,7 @@ def inference_single(
with open(image_path, "rb") as f:
image_bytes = f.read()
except FileNotFoundError:
print(f"Error: image file not found {image_path}")
logger.error("Error: image file not found %s", image_path)
return None

images_list = self.inference_config._prepare_images(image_bytes)
Expand All @@ -150,7 +153,7 @@ def inference_single(
text=prompt,
images=images_list,
)
print(f"Inference result: {result}")
logger.info("Inference result: %s", result)
return result


Expand Down