Skip to content

Commit

Permalink
add warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
artek0chumak committed Sep 25, 2024
1 parent 7d8dbc7 commit e3b2cea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/together/resources/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
TrainingType,
)
from together.types.finetune import DownloadCheckpointType
from together.utils import log_warn, normalize_key
from together.utils import log_warn_once, normalize_key


class FineTuning:
Expand Down Expand Up @@ -82,6 +82,12 @@ def create(
FinetuneResponse: Object containing information about fine-tuning job.
"""

if batch_size == "max":
log_warn_once(
"Since 1.3.0, batch size is automatically set to max. "
"This behavior can be disabled by setting the `batch_size` parameter to an integer value."
)

requestor = api_requestor.APIRequestor(
client=self._client,
)
Expand Down
10 changes: 10 additions & 0 deletions src/together/utils/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

TOGETHER_LOG = os.environ.get("TOGETHER_LOG")

WARNING_MESSAGES_ONCE = set()


def _console_log_level() -> str | None:
if together.log in ["debug", "info"]:
Expand Down Expand Up @@ -59,3 +61,11 @@ def log_warn(message: str | Any, **params: Any) -> None:
msg = logfmt(dict(message=message, **params))
print(msg, file=sys.stderr)
logger.warn(msg)


def log_warn_once(message: str | Any, **params: Any) -> None:
msg = logfmt(dict(message=message, **params))
if msg not in WARNING_MESSAGES_ONCE:
print(msg, file=sys.stderr)
logger.warn(msg)
WARNING_MESSAGES_ONCE.add(msg)

0 comments on commit e3b2cea

Please sign in to comment.