diff --git a/src/transformers/pipelines/base.py b/src/transformers/pipelines/base.py index a0ce06ec5e33..7842b95b3285 100644 --- a/src/transformers/pipelines/base.py +++ b/src/transformers/pipelines/base.py @@ -768,7 +768,7 @@ def __init__( elif device < 0: self.device = torch.device("cpu") else: - self.device = torch.device("cuda:{device}") + self.device = torch.device(f"cuda:{device}") else: self.device = device self.binary_output = binary_output