frankleeeee commited on
Commit
86cedd4
1 Parent(s): 984abfc
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -42,16 +42,15 @@ def install_dependencies(enable_optimization=False):
42
  except (ImportError, ModuleNotFoundError):
43
  return False
44
 
45
- if enable_optimization:# flash attention is needed no matter optimization is enabled or not
46
- # because Hugging Face transformers detects flash_attn is a dependency in STDiT
47
- # thus, we need to install it no matter what
48
  if not _is_package_available("flash_attn"):
49
  subprocess.run(
50
  f"{sys.executable} -m pip install flash-attn --no-build-isolation",
51
  env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
52
  shell=True,
53
  )
54
-
55
  # install apex for fused layernorm
56
  if not _is_package_available("apex"):
57
  subprocess.run(
@@ -184,6 +183,7 @@ from opensora.utils.inference_utils import (
184
  prepare_multi_resolution_info,
185
  refine_prompts_by_openai,
186
  split_prompt,
 
187
  )
188
  from opensora.utils.misc import to_torch_dtype
189
 
@@ -513,13 +513,13 @@ def main():
513
  with gr.Row():
514
  with gr.Column():
515
  prompt_text = gr.Textbox(label="Prompt", placeholder="Describe your video here", lines=4)
516
- refine_prompt = gr.Checkbox(value=True, label="Refine prompt with GPT4o")
517
- random_prompt_btn = gr.Button("Random Prompt By GPT4o")
518
 
519
  gr.Markdown("## Basic Settings")
520
  resolution = gr.Radio(
521
  choices=["144p", "240p", "360p", "480p", "720p"],
522
- value="480p",
523
  label="Resolution",
524
  )
525
  aspect_ratio = gr.Radio(
 
42
  except (ImportError, ModuleNotFoundError):
43
  return False
44
 
45
+ if enable_optimization:
46
+ # install flash attention
 
47
  if not _is_package_available("flash_attn"):
48
  subprocess.run(
49
  f"{sys.executable} -m pip install flash-attn --no-build-isolation",
50
  env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
51
  shell=True,
52
  )
53
+
54
  # install apex for fused layernorm
55
  if not _is_package_available("apex"):
56
  subprocess.run(
 
183
  prepare_multi_resolution_info,
184
  refine_prompts_by_openai,
185
  split_prompt,
186
+ has_openai_key
187
  )
188
  from opensora.utils.misc import to_torch_dtype
189
 
 
513
  with gr.Row():
514
  with gr.Column():
515
  prompt_text = gr.Textbox(label="Prompt", placeholder="Describe your video here", lines=4)
516
+ refine_prompt = gr.Checkbox(value=has_openai_key(), label="Refine prompt with GPT4o", interactive=has_openai_key())
517
+ random_prompt_btn = gr.Button("Random Prompt By GPT4o", interactive=has_openai_key())
518
 
519
  gr.Markdown("## Basic Settings")
520
  resolution = gr.Radio(
521
  choices=["144p", "240p", "360p", "480p", "720p"],
522
+ value="240p",
523
  label="Resolution",
524
  )
525
  aspect_ratio = gr.Radio(