fffiloni commited on
Commit
b29876f
·
verified ·
1 Parent(s): b9ef8a9

install flash attn on runtime

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -7,6 +7,20 @@ import tempfile
7
  import spaces
8
  import gradio as gr
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  import cv2
11
  try:
12
  from mmengine.visualization import Visualizer
 
7
  import spaces
8
  import gradio as gr
9
 
10
+ import subprocess
11
+ import sys
12
+
13
+ def install_flash_attn_wheel():
14
+ flash_attn_wheel_url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl"
15
+ try:
16
+ # Call pip to install the wheel file
17
+ subprocess.check_call([sys.executable, "-m", "pip", "install", flash_attn_wheel_url])
18
+ print("Wheel installed successfully!")
19
+ except subprocess.CalledProcessError as e:
20
+ print(f"Failed to install the flash attnetion wheel. Error: {e}")
21
+
22
+ install_flash_attn_wheel()
23
+
24
  import cv2
25
  try:
26
  from mmengine.visualization import Visualizer