Accelerate documentation

Pencatatan

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

Pencatatan

Lihat panduan pemecahan masalah atau contoh di bawah untuk mempelajari cara menggunakan logger Accelerate.

accelerate.logging.get_logger

< >

( name: strlog_level: str | None = None )

Parameter

  • name (str) — Nama untuk logger, seperti __file__
  • log_level (str, opsional) — Tingkat log yang akan digunakan. Jika tidak diberikan, akan menggunakan variabel lingkungan LOG_LEVEL, atau INFO jika tidak ada

Mengembalikan logging.Logger untuk name yang dapat menangani multiprocessing.

Jika log harus dipanggil di semua proses, berikan main_process_only=False Jika log harus dipanggil di semua proses dan secara berurutan, berikan juga in_order=True

Contoh:

>>> 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