Skip to content

Commit

Permalink
Merge branch 'release/4.0.0rc2'
Browse files Browse the repository at this point in the history
  • Loading branch information
hbredin committed Feb 23, 2025
2 parents 59af567 + c949032 commit 51113f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
Changelog
#########

Version 4.0.0rc2 (2025-02-23)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- feat(optimize): add option to pass keyword arguments to pipeline during optimization

Version 4.0.0rc1 (2025-02-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- feat(optimize): add option to pass keyword arguments to pipeline during optimization
- BREAKING: drop support for `Python` < 3.10
- BREAKING: switch to native namespace package
- BREAKING: remove `pyannote.pipeline.blocks` submodule
Expand Down
13 changes: 11 additions & 2 deletions src/pyannote/pipeline/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import time
import warnings
from pathlib import Path
from typing import Iterable, Optional, Callable, Generator, Union, Dict
from typing import Iterable, Optional, Callable, Generator, Mapping, Union, Dict

import numpy as np
import optuna.logging
Expand Down Expand Up @@ -231,7 +231,16 @@ def objective(trial: Trial) -> float:
# process input with pipeline
# (and keep track of processing time)
before_processing = time.time()
output = pipeline(input)

# get optional kwargs to be passed to the pipeline
# (e.g. num_speakers for speaker diarization). they
# must be stored in a 'pipeline_kwargs' key in the
# `input` dictionary.
if isinstance(input, Mapping):
pipeline_kwargs = input.get("pipeline_kwargs", {})
else:
pipeline_kwargs = {}
output = pipeline(input, **pipeline_kwargs)
after_processing = time.time()
processing_time.append(after_processing - before_processing)

Expand Down

0 comments on commit 51113f3

Please sign in to comment.