restore 3.9 compatibility by replacing | with Union[]

This commit is contained in:
Lincoln Stein
2023-07-03 10:55:04 -04:00
parent 2465c7987b
commit ac9ec4e75a
16 changed files with 43 additions and 37 deletions

View File

@ -4,6 +4,7 @@ from contextlib import nullcontext
import torch
from torch import autocast
from typing import Union
from invokeai.app.services.config import InvokeAIAppConfig
CPU_DEVICE = torch.device("cpu")
@ -49,7 +50,7 @@ def choose_autocast(precision):
return nullcontext
def normalize_device(device: str | torch.device) -> torch.device:
def normalize_device(device: Union[str, torch.device]) -> torch.device:
"""Ensure device has a device index defined, if appropriate."""
device = torch.device(device)
if device.index is None: