Fred808 commited on
Commit
32d750e
·
verified ·
1 Parent(s): 51e2968

Update download_api.py

Browse files
Files changed (1) hide show
  1. download_api.py +9 -0
download_api.py CHANGED
@@ -35,6 +35,15 @@ app.add_middleware(
35
  # Global variable to track if processing is running
36
  processing_thread = None
37
 
 
 
 
 
 
 
 
 
 
38
  def log_message(message):
39
  """Add a log message with timestamp"""
40
  timestamp = datetime.now().strftime("%H:%M:%S")
 
35
  # Global variable to track if processing is running
36
  processing_thread = None
37
 
38
+ try:
39
+ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, check=True, shell=True)
40
+ except subprocess.CalledProcessError as e:
41
+ print(f"Error installing flash-attn: {e}")
42
+ print("Continuing without flash-attn.")
43
+
44
+ # Determine the device to use
45
+ device = "cuda" if torch.cuda.is_available() else "cpu"
46
+
47
  def log_message(message):
48
  """Add a log message with timestamp"""
49
  timestamp = datetime.now().strftime("%H:%M:%S")