Priyanshi Saxena commited on
Commit
3f8cfad
·
1 Parent(s): 9451ca9

Fix dependency versions and improve error handling

Browse files
Files changed (2) hide show
  1. requirements.txt +4 -3
  2. src/video_generator.py +3 -1
requirements.txt CHANGED
@@ -2,9 +2,10 @@ gradio==4.44.0
2
  torch==2.1.0
3
  torchvision==0.16.0
4
  torchaudio==2.1.0
5
- diffusers==0.24.0
6
- transformers==4.36.0
7
- accelerate==0.25.0
 
8
  opencv-python==4.8.1.78
9
  Pillow==10.1.0
10
  moviepy==1.0.3
 
2
  torch==2.1.0
3
  torchvision==0.16.0
4
  torchaudio==2.1.0
5
+ diffusers==0.30.0
6
+ transformers==4.44.0
7
+ accelerate==0.34.0
8
+ huggingface_hub==0.24.0
9
  opencv-python==4.8.1.78
10
  Pillow==10.1.0
11
  moviepy==1.0.3
src/video_generator.py CHANGED
@@ -1,5 +1,4 @@
1
  import torch
2
- from diffusers import StableVideoDiffusionPipeline
3
  from PIL import Image
4
  import numpy as np
5
  from config.settings import DEVICE, MODEL_CONFIG, PROCESSING_CONFIG
@@ -12,6 +11,7 @@ class VideoGenerator:
12
  def _load_models(self):
13
  if DEVICE == "cuda":
14
  try:
 
15
  self.pipeline = StableVideoDiffusionPipeline.from_pretrained(
16
  MODEL_CONFIG['svd_model'],
17
  torch_dtype=torch.float16,
@@ -21,9 +21,11 @@ class VideoGenerator:
21
  self.pipeline.enable_model_cpu_offload()
22
  except Exception as e:
23
  print(f"Failed to load SVD: {e}")
 
24
 
25
  def generate_video(self, image, prompt, duration=2):
26
  if not self.pipeline:
 
27
  return None
28
 
29
  try:
 
1
  import torch
 
2
  from PIL import Image
3
  import numpy as np
4
  from config.settings import DEVICE, MODEL_CONFIG, PROCESSING_CONFIG
 
11
  def _load_models(self):
12
  if DEVICE == "cuda":
13
  try:
14
+ from diffusers import StableVideoDiffusionPipeline
15
  self.pipeline = StableVideoDiffusionPipeline.from_pretrained(
16
  MODEL_CONFIG['svd_model'],
17
  torch_dtype=torch.float16,
 
21
  self.pipeline.enable_model_cpu_offload()
22
  except Exception as e:
23
  print(f"Failed to load SVD: {e}")
24
+ self.pipeline = None
25
 
26
  def generate_video(self, image, prompt, duration=2):
27
  if not self.pipeline:
28
+ print("Pipeline not available, skipping video generation")
29
  return None
30
 
31
  try: