Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vllm colab to work with asyncio requirements #33122

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion examples/notebooks/beam-ml/run_inference_vllm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,35 @@
"source": [
"!pip install openai>=1.52.2\n",
"!pip install vllm>=0.6.3\n",
"!pip install apache-beam[gcp]==2.60.0\n",
"!pip install apache-beam[gcp]==2.61.0\n",
"!pip install nest_asyncio # only needed in colab\n",
"!pip check"
]
},
{
"cell_type": "markdown",
"source": [
"## Colab only: allow nested asyncio\n",
"\n",
"The vLLM model handler logic below uses asyncio to feed vLLM records. This only works if we are not already in an asyncio event loop. Most of the time, this is fine, but colab already operates in an event loop. To work around this, we can use nest_asyncio to make things work smoothly in colab. Do not include this step outside of colab."
],
"metadata": {
"id": "3xz8zuA7vcS3"
}
},
{
"cell_type": "code",
"source": [
"# This should not be necessary outside of colab.\n",
"import nest_asyncio\n",
"nest_asyncio.apply()\n"
],
"metadata": {
"id": "sUqjOzw3wpI3"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down
Loading