Skip to content

Commit

Permalink
Fix the problem with event loop in notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Nov 13, 2023
1 parent a257414 commit 587f9ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions outlines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import inspect
from typing import Callable, Optional

import nest_asyncio
import numpy as np
from numpy.lib.function_base import (
_calculate_shapes,
Expand All @@ -11,6 +12,9 @@
_update_dim_sizes,
)

# Allow nested loops, useful to run in notebooks
nest_asyncio.apply()


class vectorize:
"""Returns an object that acts like a function but takes arrays as an input.
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies = [
"interegular",
"jinja2",
"lark",
"nest_asyncio",
"numpy",
"pillow",
"perscache",
Expand Down Expand Up @@ -89,6 +90,7 @@ module = [
"joblib.*",
"jsonschema.*",
"openai",
"nest_asyncio",
"numpy.*",
"perscache.*",
"PIL",
Expand Down

0 comments on commit 587f9ac

Please sign in to comment.