prithivMLmods commited on
Commit
e9f1eff
·
verified ·
1 Parent(s): 1796948

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import sys
 
3
  from threading import Thread
4
  from typing import Iterable
5
  from huggingface_hub import snapshot_download
@@ -19,6 +20,14 @@ from gradio.themes.utils import colors, fonts, sizes
19
 
20
  # --- Theme and CSS Definition ---
21
 
 
 
 
 
 
 
 
 
22
  colors.steel_blue = colors.Color(
23
  name="steel_blue",
24
  c50="#EBF3F8",
@@ -153,7 +162,7 @@ MODEL_PATH_D = model_path_d_local
153
  processor_d = AutoProcessor.from_pretrained(MODEL_PATH_D, trust_remote_code=True)
154
  model_d = AutoModelForCausalLM.from_pretrained(
155
  MODEL_PATH_D,
156
- attn_implementation="eager",
157
  torch_dtype=torch.bfloat16,
158
  device_map="auto",
159
  trust_remote_code=True
 
1
  import os
2
  import sys
3
+ import subprocess
4
  from threading import Thread
5
  from typing import Iterable
6
  from huggingface_hub import snapshot_download
 
20
 
21
  # --- Theme and CSS Definition ---
22
 
23
+ # Attempt to install flash-attn
24
+ try:
25
+ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, check=True, shell=True)
26
+ except subprocess.CalledProcessError as e:
27
+ print(f"Error installing flash-attn: {e}")
28
+ print("Continuing without flash-attn.")
29
+
30
+
31
  colors.steel_blue = colors.Color(
32
  name="steel_blue",
33
  c50="#EBF3F8",
 
162
  processor_d = AutoProcessor.from_pretrained(MODEL_PATH_D, trust_remote_code=True)
163
  model_d = AutoModelForCausalLM.from_pretrained(
164
  MODEL_PATH_D,
165
+ attn_implementation="flash_attention_2",
166
  torch_dtype=torch.bfloat16,
167
  device_map="auto",
168
  trust_remote_code=True