|
1 | 1 | #!/usr/bin/env python |
2 | | -# -*- coding: utf-8 -*- |
3 | 2 | # Copyright (c) 2024 Oracle and/or its affiliates. |
4 | 3 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
5 | 4 |
|
6 | 5 | import json |
7 | 6 | import os |
8 | | -from dataclasses import asdict, fields, MISSING |
| 7 | +from dataclasses import MISSING, asdict, fields |
9 | 8 | from typing import Dict |
10 | 9 |
|
11 | 10 | from oci.data_science.models import ( |
|
14 | 13 | UpdateModelProvenanceDetails, |
15 | 14 | ) |
16 | 15 |
|
17 | | -from ads.aqua import ODSC_MODEL_COMPARTMENT_OCID, logger |
| 16 | +from ads.aqua import logger |
18 | 17 | from ads.aqua.app import AquaApp |
19 | 18 | from ads.aqua.common.enums import Resource, Tags |
20 | 19 | from ads.aqua.common.errors import AquaFileExistsError, AquaValueError |
21 | 20 | from ads.aqua.common.utils import ( |
22 | 21 | get_container_image, |
23 | 22 | upload_local_to_os, |
24 | 23 | ) |
| 24 | +from ads.aqua.config.config import get_finetuning_config_defaults |
25 | 25 | from ads.aqua.constants import ( |
26 | 26 | DEFAULT_FT_BATCH_SIZE, |
27 | 27 | DEFAULT_FT_BLOCK_STORAGE_SIZE, |
|
31 | 31 | UNKNOWN, |
32 | 32 | UNKNOWN_DICT, |
33 | 33 | ) |
34 | | -from ads.aqua.config.config import get_finetuning_config_defaults |
35 | 34 | from ads.aqua.data import AquaResourceIdentifier |
36 | 35 | from ads.aqua.finetuning.constants import * |
37 | 36 | from ads.aqua.finetuning.entities import * |
@@ -132,7 +131,7 @@ def create( |
132 | 131 | or create_fine_tuning_details.validation_set_size >= 1 |
133 | 132 | ): |
134 | 133 | raise AquaValueError( |
135 | | - f"Fine tuning validation set size should be a float number in between [0, 1)." |
| 134 | + "Fine tuning validation set size should be a float number in between [0, 1)." |
136 | 135 | ) |
137 | 136 |
|
138 | 137 | if create_fine_tuning_details.replica < DEFAULT_FT_REPLICA: |
@@ -394,7 +393,7 @@ def create( |
394 | 393 | ) |
395 | 394 | # track shapes that were used for fine-tune creation |
396 | 395 | self.telemetry.record_event_async( |
397 | | - category=f"aqua/service/finetune/create/shape/", |
| 396 | + category="aqua/service/finetune/create/shape/", |
398 | 397 | action=f"{create_fine_tuning_details.shape_name}x{create_fine_tuning_details.replica}", |
399 | 398 | **telemetry_kwargs, |
400 | 399 | ) |
@@ -533,6 +532,12 @@ def _build_oci_launch_cmd( |
533 | 532 | oci_launch_cmd += f"--num_{key} {value} " |
534 | 533 | elif key == "lora_target_modules": |
535 | 534 | oci_launch_cmd += f"--{key} {','.join(str(k) for k in value)} " |
| 535 | + elif key == "early_stopping_patience": |
| 536 | + if value != 0: |
| 537 | + oci_launch_cmd += f"--{key} {value} " |
| 538 | + elif key == "early_stopping_threshold": |
| 539 | + if "early_stopping_patience" in oci_launch_cmd: |
| 540 | + oci_launch_cmd += f"--{key} {value} " |
536 | 541 | else: |
537 | 542 | oci_launch_cmd += f"--{key} {value} " |
538 | 543 |
|
|
0 commit comments