From d6de65e800ee59ed0e588fd4a6b1a2137f4db08c Mon Sep 17 00:00:00 2001 From: FederalSafe987 <107005192+FederalSafe987@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:15:52 -0600 Subject: [PATCH 1/3] Update process_modelscope.py --- scripts/modelscope/process_modelscope.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/modelscope/process_modelscope.py b/scripts/modelscope/process_modelscope.py index 0cbd55c..d5d5f06 100644 --- a/scripts/modelscope/process_modelscope.py +++ b/scripts/modelscope/process_modelscope.py @@ -131,7 +131,7 @@ def process_modelscope(args_dict, extra_args=None): print(f"Converted the frames to tensor {bfchw.shape}") - vd_out = torch.from_numpy(bcfhw).to("cuda") + vd_out = torch.from_numpy(bcfhw).to("cpu") # should be -1,1, not 0,1 vd_out = 2 * vd_out - 1 @@ -187,7 +187,7 @@ def process_modelscope(args_dict, extra_args=None): print(f"Converted the frames to tensor {bfchw.shape}") - vd_out = torch.from_numpy(bcfhw).to("cuda") + vd_out = torch.from_numpy(bcfhw).to("cpu") # should be -1,1, not 0,1 vd_out = 2 * vd_out - 1 From f856f6e26bec8e7ecafc8934e8c595dc64618bb5 Mon Sep 17 00:00:00 2001 From: FederalSafe987 <107005192+FederalSafe987@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:16:50 -0600 Subject: [PATCH 2/3] Update t2v_pipeline.py --- scripts/modelscope/t2v_pipeline.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/modelscope/t2v_pipeline.py b/scripts/modelscope/t2v_pipeline.py index c50a827..cdb33f1 100644 --- a/scripts/modelscope/t2v_pipeline.py +++ b/scripts/modelscope/t2v_pipeline.py @@ -100,8 +100,8 @@ def __init__(self, model_dir): strict=True, ) self.sd_model.eval() - if not devices.has_mps() or torch.cuda.is_available() == True: - self.sd_model.half() + #if not devices.has_mps() or torch.cuda.is_available() == True: + # self.sd_model.half() # Initialize diffusion betas = beta_schedule( @@ -145,8 +145,8 @@ def __init__(self, model_dir): self.clip_encoder.to("cpu") self.noise_gen = torch.Generator(device='cpu') - def compute_latents(self, vd_out, cpu_vae='GPU (half precision)', device=torch.device('cuda')): - self.device = device + def compute_latents(self, vd_out, cpu_vae='CPU', device=torch.device('cpu')): + self.device = torch.device('cpu') with torch.no_grad(): bs_vd, c, max_frames, height, width = vd_out.shape scale_factor = 0.18215 @@ -205,7 +205,7 @@ def infer( width=256, height=256, eta=0.0, - cpu_vae='GPU (half precision)', + cpu_vae='CPU', device=torch.device('cpu'), latents=None, skip_steps=0, @@ -245,7 +245,7 @@ def infer( A generated video (as list of np.arrays). """ - self.device = device + self.device = torch.device('cpu') self.clip_encoder.to(self.device) self.clip_encoder.device = self.device steps = steps - skip_steps From 48dd3f669729e974a9d3ece4141298e0ed9e117e Mon Sep 17 00:00:00 2001 From: FederalSafe987 <107005192+FederalSafe987@users.noreply.github.com> Date: Mon, 4 Dec 2023 17:11:55 -0500 Subject: [PATCH 3/3] Update sampler.py --- scripts/samplers/ddim/sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/samplers/ddim/sampler.py b/scripts/samplers/ddim/sampler.py index cdd2b94..678de2c 100644 --- a/scripts/samplers/ddim/sampler.py +++ b/scripts/samplers/ddim/sampler.py @@ -8,7 +8,7 @@ from t2v_helpers.general_utils import reconstruct_conds class DDIMSampler(object): - def __init__(self, model, schedule="linear", device=torch.device("cuda"), **kwargs): + def __init__(self, model, schedule="linear", device=torch.device("cpu"), **kwargs): super().__init__() self.model = model self.ddpm_num_timesteps = model.num_timesteps