doc: nested loop code for offline engine (#5244)
This commit is contained in:
@@ -22,6 +22,20 @@
|
|||||||
"\n"
|
"\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Nest Asyncio\n",
|
||||||
|
"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",
|
||||||
|
"```python\n",
|
||||||
|
"import nest_asyncio\n",
|
||||||
|
"\n",
|
||||||
|
"nest_asyncio.apply()\n",
|
||||||
|
"\n",
|
||||||
|
"```"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@@ -63,6 +77,10 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"if is_in_ci():\n",
|
"if is_in_ci():\n",
|
||||||
" import patch\n",
|
" import patch\n",
|
||||||
|
"else:\n",
|
||||||
|
" import nest_asyncio\n",
|
||||||
|
"\n",
|
||||||
|
" nest_asyncio.apply()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"llm = sgl.Engine(model_path=\"meta-llama/Meta-Llama-3.1-8B-Instruct\")"
|
"llm = sgl.Engine(model_path=\"meta-llama/Meta-Llama-3.1-8B-Instruct\")"
|
||||||
|
|||||||
Reference in New Issue
Block a user