mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 22:06:36 +00:00
142c6c4de8
- Replaced module-level path variables in constants.py with a structured Pydantic Config class. - Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure. - Fixed bugs related to image processing and model saving. - Enhanced test infrastructure to accommodate the new configuration approach. This refactor improves code maintainability and clarity by centralizing configuration management.
1.3 KiB
1.3 KiB
Module: hardware_service
Purpose
Collects hardware fingerprint information (CPU, GPU, RAM, drive serial) from the host machine for use in hardware-bound encryption key derivation.
Public Interface
| Function | Signature | Returns |
|---|---|---|
get_hardware_info |
() -> str |
Formatted string: CPU: {cpu}. GPU: {gpu}. Memory: {memory}. DriveSerial: {drive_serial} |
Internal Logic
- Detects OS via
os.name(ntfor Windows, else Linux) - Windows: PowerShell commands to query
Win32_Processor,Win32_VideoController,Win32_OperatingSystem, disk serial - Linux:
lscpu,lspci,free,/sys/block/sda/device/serial - Parses multi-line output: first line = CPU, second = GPU, second-to-last = memory, last = drive serial
- Handles multiple GPUs by taking first GPU and last two lines for memory/drive
Dependencies
os,subprocess(stdlib)
Consumers
api_client (used in load_bytes to generate hardware string for encryption)
Data Models
None.
Configuration
None.
External Integrations
Executes OS-level shell commands to query hardware.
Security
The hardware fingerprint is used as input to Security.get_hw_hash() and subsequently Security.get_api_encryption_key(), binding API encryption to the specific machine.
Tests
None.