Conversation
| log = getLogger(__name__) | ||
|
|
||
|
|
||
| def build_model(config: Union[str, Path, dict], mode: str = 'infer', |
There was a problem hiding this comment.
Revert unnecessary style changes here and below. If using black (I guess), we should use it on whole code base.
There was a problem hiding this comment.
UPD: make black line lenght 120, and commit black config
deeppavlov/core/commands/infer.py
Outdated
| pred = zip(*pred) | ||
|
|
||
| print('>>', *pred) | ||
| print("==> ", *pred) |
There was a problem hiding this comment.
Why? I would understand >>> like in python, but where from ==>?
deeppavlov/core/commands/infer.py
Outdated
|
|
||
| print("\nExit repl - type q and press enter, or press ctrl-c, or ctrl-d.") | ||
|
|
||
| def input_data(prompt: str) -> tuple[str]: |
There was a problem hiding this comment.
TypeError: 'type' object is not subscriptable in Python <=3.8. Replace with typing.Tuple, add test of interact mode to tests/test_quick_start.py for one single model.
deeppavlov/core/commands/infer.py
Outdated
| """Start interaction with the model described in corresponding configuration file.""" | ||
| model = build_model(config) | ||
|
|
||
| print("\nExit repl - type q and press enter, or press ctrl-c, or ctrl-d.") |
There was a problem hiding this comment.
| print("\nExit repl - type q and press enter, or press ctrl-c, or ctrl-d.") | |
| print("\nExit repl - type q and press Enter, or press Ctrl-C, or Ctrl-D.") |
There was a problem hiding this comment.
Replace repl with something more understandable for regular user. What other app usually write?
deeppavlov/core/commands/infer.py
Outdated
|
|
||
|
|
||
| def end_repl_mode(function: Callable[..., Any]) -> Callable[..., Any]: | ||
| """Decorator for processing ctrl-c, ctrl-d pressing.""" |
There was a problem hiding this comment.
| """Decorator for processing ctrl-c, ctrl-d pressing.""" | |
| """Decorator for processing Ctrl-C, Ctrl-D pressing.""" |
deeppavlov/core/commands/infer.py
Outdated
| if data == "": | ||
| continue | ||
| if data.isspace(): | ||
| continue |
There was a problem hiding this comment.
Remove continue. We should allow user to remain some arguments blank.
There was a problem hiding this comment.
After removing continue, code from input_data could be moved from separated function back
issue #1667