Command Line Interface
recover
recover(
data_path=Argument(
Ellipsis,
help="Path to file or dir for data",
exists=True,
),
model_params=Option(
var.INFERENCE_PARAMS_PATH,
help="Path to model params json file",
exists=True,
),
weights_path=Option(
var.INFERENCE_WEIGHTS_PATH,
help="Path to model weights",
exists=True,
),
cuda=Option(
var.CUDA, envvar="CUDA", help="CUDA enabled"
),
gpu_id=Option(0, help="GPU id"),
separator=Option(
" ", help="Columns separator in the input files"
),
noisy=Option(False, help="Input files are noisy texts"),
min_noise=Option(
3, help="Min noise parameter. Minimum value is zero"
),
max_noise=Option(
5,
help="Max noise parameter. Maximum value is alphabet size",
),
beam_width=Option(
5,
help="Width for beam search algorithm. Maximum value is alphabet size",
),
n_to_show=Option(
0,
help="Number of columns to visualize. Zero value means for no restriction's",
),
delimiter=Option(
"", help="Delimiter for columns visualization"
),
)
Perform keyless reading locally.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_path |
Path
|
Path to file or dir for data. |
Argument(Ellipsis, help='Path to file or dir for data', exists=True)
|
model_params |
Path
|
Path to model params json file. |
Option(var.INFERENCE_PARAMS_PATH, help='Path to model params json file', exists=True)
|
weights_path |
Path
|
Path to model weights. |
Option(var.INFERENCE_WEIGHTS_PATH, help='Path to model weights', exists=True)
|
cuda |
bool
|
CUDA enabled. |
Option(var.CUDA, envvar='CUDA', help='CUDA enabled')
|
gpu_id |
int, default
|
GPU id on which perform computations. |
Option(0, help='GPU id')
|
separator |
str, default
|
Columns separator in the input files. |
Option(' ', help='Columns separator in the input files')
|
noisy |
bool, default
|
Indicates that input files are noisy texts. |
Option(False, help='Input files are noisy texts')
|
min_noise |
int, default
|
Min noise size per column. Minimum value is zero. |
Option(3, help='Min noise parameter. Minimum value is zero')
|
max_noise |
int, default
|
Max noise size per column. Maximum value is alphabet size. |
Option(5, help='Max noise parameter. Maximum value is alphabet size')
|
beam_width |
int, default
|
Width for beam search algorithm. Maximum value is alphabet size. |
Option(5, help='Width for beam search algorithm. Maximum value is alphabet size')
|
n_to_show |
int, default
|
Number of columns to visualize. Zero value means for no restriction's. |
Option(0, help="Number of columns to visualize. Zero value means for no restriction's")
|
delimiter |
str, default
|
Delimiter for columns visualization. |
Option('', help='Delimiter for columns visualization')
|
Examples:
>>> trecover recover examples/example_1.txt
╭──────────────────────────────────────────────────── example_1.txt ───────────────────────────────────────────────╮
│ Columns │
│ ajocmbfeafodadbddciafqnahdfeihhkieeaacacafkdchddakhecmmlibfinaehbcbdiicejkeahnfemaeaadbkagacbdmahbibacfddfbbbca… │
│ enpenkhgglrifflheioentrmjenkjnrmlhphdddeihliekeeeolflonpmctjolgkdeljjmljmmjiisjknjghgeelhkbddlpjjekrkdkilgiocii… │
│ gsxtoplqkrtknksinktipwvnlnqqrstotoqspoejtsnoiuoflpohvtovqeutunjojlmksonosskpvxporrltnfgoprdemstnshnssgnronjreqj… │
│ xvzwttqtxvxuoptowuxnxyzrwrrtwtyqwqvutrwrxvtxxwurrtqlwuqzvnwvxossmmpnutosuxlswyuvtttvqulrqzrrwuxtyqouwiuupwsxnrm… │
│ y y yz zy y w zy uz yys u tzs x u wx wy w tuvpuwu x yyowyz z wxyu xyy v yr t yvw… │
│ Predicted │
│ enpeoplearoundthecountrywereintothestreetstickedatheconvictionsspewditnessesinpentlandboardeddytheirwindowsbyra… │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Elapsed: 4.716 s
Notes
A larger "beam_width" parameter value can improve keyless reading, but it will also take longer to compute.
Source code in src/trecover/app/cli/trecovercli.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
train
train(
ctx,
show_help=Option(
False,
"--help",
"-h",
is_flag=True,
help="Show help message and exit.",
),
)
Start local training.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx |
Context
|
Typer (Click like) special internal object that holds state relevant for the script execution at every single level. |
required |
show_help |
bool, default
|
Show local train options. |
Option(False, '--help', '-h', is_flag=True, help='Show help message and exit.')
|
Source code in src/trecover/app/cli/trecovercli.py
cli_state_verification
cli_state_verification(
ctx,
config_file=Option(
var.BASE_DIR / "trecover-compose.toml",
"--file",
"-f",
file_okay=True,
help='Path to TRecover configuration file for "up" command',
),
)
Perform cli commands verification (state checking) and config file parsing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx |
Context
|
Typer (Click like) special internal object that holds state relevant for the script execution at every single level. |
required |
config_file |
Path, default
|
Path to TRecover configuration file for "up" command. |
Option(var.BASE_DIR / 'trecover-compose.toml', '--file', '-f', file_okay=True, help='Path to TRecover configuration file for "up" command')
|
Source code in src/trecover/app/cli/trecovercli.py
init
init(
base=Option(
Path().absolute(),
"--base",
"-b",
help="Path to the project's base directory",
),
relocate=Option(
False,
"--relocate",
"-r",
is_flag=True,
help="Relocate an existing environment",
),
)
Initialize project's environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base |
Path, default
|
Path to the project's base directory. |
Option(Path().absolute(), '--base', '-b', help="Path to the project's base directory")
|
relocate |
bool, default
|
Relocate an existing environment |
Option(False, '--relocate', '-r', is_flag=True, help='Relocate an existing environment')
|
Source code in src/trecover/app/cli/trecovercli.py
up
up(
ctx,
attach_stream=Option(
False,
"--attach",
"-a",
is_flag=True,
help="Attach output and error streams",
),
)
Start services: Dashboard, API, Worker, Broker, Backend.
Command uses trecover-compose.toml config file specified by --file and attaches output and error streams if --attach flag is set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx |
Context
|
Typer (Click like) special internal object that holds state relevant for the script execution at every single level. |
required |
attach_stream |
bool, default
|
Attach output and error streams. |
Option(False, '--attach', '-a', is_flag=True, help='Attach output and error streams')
|
Config Variables
dashboard host : str, default=ENV(STREAMLIT_HOST) or 'localhost' The address where the server will listen for client and browser connections. Use this if you want to bind the server to a specific address. If set, the server will only be accessible from this address, and not from any aliases (like localhost).
dashboard port : int, default=ENV(STREAMLIT_PORT) or 8000 The port where the server will listen for browser connections.
dashboard loglevel : {'debug', 'info', 'warning', 'error', 'critical'}, default='info' Level of logging.
api host : str, default=ENV(FASTAPI_HOST) or 'localhost' Bind socket to this host.
api port : int, default=ENV(FASTAPI_PORT) or 8001 Bind socket to this port.
api loglevel : {'debug', 'info', 'warning', 'error', 'critical'}, default='info' Level of logging.
api concurrency : int, default=ENV(FASTAPI_WORKERS) or 1 The number of worker processes.
worker name : str, default='TRecoverWorker' Custom worker hostname.
worker pool : str, {'prefork', 'eventlet', 'gevent', 'processes', 'solo'}, default='solo' Worker processes/threads pool type.
worker loglevel : {'debug', 'info', 'warning', 'error', 'critical'}, default='info' Level of logging.
worker concurrency : int, default=ENV(CELERY_WORKERS) or 1 The number of worker processes.
worker broker_url : str, default=ENV(CELERY_BROKER) or 'pyamqp://guest@localhost' Broker url.
worker backend_url : str, default=ENV(CELERY_BACKEND) or 'redis://localhost' Backend url.
broker port : int, default=ENV(BROKER_PORT) or 5672 Bind broker socket to this port.
broker ui_port : int, default=ENV(BROKER_UI_PORT) or 15672 Bind UI socket to this port.
broker auto_remove : bool, default=False Remove broker docker container after service exit.
backend port : int, default=ENV(BACKEND_PORT) or 6379 Bind backend socket to this port.
backend auto_remove : bool, default=False Remove backend docker container after service exit.
Examples:
trecover-compose.toml
[dashboard]
host = "localhost"
port = 8000
loglevel = 'info'
[api]
host = "localhost"
port = 8001
loglevel = "info"
concurrency = 1
[worker]
name = "TRecoverWorker"
pool = "solo"
loglevel = "info"
concurrency = 1
broker_url = "pyamqp://guest@localhost:5672"
backend_url = "redis://localhost:6379"
[broker]
port = 5672
ui_port = 15672
auto_remove = false
[backend]
port = 6379
auto_remove = false
Source code in src/trecover/app/cli/trecovercli.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
|
down
down(
prune=Option(
False,
"--prune",
"-p",
is_flag=True,
help="Prune all docker containers after exit.",
),
v=Option(
False,
"--volume",
"-v",
is_flag=True,
help="Remove the volumes associated with the all docker containers and the log files.",
),
)
Stop services: Dashboard, API, Worker, Broker, Backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prune |
bool, default
|
Prune all docker containers after exit. |
Option(False, '--prune', '-p', is_flag=True, help='Prune all docker containers after exit.')
|
v |
bool, default
|
Remove the volumes associated with the all docker containers and the log files. |
Option(False, '--volume', '-v', is_flag=True, help='Remove the volumes associated with the all docker containers and the log files.')
|
Source code in src/trecover/app/cli/trecovercli.py
status
Display services status
Source code in src/trecover/app/cli/trecovercli.py
attach
Attach local output stream to a running services.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
live |
bool, Default
|
Stream only fresh log records |
Option(False, '--live', '-l', is_flag=True, help='Stream only fresh log records')
|