kadirnar commited on
Commit
517a105
1 Parent(s): 517786d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -9,7 +9,18 @@ import spaces
9
  from transformers import T5ForConditionalGeneration, T5Tokenizer
10
  import os
11
 
12
- print ("starting the app.")
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  def download_t5_model(model_id, save_directory):
15
  # Modelin tokenizer'ını ve modeli indir
 
9
  from transformers import T5ForConditionalGeneration, T5Tokenizer
10
  import os
11
 
12
+ def check_and_install(package_name):
13
+ if importlib.util.find_spec(package_name) is None:
14
+ print(f"{package_name} not installed, installing...")
15
+ subprocess.run(
16
+ f'pip install {package_name} --no-build-isolation',
17
+ env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"},
18
+ shell=True
19
+ )
20
+ else:
21
+ print(f"{package_name} is already installed.")
22
+
23
+ check_and_install('flash_attn')
24
 
25
  def download_t5_model(model_id, save_directory):
26
  # Modelin tokenizer'ını ve modeli indir