If set os.environ[“CUDA_VISIBLE_DEVICES”] = ‘1’ Invalid
you can place the code block os.environ["CUDA_VISIBLE_DEVICES"] = '1'
before all cuda code calls.
For example:
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '2'
import numpy as np
import torch
import cv2
from diffusers import (AutoencoderKL, DDIMScheduler,
DPMSolverMultistepScheduler,
EulerAncestralDiscreteScheduler, EulerDiscreteScheduler,
PNDMScheduler)
from omegaconf import OmegaConf