mirror of
https://github.com/brycedrennan/imaginAIry
synced 2024-11-05 12:00:15 +00:00
9eacf5e7ed
just running `aimg --help` or `aimg --version` was very slow due to all the imports being brought in eagerly Before changes `aimg --help` `2.24s user 4.05s system 184% cpu 3.416 total` After changes: `0.04s user 0.02s system 8% cpu 0.625 total` Used `PYTHONPROFILEIMPORTTIME=1 aimg --help` to find time consuming imports. Also switched to using `scripts` instead of `entrypoints` since the scripts are much faster. Made duplicate SAMPLER_TYPE_OPTIONS that can be loaded without loading all the samplers themselves. Likely a breaking change - not sure.
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import os.path
|
|
import sys
|
|
|
|
import torch
|
|
|
|
from imaginairy.utils import get_device, get_hardware_description
|
|
from imaginairy.version import get_version
|
|
|
|
|
|
def get_debug_info():
|
|
|
|
data = {
|
|
"imaginairy_version": get_version(),
|
|
"imaginairy_path": os.path.dirname(__file__),
|
|
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
|
"python_installation_path": sys.executable,
|
|
"device": get_device(),
|
|
"torch_version": torch.__version__,
|
|
"platform": sys.platform,
|
|
"hardware_description": get_hardware_description(get_device()),
|
|
}
|
|
if torch.cuda.is_available():
|
|
device_props = torch.cuda.get_device_properties(0)
|
|
data.update(
|
|
{
|
|
"cuda_version": torch.version.cuda,
|
|
"graphics_card": device_props.name,
|
|
"graphics_card_memory": device_props.total_memory,
|
|
"graphics_card_processor_count": device_props.multi_processor_count,
|
|
"graphics_card_hw_version": f"{device_props.major}.{device_props.minor}",
|
|
}
|
|
)
|
|
return data
|