From 9e60cdbc3f392b39143ee11b53cfec37c563682b Mon Sep 17 00:00:00 2001 From: cuba3 Date: Tue, 25 Jun 2024 15:24:46 +0800 Subject: [PATCH] Maintaining Project Compatibility for Python 3.9 Users Without Upgrade Requirements. Sole usage of Python 3.10's match-case in the project hinders quick-start for beginners; consider replacing with if-else for improved accessibility. --- modules/torch_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/torch_utils.py b/modules/torch_utils.py index a07e02853..5ea3da094 100644 --- a/modules/torch_utils.py +++ b/modules/torch_utils.py @@ -20,7 +20,6 @@ def get_param(model) -> torch.nn.Parameter: def float64(t: torch.Tensor): """return torch.float64 if device is not mps or xpu, else return torch.float32""" - match t.device.type: - case 'mps', 'xpu': - return torch.float32 + if t.device.type in ['mps', 'xpu']: + return torch.float32 return torch.float64