sitammeur commited on
Commit
dc384e7
·
verified ·
1 Parent(s): 98288c7

Update src/florence/model.py

Browse files
Files changed (1) hide show
  1. src/florence/model.py +8 -1
src/florence/model.py CHANGED
@@ -1,4 +1,5 @@
1
  # Importing necessary libraries
 
2
  import sys
3
  import subprocess
4
  from typing import Optional
@@ -14,9 +15,15 @@ from src.exception import CustomExceptionHandling
14
 
15
 
16
  # Install the required dependencies
 
 
 
 
 
 
17
  subprocess.run(
18
  "pip install flash-attn --no-build-isolation",
19
- env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
20
  shell=True,
21
  )
22
 
 
1
  # Importing necessary libraries
2
+ import os
3
  import sys
4
  import subprocess
5
  from typing import Optional
 
15
 
16
 
17
  # Install the required dependencies
18
+ # NOTE: passing env={...} to subprocess.run REPLACES the entire environment
19
+ # instead of extending it, which strips PATH/HOME/etc. and can break the
20
+ # pip install (and therefore the whole Space) at import time. Copy the
21
+ # current environment first and only add/override the flag we need.
22
+ env = os.environ.copy()
23
+ env["FLASH_ATTENTION_SKIP_CUDA_BUILD"] = "TRUE"
24
  subprocess.run(
25
  "pip install flash-attn --no-build-isolation",
26
+ env=env,
27
  shell=True,
28
  )
29