Skip to content

Commit abcf622

Browse files
authored
fix: fix vllm install script (#185)
* fix: fix vllm install script * fix: branch selection * fix: fix pytest install in vllm script * fix: update openai alora tests * fix: test and params for openai constraint alora * test: debugging info * fix: kill zombie vllm process
1 parent 793844c commit abcf622

File tree

5 files changed

+31
-23
lines changed

5 files changed

+31
-23
lines changed

mellea/backends/aloras/openai/granite_aloras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def generate_using_strings(
8585
output._meta["alora_name"] = self.name
8686

8787
output._process = processing
88-
output._post_process = functools.partial(post_processing, backend=self._backend)
88+
output._post_process = functools.partial(post_processing, self._backend)
8989

9090
try:
9191
# To support lazy computation, will need to remove this create_task and store just the unexecuted coroutine.

test/backends/test_openai_vllm/install.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@ in-conda (){
88
}
99

1010

11-
in-conda uv pip install -e .[dev]
11+
in-conda pip install -e . --group dev
1212
in-conda uv pip install pre-commit
13-
# in-conda pre-commit install
1413

1514

1615
install-vllm-fork (){
1716

18-
# first, install vllm
19-
uv pip install vllm==0.9.1
17+
# find the most recent commit between the two code bases
18+
dir=$(readlink -ef $(dirname $0))
19+
branch="alora" # Allow targeting other branches.
20+
21+
git clone --bare https://github.com/vllm-project/vllm.git $dir/vllm-commits
22+
pushd $dir/vllm-commits
23+
git remote add alora https://github.com/tdoublep/vllm.git
24+
git fetch alora $branch
25+
common_commit=$(git merge-base main alora/$branch)
26+
popd
27+
rm -rf $dir/vllm-commits
28+
29+
# install vllm from the most recent common commit
30+
uv pip install "vllm @ git+https://github.com/vllm-project/vllm.git@$common_commit"
2031

2132
# copying the shared objects that are missing in the custom build
2233
rsync -av --prune-empty-dirs --include="*/" --include="*.so" --exclude="*" ${CONDA_PREFIX}/lib/python3.12/site-packages/vllm/ vllm_backup/
@@ -25,7 +36,7 @@ install-vllm-fork (){
2536
# it seems they are manually copying this directory, so I should follow this too...
2637
rsync -av --prune-empty-dirs --include="*/" --include="*.py" --exclude="*" ${CONDA_PREFIX}/lib/python3.12/site-packages/vllm/vllm_flash_attn/ vllm_backup/vllm_flash_attn/
2738

28-
uv pip install "vllm @ git+https://github.com/tdoublep/vllm@alora"
39+
uv pip install "vllm @ git+https://github.com/tdoublep/vllm@$branch"
2940

3041
rsync -av vllm_backup/ ${CONDA_PREFIX}/lib/python3.12/site-packages/vllm/
3142
}

test/backends/test_openai_vllm/run_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ done
1818
VLLM_TESTS_ENABLED="1" python $dir/test_openai_vllm.py
1919

2020

21+
# The VLLM process doesn't always get cleaned up. Get the pid of the VLLM::Engine zombie process and kill it.
22+
potential_zombie_process=$( grep -m 1 -oP 'EngineCore_DP0 pid=\K\d+' $(readlink -ef $(dirname $0))/vllm.err)
23+
kill -9 $potential_zombie_process

test/backends/test_openai_vllm/serve.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ vllm serve ibm-granite/granite-3.2-8b-instruct \
3535
--enable-prefix-caching \
3636
> $(readlink -ef $(dirname $0))/vllm.log \
3737
2> $(readlink -ef $(dirname $0))/vllm.err
38-
39-

test/backends/test_openai_vllm/test_openai_vllm.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mellea.stdlib.base import CBlock, ModelOutputThunk, ChatContext
44
from mellea.backends.openai import OpenAIBackend
55
from mellea.backends.aloras.openai.granite_aloras import add_granite_aloras
6-
from mellea.stdlib.requirement import Requirement, ALoraRequirement, LLMaJRequirement
6+
from mellea.stdlib.requirement import Requirement, ALoraRequirement, LLMaJRequirement, req
77
from mellea.backends.formatter import TemplateFormatter
88
from mellea.backends.types import ModelOption
99

@@ -168,12 +168,11 @@ def test_constraint_lora_with_requirement(self):
168168
"Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa"
169169
)
170170
validation_outputs = self.m.validate(
171-
"The answer should mention that there is a b in the middle of one of the strings but not the other.",
172-
return_full_validation_results=True,
171+
ALoraRequirement("The answer should mention that there is a b in the middle of one of the strings but not the other."),
173172
)
174173
assert len(validation_outputs) == 1
175-
alora_output, valuation_boolean = validation_outputs[0]
176-
assert str(alora_output) in ["Y", "N"]
174+
val_result = validation_outputs[0]
175+
assert str(val_result.reason) in ["Y", "N"]
177176
self.m.reset()
178177

179178
def test_constraint_lora_override(self):
@@ -183,12 +182,11 @@ def test_constraint_lora_override(self):
183182
"Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa"
184183
)
185184
validation_outputs = self.m.validate(
186-
"The answer should mention that there is a b in the middle of one of the strings but not the other.",
187-
return_full_validation_results=True,
185+
LLMaJRequirement("The answer should mention that there is a b in the middle of one of the strings but not the other."),
188186
)
189187
assert len(validation_outputs) == 1
190-
non_alora_output, _ = validation_outputs[0]
191-
assert str(non_alora_output) not in ["Y", "N"]
188+
val_result = validation_outputs[0]
189+
assert str(val_result.reason) not in ["Y", "N"]
192190
self.backend.default_to_constraint_checking_alora = True
193191
self.m.reset()
194192

@@ -202,11 +200,10 @@ def test_constraint_lora_override_does_not_override_alora(self):
202200
ALoraRequirement(
203201
"The answer should mention that there is a b in the middle of one of the strings but not the other."
204202
),
205-
return_full_validation_results=True,
206203
)
207204
assert len(validation_outputs) == 1
208-
non_alora_output, _ = validation_outputs[0]
209-
assert str(non_alora_output) in ["Y", "N"]
205+
non_alora_output = validation_outputs[0]
206+
assert str(non_alora_output.reason) in ["Y", "N"]
210207
self.backend.default_to_constraint_checking_alora = True
211208
self.m.reset()
212209

@@ -220,11 +217,10 @@ def test_llmaj_req_does_not_use_alora(self):
220217
LLMaJRequirement(
221218
"The answer should mention that there is a b in the middle of one of the strings but not the other."
222219
),
223-
return_full_validation_results=True,
224220
)
225221
assert len(validation_outputs) == 1
226-
non_alora_output, _ = validation_outputs[0]
227-
assert str(non_alora_output) not in ["Y", "N"]
222+
non_alora_output = validation_outputs[0]
223+
assert str(non_alora_output.reason) not in ["Y", "N"]
228224
self.m.reset()
229225

230226
def test_instruct(self):

0 commit comments

Comments
 (0)