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

Better legacy failure warning #1570

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/deepsparse/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ def create(cls, task: str, **kwargs) -> "Pipeline":
"Pipeline was not created for the given task. The "
"provided task should be registered using the OperatorRegistry"
)
except Exception:
_LOGGER.warning(f"Could not create v2 '{task}' pipeline, trying legacy")
except Exception as e:
_LOGGER.warning(f"Could not create v2 '{task}' pipeline, with error: {e}")
_LOGGER.warning(f"Attempting to create the legacy pipeline")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we combine these to one string so only one message is logged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just figured the error might be long. But I'll put it at the end, something like:

_LOGGER.warning(f"Could not create v2 '{task}' pipeline, attempting to create the legacy pipeline. V2 pipeline error: {e}")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do:

_LOGGER.warning(f"Could not create v2 '{task}' pipeline, with error: {e}. "
                                 "Attempting to create the legacy pipeline")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Luka meant the error will be long so the sentence might look weird in the console

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just in case

from deepsparse.legacy import Pipeline

pipeline = Pipeline.create(task=task, **kwargs)
Expand Down