LokasNori commited on
Commit
7cc0813
1 Parent(s): 36de20d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -1,7 +1,5 @@
1
  import gradio as gr
2
  import torch
3
- import torch.distributed as dist
4
- import torch.multiprocessing as mp
5
  import time
6
  import json
7
  import os
@@ -13,12 +11,8 @@ from src.video_infinity.wrapper import DistWrapper
13
  def init_pipeline(config):
14
  pipe = VideoCrafterPipeline.from_pretrained(
15
  'adamdad/videocrafterv2_diffusers',
16
- torch_dtype=torch.float16
17
  )
18
- pipe.enable_model_cpu_offload(
19
- gpu_id=config["devices"][dist.get_rank() % len(config["devices"])],
20
- )
21
- pipe.enable_vae_slicing()
22
  return pipe
23
 
24
  def run_inference(prompt, config):
@@ -48,8 +42,8 @@ def demo(input_text):
48
  os.makedirs(base_path)
49
 
50
  config = {
51
- "devices": [0], # Укажите индексы ваших GPU, например [0] для одной GPU или [0, 1] для двух
52
- "base_path": base_path, # Указываем путь, где будут сохраняться видео
53
  "pipe_configs": {
54
  "prompts": [input_text]
55
  },
 
1
  import gradio as gr
2
  import torch
 
 
3
  import time
4
  import json
5
  import os
 
11
  def init_pipeline(config):
12
  pipe = VideoCrafterPipeline.from_pretrained(
13
  'adamdad/videocrafterv2_diffusers',
14
+ torch_dtype=torch.float32 # Используем float32 для CPU
15
  )
 
 
 
 
16
  return pipe
17
 
18
  def run_inference(prompt, config):
 
42
  os.makedirs(base_path)
43
 
44
  config = {
45
+ "devices": [0], # Используем CPU
46
+ "base_path": base_path, # Указываем путь для сохранения видео
47
  "pipe_configs": {
48
  "prompts": [input_text]
49
  },