Skip to content

Commit e650554

Browse files
minleminzuijimoosciuc
authored andcommitted
doc: nested loop code for offline engine (sgl-project#5244)
1 parent fe3ef5f commit e650554

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/backend/offline_engine_api.ipynb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
"\n"
2323
]
2424
},
25+
{
26+
"cell_type": "markdown",
27+
"metadata": {},
28+
"source": [
29+
"## Nest Asyncio\n",
30+
"Note that if you want to use **Offline Engine** in ipython or some other nested loop code, you need to add the following code:\n",
31+
"```python\n",
32+
"import nest_asyncio\n",
33+
"\n",
34+
"nest_asyncio.apply()\n",
35+
"\n",
36+
"```"
37+
]
38+
},
2539
{
2640
"cell_type": "markdown",
2741
"metadata": {},
@@ -63,6 +77,10 @@
6377
"\n",
6478
"if is_in_ci():\n",
6579
" import patch\n",
80+
"else:\n",
81+
" import nest_asyncio\n",
82+
"\n",
83+
" nest_asyncio.apply()\n",
6684
"\n",
6785
"\n",
6886
"llm = sgl.Engine(model_path=\"meta-llama/Meta-Llama-3.1-8B-Instruct\")"

0 commit comments

Comments
 (0)