log
Module diagram
classDiagram
class log {
}
class dashboard {
}
class log_handler {
}
class logger {
}
class string_formatter {
}
log_handler --> dashboard
log_handler --> logger
log
dashboard
log_handler
LogHandler
LogHandler(name: str = 'SaigeResearch', logdir: Optional[str] = None, add_time_to_logdir: bool = False, logfile: Optional[str] = None, stdout: bool = False, level: str = 'INFO', formatter: str = f'%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s', dashboard: Optional[Dict] = None)
Source code in SaigeToolkit/log/log_handler.py
skip_if_logdir_is_none
Decorator to skip the method if logdir is None.
Source code in SaigeToolkit/log/log_handler.py
save_json
Save the data in the {self.logdir}/{json_path}.
Parameters:
-
data(Dict) –data to save
-
json_path(str, default:'log.json') –json path. Defaults to "log.json".
Source code in SaigeToolkit/log/log_handler.py
save_image
Save the image in the {self.logdir}/{file_path}.
Source code in SaigeToolkit/log/log_handler.py
save_code
Save the module codes in the "source_code" directory.
Parameters:
-
target(str) –module path
-
directory(str, default:'source_code') –save directory. Defaults to "source_code".
Source code in SaigeToolkit/log/log_handler.py
save_yaml
Save the dict in yaml format.
Parameters:
-
data(Dict) –Dict to save
-
filename(str) –filename
Source code in SaigeToolkit/log/log_handler.py
save_source_info
Save current time (KST) + git info + run command in "source_info.json".
Parameters:
-
git_path(str) –git directory path.
Source code in SaigeToolkit/log/log_handler.py
save_checkpoint
Save checkpoint in the "checkpoint" directory.
Parameters:
-
trainer(Trainer) –An instance containing information to be saved in the checkpoint.
-
filename(str) –filename
-
password(Optional[str], default:None) –Password for checkpoint file. Defaults to None.
Source code in SaigeToolkit/log/log_handler.py
logger
string_formatter
list_to_pretty_string
list_to_pretty_string(list_of_number: List[Union[int, float]], row_name: str = None, each_length: int = 10, indent: int = 12) -> str
list of Union[int, float] string으로 바꾸는 함수입니다. each_length의 길이가 되도록 " "를 늘려줍니다. log 예시:
Args: list_of_number (List[Union[int, float]]): 숫자가 들어있는 list입니다. row_name (str, optional): 각 row의 이름을 넣어줍니다. Defaults to None. each_length (int, optional): 각 원소마다 가지는 길이. Defaults to 10. indent (int, optional): indentation. Defaults to 12.Returns: str
Source code in SaigeToolkit/log/string_formatter.py
confusion_matrix_to_pretty_string
confusion_matrix_to_pretty_string(confusion_matrix: List[List[Union[int, float]]], each_length: int = 10, indent: int = 12) -> str
confusion matrix를 logging하기 위해 string으로 바꾸는 함수입니다. each_length의 길이가 되도록 " "를 늘려줍니다. log 예시:
...
2023-xx-xx xx:yy:zz,000 INFO [train.py:143]
object/confusion_matrix:
| class 0| class 1| class 2|
class 0| 0| 132| 123|
class 1| 1| 458| 8394|
class 2| 10| 1| 2|
object/accuracy: 0.0000
...
Returns: str