AMCT (PyTorch)
This section describes how to set the log information and log level using environment variables during AMCT quantization.
Logs include logs printed to the screen and logs saved in the amct_log/amct_pytorch.log file. The environment variables are optional. If they are not set, the default log level INFO is used.
Logs in the amct_pytorch.log file will be overwritten when quantization is performed again. You need to save the logs. In addition, the size of the generated log file is related to the number of layers of the model to be quantized. Ensure that the server where AMCT is installed has sufficient space.
Take the ResNet-101 model as an example. If the log level is set to INFO, the log file size is about 5 KB, and the size of the temporary file is about 170 MB. If the log level is set to DEBUG, the log file size is about 2 MB, and the size of the temporary file is about 170 MB.
- Variables
The log level is set by the following variables:
- AMCT_LOG_FILE_LEVEL: specifies the level of messages in the amct_pytorch.log file and the level of messages in the log file generated of the corresponding quantizable layer when the fake-quantized model is generated.
- AMCT_LOG_LEVEL: specifies the level of information printed to the screen.
Table 1 lists the valid values and their meanings.Table 1 Variables Log Level
Description
Details
DEBUG
DEBUG, INFO, WARNING, and ERROR logs.
Detailed process messages, including the quantization layer and corresponding processing phase (fusion, parameter quantization, or activation quantization)
INFO
INFO, WARNING, and ERROR logs. Defaults to INFO.
Brief quantization processing messages, including the quantization phase.
WARNING
WARNING and ERROR logs.
Warning messages during quantization.
ERROR
ERROR logs.
Error messages during quantization.
Log levels are case insensitive. For instance, Info, info, and INFO are all valid values.
- Command ExampleThe following commands are only examples. You can set the parameters based on your need.
- Set the information level of the quantization log amct_pytorch.log to INFO.
export AMCT_LOG_FILE_LEVEL=INFO
- Set the level of the information displayed on the screen to INFO.
export AMCT_LOG_LEVEL=INFO
- Set the information level of the quantization log amct_pytorch.log to INFO.