Skip to content

Commit

Permalink
Do not override log_memory_usage when debug logs are enabled. The spe…
Browse files Browse the repository at this point in the history
…ed cost of log_memory_usage=True is large. It is common to want debug log without enabling log_memory_usage.
  • Loading branch information
RyanJDick authored and psychedelicious committed Mar 11, 2024
1 parent 149ff75 commit 9ee2e7f
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""

import gc
import logging
import math
import sys
import time
Expand Down Expand Up @@ -92,8 +91,7 @@ def __init__(
self._execution_device: torch.device = execution_device
self._storage_device: torch.device = storage_device
self._logger = logger or InvokeAILogger.get_logger(self.__class__.__name__)
self._log_memory_usage = log_memory_usage or self._logger.level == logging.DEBUG
# used for stats collection
self._log_memory_usage = log_memory_usage
self._stats: Optional[CacheStats] = None

self._cached_models: Dict[str, CacheRecord[AnyModel]] = {}
Expand Down

0 comments on commit 9ee2e7f

Please sign in to comment.