Skip to content

Commit

Permalink
improve(pipeline): track all Module instances (not just Model's) (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbredin authored Feb 8, 2024
1 parent 8b66bfd commit 6e22f41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
### Improvements

- improve(metric): add support for number of speakers mismatch in `diarization_error_rate` metric
- improve(pipeline): track both `Model` and `nn.Module` attributes in `Pipeline.to(device)`

## Breaking changes

Expand Down
3 changes: 2 additions & 1 deletion pyannote/audio/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from typing import Callable, Dict, List, Optional, Text, Union

import torch
import torch.nn as nn
import yaml
from huggingface_hub import hf_hub_download
from huggingface_hub.utils import RepositoryNotFoundError
Expand Down Expand Up @@ -232,7 +233,7 @@ def remove_from(*dicts):
_models = self.__dict__.get("_models")
_inferences = self.__dict__.get("_inferences")

if isinstance(value, Model):
if isinstance(value, nn.Module):
if _models is None:
msg = "cannot assign models before Pipeline.__init__() call"
raise AttributeError(msg)
Expand Down

0 comments on commit 6e22f41

Please sign in to comment.