zhangjiewu commited on
Commit
6160590
·
verified ·
1 Parent(s): 5f4dd46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -70,8 +70,8 @@ if lora_path:
70
  )
71
  print(f"✓ Configured scheduler (flow_shift=2.0)")
72
 
73
- # pipe.enable_model_cpu_offload()
74
  pipe.to("cuda")
 
75
  end = time.time()
76
  print(f"Model loaded in {end - start:.2f}s.")
77
 
@@ -117,7 +117,8 @@ def run_inference(
117
  ):
118
  # Rewriter
119
  final_prompt = prompt
120
-
 
121
  # Enhance prompt with CoT reasoning
122
  start = time.time()
123
  cot_prompt = enhance_prompt(
@@ -128,6 +129,7 @@ def run_inference(
128
  )
129
  end = time.time()
130
  print(f"Prompt enhanced in {end - start:.2f}s")
 
131
 
132
  # Print enhanced CoT prompt
133
  print("\n" + "=" * 80)
@@ -160,6 +162,7 @@ def run_inference(
160
  guidance_scale=guidance_scale,
161
  enable_temporal_reasoning=enable_temporal_reasoning,
162
  num_temporal_reasoning_steps=num_temporal_reasoning_steps,
 
163
  ).frames[0]
164
  end = time.time()
165
  print(f"Generated video in {end - start:.2f}s")
 
70
  )
71
  print(f"✓ Configured scheduler (flow_shift=2.0)")
72
 
 
73
  pipe.to("cuda")
74
+ # pipe.enable_model_cpu_offload()
75
  end = time.time()
76
  print(f"Model loaded in {end - start:.2f}s.")
77
 
 
117
  ):
118
  # Rewriter
119
  final_prompt = prompt
120
+
121
+ prompt_model.to("cuda")
122
  # Enhance prompt with CoT reasoning
123
  start = time.time()
124
  cot_prompt = enhance_prompt(
 
129
  )
130
  end = time.time()
131
  print(f"Prompt enhanced in {end - start:.2f}s")
132
+ prompt_model.to("cpu")
133
 
134
  # Print enhanced CoT prompt
135
  print("\n" + "=" * 80)
 
162
  guidance_scale=guidance_scale,
163
  enable_temporal_reasoning=enable_temporal_reasoning,
164
  num_temporal_reasoning_steps=num_temporal_reasoning_steps,
165
+ # offload_model=True
166
  ).frames[0]
167
  end = time.time()
168
  print(f"Generated video in {end - start:.2f}s")