Accelerate documentation

로깅

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v1.15.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

로깅

Accelerate의 로거 사용법을 배우려면 문제 해결 가이드 또는 아래 예시를 참조하세요.

accelerate.logging.get_logger

< >

( name: strlog_level: str | None = None )

매개변수

  • name (str) — 로거의 이름, 예: __file__
  • log_level (str, 선택 사항) — 사용할 로그 레벨입니다. 전달되지 않으면 LOG_LEVEL 환경 변수를 기본값으로 사용하며, 이 값도 없으면 INFO를 사용합니다.

name에 대해 멀티프로세싱을 처리할 수 있는 logging.Logger를 반환합니다.

모든 프로세스에서 로그를 호출해야 하는 경우 main_process_only=False를 전달합니다. 모든 프로세스에서 순서대로 로그를 호출해야 하는 경우 in_order=True도 함께 전달합니다.

예:

>>> from accelerate.logging import get_logger
>>> from accelerate import Accelerator

>>> logger = get_logger(__name__)

>>> accelerator = Accelerator()
>>> logger.info("My log", main_process_only=False)
>>> logger.debug("My log", main_process_only=True)

>>> logger = get_logger(__name__, log_level="DEBUG")
>>> logger.info("My log")
>>> logger.debug("My second log")

>>> array = ["a", "b", "c", "d"]
>>> letter_at_rank = array[accelerator.process_index]
>>> logger.info(letter_at_rank, in_order=True)
Update on GitHub