forked from tangger/lerobot
fix(lerobot/common/utils): remove lint warnings/errors
This commit is contained in:
@@ -68,9 +68,9 @@ class TimeBenchmark(ContextDecorator):
|
||||
Block took approximately 10.00 milliseconds
|
||||
"""
|
||||
|
||||
def __init__(self, print=False):
|
||||
def __init__(self, print_time=False):
|
||||
self.local = threading.local()
|
||||
self.print_time = print
|
||||
self.print_time = print_time
|
||||
|
||||
def __enter__(self):
|
||||
self.local.start_time = time.perf_counter()
|
||||
|
||||
@@ -46,7 +46,7 @@ def is_package_available(pkg_name: str, return_version: bool = False) -> tuple[b
|
||||
else:
|
||||
# For packages other than "torch", don't attempt the fallback and set as not available
|
||||
package_exists = False
|
||||
logging.debug(f"Detected {pkg_name} version: {package_version}")
|
||||
logging.debug("Detected %s version: %s", {pkg_name}, package_version)
|
||||
if return_version:
|
||||
return package_exists, package_version
|
||||
else:
|
||||
|
||||
@@ -27,6 +27,8 @@ class AverageMeter:
|
||||
def __init__(self, name: str, fmt: str = ":f"):
|
||||
self.name = name
|
||||
self.fmt = fmt
|
||||
self.val = 0.0
|
||||
self.avg = 0.0
|
||||
self.reset()
|
||||
|
||||
def reset(self) -> None:
|
||||
|
||||
@@ -69,7 +69,7 @@ def get_safe_torch_device(try_device: str, log: bool = False) -> torch.device:
|
||||
case _:
|
||||
device = torch.device(try_device)
|
||||
if log:
|
||||
logging.warning(f"Using custom {try_device} device.")
|
||||
logging.warning("Using custom %s device.", try_device)
|
||||
|
||||
return device
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class WandBLogger:
|
||||
resume="must" if cfg.resume else None,
|
||||
)
|
||||
print(colored("Logs will be synced with wandb.", "blue", attrs=["bold"]))
|
||||
logging.info(f"Track this run --> {colored(wandb.run.get_url(), 'yellow', attrs=['bold'])}")
|
||||
logging.info("Track this run --> %s", colored(wandb.run.get_url(), "yellow", attrs=["bold"]))
|
||||
self._wandb = wandb
|
||||
|
||||
def log_policy(self, checkpoint_dir: Path):
|
||||
@@ -108,7 +108,7 @@ class WandBLogger:
|
||||
for k, v in d.items():
|
||||
if not isinstance(v, (int, float, str)):
|
||||
logging.warning(
|
||||
f'WandB logging of key "{k}" was ignored as its type is not handled by this wrapper.'
|
||||
'WandB logging of key "%s" was ignored as its type is not handled by this wrapper.', k
|
||||
)
|
||||
continue
|
||||
self._wandb.log({f"{mode}/{k}": v}, step=step)
|
||||
|
||||
Reference in New Issue
Block a user