forked from tangger/lerobot
chore(utils): move queue utils and wandb_utils to their respective modules (#2030)
* chore(utils): move queue utils and wandb_utils to their respective modules * fix(rl): remove double imports --------- Signed-off-by: Steven Palma <imstevenpmwork@ieee.org>
This commit is contained in:
@@ -64,6 +64,7 @@ from lerobot.policies.factory import make_policy
|
|||||||
from lerobot.policies.sac.modeling_sac import SACPolicy
|
from lerobot.policies.sac.modeling_sac import SACPolicy
|
||||||
from lerobot.processor import TransitionKey
|
from lerobot.processor import TransitionKey
|
||||||
from lerobot.rl.process import ProcessSignalHandler
|
from lerobot.rl.process import ProcessSignalHandler
|
||||||
|
from lerobot.rl.queue import get_last_item_from_queue
|
||||||
from lerobot.robots import so100_follower # noqa: F401
|
from lerobot.robots import so100_follower # noqa: F401
|
||||||
from lerobot.teleoperators import gamepad, so101_leader # noqa: F401
|
from lerobot.teleoperators import gamepad, so101_leader # noqa: F401
|
||||||
from lerobot.teleoperators.utils import TeleopEvents
|
from lerobot.teleoperators.utils import TeleopEvents
|
||||||
@@ -76,7 +77,6 @@ from lerobot.transport.utils import (
|
|||||||
send_bytes_in_chunks,
|
send_bytes_in_chunks,
|
||||||
transitions_to_bytes,
|
transitions_to_bytes,
|
||||||
)
|
)
|
||||||
from lerobot.utils.queue import get_last_item_from_queue
|
|
||||||
from lerobot.utils.random_utils import set_seed
|
from lerobot.utils.random_utils import set_seed
|
||||||
from lerobot.utils.robot_utils import busy_wait
|
from lerobot.utils.robot_utils import busy_wait
|
||||||
from lerobot.utils.transition import (
|
from lerobot.utils.transition import (
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ from lerobot.policies.factory import make_policy
|
|||||||
from lerobot.policies.sac.modeling_sac import SACPolicy
|
from lerobot.policies.sac.modeling_sac import SACPolicy
|
||||||
from lerobot.rl.buffer import ReplayBuffer, concatenate_batch_transitions
|
from lerobot.rl.buffer import ReplayBuffer, concatenate_batch_transitions
|
||||||
from lerobot.rl.process import ProcessSignalHandler
|
from lerobot.rl.process import ProcessSignalHandler
|
||||||
|
from lerobot.rl.wandb_utils import WandBLogger
|
||||||
from lerobot.robots import so100_follower # noqa: F401
|
from lerobot.robots import so100_follower # noqa: F401
|
||||||
from lerobot.teleoperators import gamepad, so101_leader # noqa: F401
|
from lerobot.teleoperators import gamepad, so101_leader # noqa: F401
|
||||||
from lerobot.teleoperators.utils import TeleopEvents
|
from lerobot.teleoperators.utils import TeleopEvents
|
||||||
@@ -97,7 +98,6 @@ from lerobot.utils.utils import (
|
|||||||
get_safe_torch_device,
|
get_safe_torch_device,
|
||||||
init_logging,
|
init_logging,
|
||||||
)
|
)
|
||||||
from lerobot.utils.wandb_utils import WandBLogger
|
|
||||||
|
|
||||||
from .learner_service import MAX_WORKERS, SHUTDOWN_TIMEOUT, LearnerService
|
from .learner_service import MAX_WORKERS, SHUTDOWN_TIMEOUT, LearnerService
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ def train(cfg: TrainRLServerPipelineConfig, job_name: str | None = None):
|
|||||||
|
|
||||||
# Setup WandB logging if enabled
|
# Setup WandB logging if enabled
|
||||||
if cfg.wandb.enable and cfg.wandb.project:
|
if cfg.wandb.enable and cfg.wandb.project:
|
||||||
from lerobot.utils.wandb_utils import WandBLogger
|
from lerobot.rl.wandb_utils import WandBLogger
|
||||||
|
|
||||||
wandb_logger = WandBLogger(cfg)
|
wandb_logger = WandBLogger(cfg)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from multiprocessing import Event, Queue
|
from multiprocessing import Event, Queue
|
||||||
|
|
||||||
|
from lerobot.rl.queue import get_last_item_from_queue
|
||||||
from lerobot.transport import services_pb2, services_pb2_grpc
|
from lerobot.transport import services_pb2, services_pb2_grpc
|
||||||
from lerobot.transport.utils import receive_bytes_in_chunks, send_bytes_in_chunks
|
from lerobot.transport.utils import receive_bytes_in_chunks, send_bytes_in_chunks
|
||||||
from lerobot.utils.queue import get_last_item_from_queue
|
|
||||||
|
|
||||||
MAX_WORKERS = 3 # Stream parameters, send transitions and interactions
|
MAX_WORKERS = 3 # Stream parameters, send transitions and interactions
|
||||||
SHUTDOWN_TIMEOUT = 10
|
SHUTDOWN_TIMEOUT = 10
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ from lerobot.optim.factory import make_optimizer_and_scheduler
|
|||||||
from lerobot.policies.factory import make_policy, make_pre_post_processors
|
from lerobot.policies.factory import make_policy, make_pre_post_processors
|
||||||
from lerobot.policies.pretrained import PreTrainedPolicy
|
from lerobot.policies.pretrained import PreTrainedPolicy
|
||||||
from lerobot.policies.utils import get_device_from_parameters
|
from lerobot.policies.utils import get_device_from_parameters
|
||||||
|
from lerobot.rl.wandb_utils import WandBLogger
|
||||||
from lerobot.scripts.eval import eval_policy_all
|
from lerobot.scripts.eval import eval_policy_all
|
||||||
from lerobot.utils.logging_utils import AverageMeter, MetricsTracker
|
from lerobot.utils.logging_utils import AverageMeter, MetricsTracker
|
||||||
from lerobot.utils.random_utils import set_seed
|
from lerobot.utils.random_utils import set_seed
|
||||||
@@ -51,7 +52,6 @@ from lerobot.utils.utils import (
|
|||||||
has_method,
|
has_method,
|
||||||
init_logging,
|
init_logging,
|
||||||
)
|
)
|
||||||
from lerobot.utils.wandb_utils import WandBLogger
|
|
||||||
|
|
||||||
|
|
||||||
def update_policy(
|
def update_policy(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from queue import Queue
|
|||||||
|
|
||||||
from torch.multiprocessing import Queue as TorchMPQueue
|
from torch.multiprocessing import Queue as TorchMPQueue
|
||||||
|
|
||||||
from lerobot.utils.queue import get_last_item_from_queue
|
from lerobot.rl.queue import get_last_item_from_queue
|
||||||
|
|
||||||
|
|
||||||
def test_get_last_item_single_item():
|
def test_get_last_item_single_item():
|
||||||
Reference in New Issue
Block a user