Update inference.py
Browse files- inference.py +13 -2
inference.py
CHANGED
@@ -5,8 +5,19 @@ import sys
|
|
5 |
import torch
|
6 |
from typing import List, Dict
|
7 |
|
8 |
-
#
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Import the necessary modules after installation
|
12 |
from vllm import LLM, SamplingParams
|
|
|
5 |
import torch
|
6 |
from typing import List, Dict
|
7 |
|
8 |
+
# Function to install vllm if not already installed
|
9 |
+
def install_vllm():
|
10 |
+
try:
|
11 |
+
import vllm
|
12 |
+
except ImportError:
|
13 |
+
subprocess.check_call([
|
14 |
+
sys.executable, "-m", "pip", "install",
|
15 |
+
"vllm @ https://github.com/vllm-project/vllm/releases/download/v0.6.1.post1/vllm-0.6.1.post1+cu118-cp310-cp310-manylinux1_x86_64.whl"
|
16 |
+
])
|
17 |
+
import vllm
|
18 |
+
|
19 |
+
# Call the function to install vllm
|
20 |
+
install_vllm()
|
21 |
|
22 |
# Import the necessary modules after installation
|
23 |
from vllm import LLM, SamplingParams
|