George-API commited on
Commit
6bbd6b2
·
verified ·
1 Parent(s): 18eef1c

Upload run_cloud_training.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. run_cloud_training.py +19 -2
run_cloud_training.py CHANGED
@@ -32,8 +32,25 @@ try:
32
  logger = logging.getLogger(__name__)
33
  logger.info("Attempting to install flash-attention...")
34
 
35
- # Install flash-attention
36
- subprocess.check_call([sys.executable, "-m", "pip", "install", "flash-attn", "--no-build-isolation"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  logger.info("Successfully installed flash-attention")
38
  except Exception as e:
39
  logger.warning(f"Failed to install flash-attention: {e}")
 
32
  logger = logging.getLogger(__name__)
33
  logger.info("Attempting to install flash-attention...")
34
 
35
+ # Try multiple installation approaches for flash-attention
36
+ try:
37
+ # First try with pip install
38
+ logger.info("Trying standard pip install for flash-attn")
39
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "flash-attn"])
40
+ except Exception as pip_error:
41
+ logger.warning(f"Standard installation failed: {pip_error}")
42
+ logger.info("Trying alternative installation approach...")
43
+
44
+ # Try the PIP_EXTRA_INDEX_URL approach
45
+ env = os.environ.copy()
46
+ if "PIP_EXTRA_INDEX_URL" not in env:
47
+ env["PIP_EXTRA_INDEX_URL"] = "https://download.pytorch.org/whl/cu118"
48
+
49
+ subprocess.check_call(
50
+ [sys.executable, "-m", "pip", "install", "flash-attn"],
51
+ env=env
52
+ )
53
+
54
  logger.info("Successfully installed flash-attention")
55
  except Exception as e:
56
  logger.warning(f"Failed to install flash-attention: {e}")