ezpz.configs¶
Configuration management for the ezpz package.
Overview¶
The ezpz.configs module provides configuration management functionality,
including path definitions, scheduler detection, and training configuration classes.
Key Components¶
ezpz/configs.py
BaseConfig
dataclass
¶
Bases: ABC
Common utilities shared by ezpz configuration dataclasses.
Source code in src/ezpz/configs.py
HfDataTrainingArguments
dataclass
¶
Arguments pertaining to what data we are going to input our model for training and eval.
Source code in src/ezpz/configs.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
__post_init__()
¶
Validate dataset arguments and ensure required files are present.
Source code in src/ezpz/configs.py
HfModelArguments
dataclass
¶
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
Source code in src/ezpz/configs.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
__post_init__()
¶
Validate mutually exclusive Hugging Face model configuration options.
Source code in src/ezpz/configs.py
TrainConfig
dataclass
¶
Bases: BaseConfig
High-level training options shared by ezpz scripts.
Source code in src/ezpz/configs.py
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 447 448 449 450 451 452 453 454 | |
__init__(**kwargs)
¶
Populate known fields while capturing any extras in self.extras.
Source code in src/ezpz/configs.py
__post_init__()
¶
Validate framework/backend compatibility after initialisation.
Source code in src/ezpz/configs.py
ZeroConfig
dataclass
¶
Subset of DeepSpeed ZeRO options exposed via the ezpz CLI.
Source code in src/ezpz/configs.py
cmd_exists(cmd)
¶
Check whether command exists.
cmd_exists("ls") True cmd_exists("hostname") True
command_exists(cmd)
¶
get_logging_config()
¶
Return the logging configuration dictionary used by logging.config.
Source code in src/ezpz/configs.py
get_scheduler()
¶
Infer the active scheduler from environment variables or hostname.
Source code in src/ezpz/configs.py
getjobenv_dep()
¶
git_ds_info()
¶
Log the output of DeepSpeed's environment report plus Git metadata.
Source code in src/ezpz/configs.py
load_ds_config(fpath=None)
¶
Load a DeepSpeed configuration file (JSON or YAML).
Source code in src/ezpz/configs.py
print_config(cfg)
¶
Render cfg to the active rich console.
Source code in src/ezpz/configs.py
print_config_tree(cfg, resolve=True, save_to_file=True, verbose=True, style='tree', print_order=None, highlight=True, outfile=None)
¶
Prints the contents of a DictConfig as a tree structure using the Rich library.
- cfg: A DictConfig composed by Hydra.
- print_order: Determines in what order config components are printed.
- resolve: Whether to resolve reference fields of DictConfig.
- save_to_file: Whether to export config to the hydra output folder.
Source code in src/ezpz/configs.py
print_json(json_str=None, console=None, *, data=None, indent=2, highlight=True, skip_keys=False, ensure_ascii=False, check_circular=True, allow_nan=True, default=None, sort_keys=False)
¶
Pretty prints JSON. Output will be valid JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_str
|
Optional[str]
|
A string containing JSON. |
None
|
data
|
Any
|
If json is not supplied, then encode this data. |
None
|
indent
|
Union[None, int, str]
|
Number of spaces to indent. Defaults to 2. |
2
|
highlight
|
bool
|
Enable highlighting of output: Defaults to True. |
True
|
skip_keys
|
bool
|
Skip keys not of a basic type. Defaults to False. |
False
|
ensure_ascii
|
bool
|
Escape all non-ascii characters. Defaults to False. |
False
|
check_circular
|
bool
|
Check for circular references. Defaults to True. |
True
|
allow_nan
|
bool
|
Allow NaN and Infinity values. Defaults to True. |
True
|
default
|
Callable
|
A callable that converts values that can not be encoded in to something that can be JSON encoded. Defaults to None. |
None
|
sort_keys
|
bool
|
Sort dictionary keys. Defaults to False. |
False
|
Source code in src/ezpz/configs.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |