Refactor space.py for better code organization and lazy loading of flash-attn dependency
Browse files
space.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
import subprocess
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import spaces
|
| 5 |
from langchain.tools import tool
|
|
@@ -30,13 +36,6 @@ from kitt.skills import (
|
|
| 30 |
from kitt.skills.common import config, vehicle
|
| 31 |
from kitt.skills.routing import calculate_route, find_address
|
| 32 |
|
| 33 |
-
subprocess.run(
|
| 34 |
-
"pip install flash-attn --no-build-isolation",
|
| 35 |
-
env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
|
| 36 |
-
shell=True,
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
|
| 40 |
ORIGIN = "Luxembourg, Luxembourg"
|
| 41 |
DESTINATION = "Paris, France"
|
| 42 |
DEFAULT_LLM_BACKEND = "local"
|
|
|
|
| 1 |
import subprocess
|
| 2 |
|
| 3 |
+
subprocess.run(
|
| 4 |
+
"pip install flash-attn --no-build-isolation",
|
| 5 |
+
env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
|
| 6 |
+
shell=True,
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
import gradio as gr
|
| 10 |
import spaces
|
| 11 |
from langchain.tools import tool
|
|
|
|
| 36 |
from kitt.skills.common import config, vehicle
|
| 37 |
from kitt.skills.routing import calculate_route, find_address
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
ORIGIN = "Luxembourg, Luxembourg"
|
| 40 |
DESTINATION = "Paris, France"
|
| 41 |
DEFAULT_LLM_BACKEND = "local"
|