kadirnar commited on
Commit
4abbb58
·
verified ·
1 Parent(s): fc06f2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -10,6 +10,24 @@ from transformers import T5ForConditionalGeneration, T5Tokenizer
10
  import os
11
 
12
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
  def download_t5_model(model_id, save_directory):
 
10
  import os
11
 
12
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
13
+
14
+
15
+ def install_apex():
16
+ # Install Apex in editable mode from the specified GitHub repository
17
+ cmd = [
18
+ 'pip', 'install', '--no-cache-dir', '--no-build-isolation',
19
+ '--config-settings', 'build-option=--cpp_ext', '--config-settings',
20
+ 'build-option=--cuda_ext', '-e', 'git+https://github.com/NVIDIA/apex.git'
21
+ ]
22
+ subprocess.run(cmd, check=True)
23
+
24
+ try:
25
+ import apex
26
+ except ModuleNotFoundError:
27
+ print("Apex not found, installing...")
28
+ install_apex()
29
+ # Try to import Apex again after installation
30
+ import apex
31
 
32
 
33
  def download_t5_model(model_id, save_directory):