forked from davidmigloz/langchain_dart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for checkpoints in fine-tuning jobs in openai_dart (d…
- Loading branch information
1 parent
cb6a4ef
commit c0b48ac
Showing
9 changed files
with
3,773 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
packages/openai_dart/lib/src/generated/schema/fine_tuning_job_checkpoint.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of open_a_i_schema; | ||
|
||
// ========================================== | ||
// CLASS: FineTuningJobCheckpoint | ||
// ========================================== | ||
|
||
/// The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use. | ||
@freezed | ||
class FineTuningJobCheckpoint with _$FineTuningJobCheckpoint { | ||
const FineTuningJobCheckpoint._(); | ||
|
||
/// Factory constructor for FineTuningJobCheckpoint | ||
const factory FineTuningJobCheckpoint({ | ||
/// The checkpoint identifier, which can be referenced in the API endpoints. | ||
required String id, | ||
|
||
/// The Unix timestamp (in seconds) for when the checkpoint was created. | ||
@JsonKey(name: 'created_at') required int createdAt, | ||
|
||
/// The name of the fine-tuned checkpoint model that is created. | ||
@JsonKey(name: 'fine_tuned_model_checkpoint') | ||
required String fineTunedModelCheckpoint, | ||
|
||
/// The step number that the checkpoint was created at. | ||
@JsonKey(name: 'step_number') required int stepNumber, | ||
|
||
/// Metrics at the step number during the fine-tuning job. | ||
required FineTuningJobCheckpointMetrics metrics, | ||
|
||
/// The name of the fine-tuning job that this checkpoint was created from. | ||
@JsonKey(name: 'fine_tuning_job_id') required String fineTuningJobId, | ||
|
||
/// The object type, which is always "fine_tuning.job.checkpoint". | ||
required FineTuningJobCheckpointObject object, | ||
}) = _FineTuningJobCheckpoint; | ||
|
||
/// Object construction from a JSON representation | ||
factory FineTuningJobCheckpoint.fromJson(Map<String, dynamic> json) => | ||
_$FineTuningJobCheckpointFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'id', | ||
'created_at', | ||
'fine_tuned_model_checkpoint', | ||
'step_number', | ||
'metrics', | ||
'fine_tuning_job_id', | ||
'object' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'id': id, | ||
'created_at': createdAt, | ||
'fine_tuned_model_checkpoint': fineTunedModelCheckpoint, | ||
'step_number': stepNumber, | ||
'metrics': metrics, | ||
'fine_tuning_job_id': fineTuningJobId, | ||
'object': object, | ||
}; | ||
} | ||
} | ||
|
||
// ========================================== | ||
// CLASS: FineTuningJobCheckpointMetrics | ||
// ========================================== | ||
|
||
/// Metrics at the step number during the fine-tuning job. | ||
@freezed | ||
class FineTuningJobCheckpointMetrics with _$FineTuningJobCheckpointMetrics { | ||
const FineTuningJobCheckpointMetrics._(); | ||
|
||
/// Factory constructor for FineTuningJobCheckpointMetrics | ||
const factory FineTuningJobCheckpointMetrics({ | ||
/// The step number that the metrics were recorded at. | ||
@JsonKey(includeIfNull: false) double? step, | ||
|
||
/// The training loss at the step number. | ||
@JsonKey(name: 'train_loss', includeIfNull: false) double? trainLoss, | ||
|
||
/// The training mean token accuracy at the step number. | ||
@JsonKey(name: 'train_mean_token_accuracy', includeIfNull: false) | ||
double? trainMeanTokenAccuracy, | ||
|
||
/// The validation loss at the step number. | ||
@JsonKey(name: 'valid_loss', includeIfNull: false) double? validLoss, | ||
|
||
/// The validation mean token accuracy at the step number. | ||
@JsonKey(name: 'valid_mean_token_accuracy', includeIfNull: false) | ||
double? validMeanTokenAccuracy, | ||
|
||
/// The full validation loss at the step number. | ||
@JsonKey(name: 'full_valid_loss', includeIfNull: false) | ||
double? fullValidLoss, | ||
|
||
/// The full validation mean token accuracy at the step number. | ||
@JsonKey(name: 'full_valid_mean_token_accuracy', includeIfNull: false) | ||
double? fullValidMeanTokenAccuracy, | ||
}) = _FineTuningJobCheckpointMetrics; | ||
|
||
/// Object construction from a JSON representation | ||
factory FineTuningJobCheckpointMetrics.fromJson(Map<String, dynamic> json) => | ||
_$FineTuningJobCheckpointMetricsFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'step', | ||
'train_loss', | ||
'train_mean_token_accuracy', | ||
'valid_loss', | ||
'valid_mean_token_accuracy', | ||
'full_valid_loss', | ||
'full_valid_mean_token_accuracy' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'step': step, | ||
'train_loss': trainLoss, | ||
'train_mean_token_accuracy': trainMeanTokenAccuracy, | ||
'valid_loss': validLoss, | ||
'valid_mean_token_accuracy': validMeanTokenAccuracy, | ||
'full_valid_loss': fullValidLoss, | ||
'full_valid_mean_token_accuracy': fullValidMeanTokenAccuracy, | ||
}; | ||
} | ||
} | ||
|
||
// ========================================== | ||
// ENUM: FineTuningJobCheckpointObject | ||
// ========================================== | ||
|
||
/// The object type, which is always "fine_tuning.job.checkpoint". | ||
enum FineTuningJobCheckpointObject { | ||
@JsonValue('fine_tuning.job.checkpoint') | ||
fineTuningJobCheckpoint, | ||
} |
74 changes: 74 additions & 0 deletions
74
packages/openai_dart/lib/src/generated/schema/list_fine_tuning_job_checkpoints_response.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of open_a_i_schema; | ||
|
||
// ========================================== | ||
// CLASS: ListFineTuningJobCheckpointsResponse | ||
// ========================================== | ||
|
||
/// Represents a list of fine-tuning job checkpoints. | ||
@freezed | ||
class ListFineTuningJobCheckpointsResponse | ||
with _$ListFineTuningJobCheckpointsResponse { | ||
const ListFineTuningJobCheckpointsResponse._(); | ||
|
||
/// Factory constructor for ListFineTuningJobCheckpointsResponse | ||
const factory ListFineTuningJobCheckpointsResponse({ | ||
/// The list of fine-tuning job checkpoints. | ||
required List<FineTuningJobCheckpoint> data, | ||
|
||
/// The object type, which is always "list". | ||
required ListFineTuningJobCheckpointsResponseObject object, | ||
|
||
/// The ID of the first checkpoint in the list. | ||
@JsonKey(name: 'first_id', includeIfNull: false) String? firstId, | ||
|
||
/// The ID of the last checkpoint in the list. | ||
@JsonKey(name: 'last_id', includeIfNull: false) String? lastId, | ||
|
||
/// Whether there are more checkpoints to retrieve. | ||
@JsonKey(name: 'has_more') required bool hasMore, | ||
}) = _ListFineTuningJobCheckpointsResponse; | ||
|
||
/// Object construction from a JSON representation | ||
factory ListFineTuningJobCheckpointsResponse.fromJson( | ||
Map<String, dynamic> json) => | ||
_$ListFineTuningJobCheckpointsResponseFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'data', | ||
'object', | ||
'first_id', | ||
'last_id', | ||
'has_more' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'data': data, | ||
'object': object, | ||
'first_id': firstId, | ||
'last_id': lastId, | ||
'has_more': hasMore, | ||
}; | ||
} | ||
} | ||
|
||
// ========================================== | ||
// ENUM: ListFineTuningJobCheckpointsResponseObject | ||
// ========================================== | ||
|
||
/// The object type, which is always "list". | ||
enum ListFineTuningJobCheckpointsResponseObject { | ||
@JsonValue('list') | ||
list, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.