This document describes the environment variables used by AutoRound for configuration and their usage.
AutoRound uses a centralized environment variable management system through the envs.py module. This system provides lazy evaluation of environment variables and programmatic configuration capabilities.
- Description: Controls the default logging level for AutoRound
- Default:
"INFO" - Valid Values:
"TRACE","DEBUG","INFO","WARNING","ERROR","CRITICAL" - Usage: Set this to control the verbosity of AutoRound logs
export AR_LOG_LEVEL=DEBUG- Description: Enables compile packing optimization
- Default:
False(equivalent to"0") - Valid Values:
"1","true","yes"(case-insensitive) for enabling; any other value for disabling - Usage: Enable this for performance optimizations during packing FP4 tensors into
uint8.
export AR_ENABLE_COMPILE_PACKING=1- Description: Controls whether to use ModelScope for model downloads
- Default:
False - Valid Values:
"1","true"(case-insensitive) for enabling; any other value for disabling - Usage: Enable this to use ModelScope instead of Hugging Face Hub for model downloads
export AR_USE_MODELSCOPE=true- Description: Sets the workspace directory for AutoRound operations
- Default:
"ar_work_space" - Usage: Specify a custom directory for AutoRound to store temporary files and outputs
export AR_WORK_SPACE=/path/to/custom/workspace# Set logging level to DEBUG
export AR_LOG_LEVEL=DEBUG
# Enable compile packing
export AR_ENABLE_COMPILE_PACKING=1
# Use ModelScope for downloads
export AR_USE_MODELSCOPE=true
# Set custom workspace
export AR_WORK_SPACE=/tmp/autoround_workspacefrom auto_round.envs import set_config
# Configure multiple environment variables at once
set_config(
AR_LOG_LEVEL="DEBUG",
AR_USE_MODELSCOPE=True,
AR_ENABLE_COMPILE_PACKING=True,
AR_WORK_SPACE="/tmp/autoround_workspace",
)from auto_round import envs
# Access environment variables (lazy evaluation)
log_level = envs.AR_LOG_LEVEL
use_modelscope = envs.AR_USE_MODELSCOPE
enable_packing = envs.AR_ENABLE_COMPILE_PACKING
workspace = envs.AR_WORK_SPACE
print(f"Log Level: {log_level}")
print(f"Use ModelScope: {use_modelscope}")
print(f"Enable Compile Packing: {enable_packing}")
print(f"Workspace: {workspace}")from auto_round.envs import is_set
# Check if environment variables are explicitly set
if is_set("AR_LOG_LEVEL"):
print("AR_LOG_LEVEL is explicitly set")
else:
print("AR_LOG_LEVEL is using default value")- Development Environment: Set
AR_LOG_LEVEL=TRACEorAR_LOG_LEVEL=DEBUGfor detailed logging during development - Production Environment: Use
AR_LOG_LEVEL=WARNINGorAR_LOG_LEVEL=ERRORto reduce log noise - Chinese Users: Consider setting
AR_USE_MODELSCOPE=truefor better model download performance - Performance Optimization: Enable
AR_ENABLE_COMPILE_PACKING=1if you have sufficient computational resources - Custom Workspace: Set
AR_WORK_SPACEto a directory with sufficient disk space for model processing
- Environment variables are evaluated lazily, meaning they are only read when first accessed
- The
set_config()function provides a convenient way to configure multiple variables programmatically - Boolean values for
AR_USE_MODELSCOPEare automatically converted to appropriate string representations - All environment variable names are case-sensitive
- Changes made through
set_config()will affect the current process and any child processes