Imran1 commited on
Commit
d25660d
1 Parent(s): 88fa6b0

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +13 -2
inference.py CHANGED
@@ -5,8 +5,19 @@ import sys
5
  import torch
6
  from typing import List, Dict
7
 
8
- # Ensure vllm is installed and specify version to match CUDA compatibility
9
- import vllm
 
 
 
 
 
 
 
 
 
 
 
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