refactor(scripts): update system info script (#2005)
* refactor(scripts): update system info script * chore(scripts): rename info script * feat(scripts): add entrypoint for info * chore(ci): update issue report template
This commit is contained in:
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -25,7 +25,7 @@ body:
|
|||||||
id: system-info
|
id: system-info
|
||||||
attributes:
|
attributes:
|
||||||
label: System Info
|
label: System Info
|
||||||
description: If needed, you can share your lerobot configuration with us by running `python -m lerobot.scripts.display_sys_info` and copy-pasting its outputs below
|
description: Please share your LeRobot configuration by running `lerobot-info` (if installed) or `python -m lerobot.scripts.display_sys_info` (if not installed) and pasting the output below.
|
||||||
render: Shell
|
render: Shell
|
||||||
placeholder: lerobot version, OS, python version, numpy version, torch version, and lerobot's configuration
|
placeholder: lerobot version, OS, python version, numpy version, torch version, and lerobot's configuration
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ lerobot-setup-motors="lerobot.setup_motors:main"
|
|||||||
lerobot-teleoperate="lerobot.teleoperate:main"
|
lerobot-teleoperate="lerobot.teleoperate:main"
|
||||||
lerobot-eval="lerobot.scripts.eval:main"
|
lerobot-eval="lerobot.scripts.eval:main"
|
||||||
lerobot-train="lerobot.scripts.train:main"
|
lerobot-train="lerobot.scripts.train:main"
|
||||||
|
lerobot-info="lerobot.scripts.lerobot_info:main"
|
||||||
|
|
||||||
# ---------------- Tool Configurations ----------------
|
# ---------------- Tool Configurations ----------------
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Copyright 2024 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.
|
|
||||||
|
|
||||||
"""Use this script to get a quick summary of your system config.
|
|
||||||
It should be able to run without any of LeRobot's dependencies or LeRobot itself installed.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import platform
|
|
||||||
|
|
||||||
HAS_HF_HUB = True
|
|
||||||
HAS_HF_DATASETS = True
|
|
||||||
HAS_NP = True
|
|
||||||
HAS_TORCH = True
|
|
||||||
HAS_LEROBOT = True
|
|
||||||
|
|
||||||
try:
|
|
||||||
import huggingface_hub
|
|
||||||
except ImportError:
|
|
||||||
HAS_HF_HUB = False
|
|
||||||
|
|
||||||
try:
|
|
||||||
import datasets
|
|
||||||
except ImportError:
|
|
||||||
HAS_HF_DATASETS = False
|
|
||||||
|
|
||||||
try:
|
|
||||||
import numpy as np
|
|
||||||
except ImportError:
|
|
||||||
HAS_NP = False
|
|
||||||
|
|
||||||
try:
|
|
||||||
import torch
|
|
||||||
except ImportError:
|
|
||||||
HAS_TORCH = False
|
|
||||||
|
|
||||||
try:
|
|
||||||
import lerobot
|
|
||||||
except ImportError:
|
|
||||||
HAS_LEROBOT = False
|
|
||||||
|
|
||||||
|
|
||||||
lerobot_version = lerobot.__version__ if HAS_LEROBOT else "N/A"
|
|
||||||
hf_hub_version = huggingface_hub.__version__ if HAS_HF_HUB else "N/A"
|
|
||||||
hf_datasets_version = datasets.__version__ if HAS_HF_DATASETS else "N/A"
|
|
||||||
np_version = np.__version__ if HAS_NP else "N/A"
|
|
||||||
|
|
||||||
torch_version = torch.__version__ if HAS_TORCH else "N/A"
|
|
||||||
torch_cuda_available = torch.cuda.is_available() if HAS_TORCH else "N/A"
|
|
||||||
cuda_version = torch._C._cuda_getCompiledVersion() if HAS_TORCH and torch.version.cuda is not None else "N/A"
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(aliberts): refactor into an actual command `lerobot env`
|
|
||||||
def display_sys_info() -> dict:
|
|
||||||
"""Run this to get basic system info to help for tracking issues & bugs."""
|
|
||||||
info = {
|
|
||||||
"`lerobot` version": lerobot_version,
|
|
||||||
"Platform": platform.platform(),
|
|
||||||
"Python version": platform.python_version(),
|
|
||||||
"Huggingface_hub version": hf_hub_version,
|
|
||||||
"Dataset version": hf_datasets_version,
|
|
||||||
"Numpy version": np_version,
|
|
||||||
"PyTorch version (GPU?)": f"{torch_version} ({torch_cuda_available})",
|
|
||||||
"Cuda version": cuda_version,
|
|
||||||
"Using GPU in script?": "<fill in>",
|
|
||||||
# "Using distributed or parallel set-up in script?": "<fill in>",
|
|
||||||
}
|
|
||||||
print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the last point.\n")
|
|
||||||
print(format_dict(info))
|
|
||||||
return info
|
|
||||||
|
|
||||||
|
|
||||||
def format_dict(d: dict) -> str:
|
|
||||||
return "\n".join([f"- {prop}: {val}" for prop, val in d.items()]) + "\n"
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
display_sys_info()
|
|
||||||
96
src/lerobot/scripts/lerobot_info.py
Normal file
96
src/lerobot/scripts/lerobot_info.py
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright 2024 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.
|
||||||
|
|
||||||
|
"""
|
||||||
|
Use this script to get a quick summary of your system config.
|
||||||
|
It should be able to run without any of LeRobot's dependencies or LeRobot itself installed.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
lerobot-info
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
|
||||||
|
import importlib
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
|
def get_package_version(package_name: str) -> str:
|
||||||
|
"""Get the version of a package if it exists, otherwise return 'N/A'."""
|
||||||
|
try:
|
||||||
|
module = importlib.import_module(package_name)
|
||||||
|
return getattr(module, "__version__", "Installed (version not found)")
|
||||||
|
except ImportError:
|
||||||
|
return "N/A"
|
||||||
|
|
||||||
|
|
||||||
|
def get_sys_info() -> dict:
|
||||||
|
"""Run this to get basic system info to help for tracking issues & bugs."""
|
||||||
|
# General package versions
|
||||||
|
info = {
|
||||||
|
"lerobot version": get_package_version("lerobot"),
|
||||||
|
"Platform": platform.platform(),
|
||||||
|
"Python version": platform.python_version(),
|
||||||
|
"Huggingface Hub version": get_package_version("huggingface_hub"),
|
||||||
|
"Datasets version": get_package_version("datasets"),
|
||||||
|
"Numpy version": get_package_version("numpy"),
|
||||||
|
}
|
||||||
|
|
||||||
|
# PyTorch and GPU specific information
|
||||||
|
torch_version = "N/A"
|
||||||
|
torch_cuda_available = "N/A"
|
||||||
|
cuda_version = "N/A"
|
||||||
|
gpu_model = "N/A"
|
||||||
|
try:
|
||||||
|
import torch
|
||||||
|
|
||||||
|
torch_version = torch.__version__
|
||||||
|
torch_cuda_available = torch.cuda.is_available()
|
||||||
|
if torch_cuda_available:
|
||||||
|
cuda_version = torch.version.cuda
|
||||||
|
# Gets the name of the first available GPU
|
||||||
|
gpu_model = torch.cuda.get_device_name(0)
|
||||||
|
except ImportError:
|
||||||
|
# If torch is not installed, the default "N/A" values will be used.
|
||||||
|
pass
|
||||||
|
|
||||||
|
info.update(
|
||||||
|
{
|
||||||
|
"PyTorch version": torch_version,
|
||||||
|
"Is PyTorch built with CUDA support?": torch_cuda_available,
|
||||||
|
"Cuda version": cuda_version,
|
||||||
|
"GPU model": gpu_model,
|
||||||
|
"Using GPU in script?": "<fill in>",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
def format_dict_for_markdown(d: dict) -> str:
|
||||||
|
"""Formats a dictionary into a markdown-friendly bulleted list."""
|
||||||
|
return "\n".join([f"- {prop}: {val}" for prop, val in d.items()])
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
system_info = get_sys_info()
|
||||||
|
print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the last point.\n")
|
||||||
|
print(format_dict_for_markdown(system_info))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user