|
19 | 19 | write_out_file,
|
20 | 20 | write_out_search_file,
|
21 | 21 | )
|
| 22 | +import openai.wandb_logger |
22 | 23 |
|
23 | 24 |
|
24 | 25 | class bcolors:
|
@@ -535,6 +536,19 @@ def prepare_data(cls, args):
|
535 | 536 | )
|
536 | 537 |
|
537 | 538 |
|
| 539 | +class WandbLogger: |
| 540 | + @classmethod |
| 541 | + def sync(cls, args): |
| 542 | + resp = openai.wandb_logger.WandbLogger.sync( |
| 543 | + id=args.id, |
| 544 | + n_fine_tunes=args.n_fine_tunes, |
| 545 | + project=args.project, |
| 546 | + entity=args.entity, |
| 547 | + force=args.force, |
| 548 | + ) |
| 549 | + print(resp) |
| 550 | + |
| 551 | + |
538 | 552 | def tools_register(parser):
|
539 | 553 | subparsers = parser.add_subparsers(
|
540 | 554 | title="Tools", help="Convenience client side tools"
|
@@ -954,3 +968,40 @@ def help(args):
|
954 | 968 | sub = subparsers.add_parser("fine_tunes.cancel")
|
955 | 969 | sub.add_argument("-i", "--id", required=True, help="The id of the fine-tune job")
|
956 | 970 | sub.set_defaults(func=FineTune.cancel)
|
| 971 | + |
| 972 | + |
| 973 | +def wandb_register(parser): |
| 974 | + subparsers = parser.add_subparsers( |
| 975 | + title="wandb", help="Logging with Weights & Biases" |
| 976 | + ) |
| 977 | + |
| 978 | + def help(args): |
| 979 | + parser.print_help() |
| 980 | + |
| 981 | + parser.set_defaults(func=help) |
| 982 | + |
| 983 | + sub = subparsers.add_parser("sync") |
| 984 | + sub.add_argument("-i", "--id", help="The id of the fine-tune job (optional)") |
| 985 | + sub.add_argument( |
| 986 | + "-n", |
| 987 | + "--n_fine_tunes", |
| 988 | + type=int, |
| 989 | + default=None, |
| 990 | + help="Number of most recent fine-tunes to log when an id is not provided. By default, every fine-tune is synced.", |
| 991 | + ) |
| 992 | + sub.add_argument( |
| 993 | + "--project", |
| 994 | + default="GPT-3", |
| 995 | + help="""Name of the project where you're sending runs. By default, it is "GPT-3".""", |
| 996 | + ) |
| 997 | + sub.add_argument( |
| 998 | + "--entity", |
| 999 | + help="Username or team name where you're sending runs. By default, your default entity is used, which is usually your username.", |
| 1000 | + ) |
| 1001 | + sub.add_argument( |
| 1002 | + "--force", |
| 1003 | + action="store_true", |
| 1004 | + help="Forces logging and overwrite existing wandb run of the same fine-tune.", |
| 1005 | + ) |
| 1006 | + sub.set_defaults(force=False) |
| 1007 | + sub.set_defaults(func=WandbLogger.sync) |
0 commit comments