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

Remove get_event_loop() #24

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion allms/models/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ def __init__(
raise ValueError("max_output_tokens has to be lower than model_total_max_tokens")

self._llm = self._create_llm()
self._event_loop = event_loop if event_loop is not None else asyncio.get_event_loop()

if not event_loop:
try:
event_loop = asyncio.get_running_loop()
except RuntimeError as error:
event_loop = asyncio.new_event_loop()
asyncio.set_event_loop(event_loop)
self._event_loop = event_loop

self._predict_example = create_base_retry_decorator(
error_types=[
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "allms"
version = "1.0.2"
version = "1.0.3"
description = ""
authors = ["Allegro Opensource <opensource@allegro.com>"]
readme = "README.md"
Expand Down
Loading