Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import random
import signal
import warnings
from collections.abc import Callable

import psutil
import pytest
Expand Down Expand Up @@ -73,7 +74,7 @@ def set_tmp_dir(self, tmp_path):
self.tmp_dir = str(tmp_path)


def ignore_warnings(message: str = None, category: type[Warning] = Warning) -> callable:
def ignore_warnings(message: str = None, category: type[Warning] = Warning) -> Callable:
"""
Decorator to ignore warnings with a specific message and/or category.

Expand Down
6 changes: 3 additions & 3 deletions trl/extras/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import contextlib
import functools
import time
from collections.abc import Generator
from collections.abc import Callable, Generator

from transformers import Trainer
from transformers.integrations import is_mlflow_available, is_wandb_available
Expand Down Expand Up @@ -68,12 +68,12 @@ def some_method(self):
mlflow.log_metrics(profiling_metrics, step=trainer.state.global_step)


def profiling_decorator(func: callable) -> callable:
def profiling_decorator(func: Callable) -> Callable:
"""
Decorator to profile a function and log execution time using [`extras.profiling.profiling_context`].

Args:
func (`callable`):
func (`Callable`):
Function to be profiled.

Example:
Expand Down
3 changes: 2 additions & 1 deletion trl/trainer/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import logging
import os
from collections.abc import Callable
from typing import Optional, Union

import pandas as pd
Expand Down Expand Up @@ -583,7 +584,7 @@ def __init__(
self,
trainer: Trainer,
project_name: Optional[str] = None,
scorers: Optional[dict[str, callable]] = None,
scorers: Optional[dict[str, Callable]] = None,
generation_config: Optional[GenerationConfig] = None,
num_prompts: Optional[int] = None,
dataset_name: str = "eval_dataset",
Expand Down
Loading