finetuning

package
v2.12.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Finetuning API (Beta)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	// The name of the base model.
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// read-only. The version of the base model.
	Version *string `json:"version,omitempty" url:"version,omitempty"`
	// The type of the base model.
	BaseType BaseType `json:"base_type" url:"base_type"`
	// Deprecated: The fine-tuning strategy.
	Strategy *Strategy `json:"strategy,omitempty" url:"strategy,omitempty"`
	// contains filtered or unexported fields
}

The base model used for fine-tuning.

func (*BaseModel) GetBaseType added in v2.12.4

func (b *BaseModel) GetBaseType() BaseType

func (*BaseModel) GetExtraProperties added in v2.8.2

func (b *BaseModel) GetExtraProperties() map[string]interface{}

func (*BaseModel) GetName added in v2.12.4

func (b *BaseModel) GetName() *string

func (*BaseModel) GetStrategy added in v2.12.4

func (b *BaseModel) GetStrategy() *Strategy

func (*BaseModel) GetVersion added in v2.12.4

func (b *BaseModel) GetVersion() *string

func (*BaseModel) String

func (b *BaseModel) String() string

func (*BaseModel) UnmarshalJSON

func (b *BaseModel) UnmarshalJSON(data []byte) error

type BaseType

type BaseType string

The possible types of fine-tuned models.

  • BASE_TYPE_UNSPECIFIED: Unspecified model.
  • BASE_TYPE_GENERATIVE: Deprecated: Generative model.
  • BASE_TYPE_CLASSIFICATION: Classification model.
  • BASE_TYPE_RERANK: Rerank model.
  • BASE_TYPE_CHAT: Chat model.
const (
	BaseTypeBaseTypeUnspecified    BaseType = "BASE_TYPE_UNSPECIFIED"
	BaseTypeBaseTypeGenerative     BaseType = "BASE_TYPE_GENERATIVE"
	BaseTypeBaseTypeClassification BaseType = "BASE_TYPE_CLASSIFICATION"
	BaseTypeBaseTypeRerank         BaseType = "BASE_TYPE_RERANK"
	BaseTypeBaseTypeChat           BaseType = "BASE_TYPE_CHAT"
)

func NewBaseTypeFromString

func NewBaseTypeFromString(s string) (BaseType, error)

func (BaseType) Ptr

func (b BaseType) Ptr() *BaseType

type CreateFinetunedModelResponse

type CreateFinetunedModelResponse struct {
	// Information about the fine-tuned model.
	FinetunedModel *FinetunedModel `json:"finetuned_model,omitempty" url:"finetuned_model,omitempty"`
	// contains filtered or unexported fields
}

Response to request to create a fine-tuned model.

func (*CreateFinetunedModelResponse) GetExtraProperties added in v2.8.2

func (c *CreateFinetunedModelResponse) GetExtraProperties() map[string]interface{}

func (*CreateFinetunedModelResponse) GetFinetunedModel added in v2.12.4

func (c *CreateFinetunedModelResponse) GetFinetunedModel() *FinetunedModel

func (*CreateFinetunedModelResponse) String

func (*CreateFinetunedModelResponse) UnmarshalJSON

func (c *CreateFinetunedModelResponse) UnmarshalJSON(data []byte) error

type DeleteFinetunedModelResponse

type DeleteFinetunedModelResponse = map[string]interface{}

Response to request to delete a fine-tuned model.

type Event

type Event struct {
	// ID of the user who initiated the event. Empty if initiated by the system.
	UserId *string `json:"user_id,omitempty" url:"user_id,omitempty"`
	// Status of the fine-tuned model.
	Status *Status `json:"status,omitempty" url:"status,omitempty"`
	// Timestamp when the event happened.
	CreatedAt *time.Time `json:"created_at,omitempty" url:"created_at,omitempty"`
	// contains filtered or unexported fields
}

A change in status of a fine-tuned model.

func (*Event) GetCreatedAt added in v2.12.4

func (e *Event) GetCreatedAt() *time.Time

func (*Event) GetExtraProperties added in v2.8.2

func (e *Event) GetExtraProperties() map[string]interface{}

func (*Event) GetStatus added in v2.12.4

func (e *Event) GetStatus() *Status

func (*Event) GetUserId added in v2.12.4

func (e *Event) GetUserId() *string

func (*Event) MarshalJSON

func (e *Event) MarshalJSON() ([]byte, error)

func (*Event) String

func (e *Event) String() string

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type FinetunedModel

type FinetunedModel struct {
	// read-only. FinetunedModel ID.
	Id *string `json:"id,omitempty" url:"id,omitempty"`
	// FinetunedModel name (e.g. `foobar`).
	Name string `json:"name" url:"name"`
	// read-only. User ID of the creator.
	CreatorId *string `json:"creator_id,omitempty" url:"creator_id,omitempty"`
	// read-only. Organization ID.
	OrganizationId *string `json:"organization_id,omitempty" url:"organization_id,omitempty"`
	// FinetunedModel settings such as dataset, hyperparameters...
	Settings *Settings `json:"settings,omitempty" url:"settings,omitempty"`
	// read-only. Current stage in the life-cycle of the fine-tuned model.
	Status *Status `json:"status,omitempty" url:"status,omitempty"`
	// read-only. Creation timestamp.
	CreatedAt *time.Time `json:"created_at,omitempty" url:"created_at,omitempty"`
	// read-only. Latest update timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty" url:"updated_at,omitempty"`
	// read-only. Timestamp for the completed fine-tuning.
	CompletedAt *time.Time `json:"completed_at,omitempty" url:"completed_at,omitempty"`
	// read-only. Deprecated: Timestamp for the latest request to this fine-tuned model.
	LastUsed *time.Time `json:"last_used,omitempty" url:"last_used,omitempty"`
	// contains filtered or unexported fields
}

This resource represents a fine-tuned model.

func (*FinetunedModel) GetCompletedAt added in v2.12.4

func (f *FinetunedModel) GetCompletedAt() *time.Time

func (*FinetunedModel) GetCreatedAt added in v2.12.4

func (f *FinetunedModel) GetCreatedAt() *time.Time

func (*FinetunedModel) GetCreatorId added in v2.12.4

func (f *FinetunedModel) GetCreatorId() *string

func (*FinetunedModel) GetExtraProperties added in v2.8.2

func (f *FinetunedModel) GetExtraProperties() map[string]interface{}

func (*FinetunedModel) GetId added in v2.12.4

func (f *FinetunedModel) GetId() *string

func (*FinetunedModel) GetLastUsed added in v2.12.4

func (f *FinetunedModel) GetLastUsed() *time.Time

func (*FinetunedModel) GetName added in v2.12.4

func (f *FinetunedModel) GetName() string

func (*FinetunedModel) GetOrganizationId added in v2.12.4

func (f *FinetunedModel) GetOrganizationId() *string

func (*FinetunedModel) GetSettings added in v2.12.4

func (f *FinetunedModel) GetSettings() *Settings

func (*FinetunedModel) GetStatus added in v2.12.4

func (f *FinetunedModel) GetStatus() *Status

func (*FinetunedModel) GetUpdatedAt added in v2.12.4

func (f *FinetunedModel) GetUpdatedAt() *time.Time

func (*FinetunedModel) MarshalJSON

func (f *FinetunedModel) MarshalJSON() ([]byte, error)

func (*FinetunedModel) String

func (f *FinetunedModel) String() string

func (*FinetunedModel) UnmarshalJSON

func (f *FinetunedModel) UnmarshalJSON(data []byte) error

type GetFinetunedModelResponse

type GetFinetunedModelResponse struct {
	// Information about the fine-tuned model.
	FinetunedModel *FinetunedModel `json:"finetuned_model,omitempty" url:"finetuned_model,omitempty"`
	// contains filtered or unexported fields
}

Response to a request to get a fine-tuned model.

func (*GetFinetunedModelResponse) GetExtraProperties added in v2.8.2

func (g *GetFinetunedModelResponse) GetExtraProperties() map[string]interface{}

func (*GetFinetunedModelResponse) GetFinetunedModel added in v2.12.4

func (g *GetFinetunedModelResponse) GetFinetunedModel() *FinetunedModel

func (*GetFinetunedModelResponse) String

func (g *GetFinetunedModelResponse) String() string

func (*GetFinetunedModelResponse) UnmarshalJSON

func (g *GetFinetunedModelResponse) UnmarshalJSON(data []byte) error

type Hyperparameters

type Hyperparameters struct {
	// Stops training if the loss metric does not improve beyond the value of
	// `early_stopping_threshold` after this many times of evaluation.
	EarlyStoppingPatience *int `json:"early_stopping_patience,omitempty" url:"early_stopping_patience,omitempty"`
	// How much the loss must improve to prevent early stopping.
	EarlyStoppingThreshold *float64 `json:"early_stopping_threshold,omitempty" url:"early_stopping_threshold,omitempty"`
	// The batch size is the number of training examples included in a single
	// training pass.
	TrainBatchSize *int `json:"train_batch_size,omitempty" url:"train_batch_size,omitempty"`
	// The number of epochs to train for.
	TrainEpochs *int `json:"train_epochs,omitempty" url:"train_epochs,omitempty"`
	// The learning rate to be used during training.
	LearningRate *float64 `json:"learning_rate,omitempty" url:"learning_rate,omitempty"`
	// Controls the scaling factor for LoRA updates. Higher values make the
	// updates more impactful.
	LoraAlpha *int `json:"lora_alpha,omitempty" url:"lora_alpha,omitempty"`
	// Specifies the rank for low-rank matrices. Lower ranks reduce parameters
	// but may limit model flexibility.
	LoraRank *int `json:"lora_rank,omitempty" url:"lora_rank,omitempty"`
	// The combination of LoRA modules to target.
	LoraTargetModules *LoraTargetModules `json:"lora_target_modules,omitempty" url:"lora_target_modules,omitempty"`
	// contains filtered or unexported fields
}

The fine-tuning hyperparameters.

func (*Hyperparameters) GetEarlyStoppingPatience added in v2.12.4

func (h *Hyperparameters) GetEarlyStoppingPatience() *int

func (*Hyperparameters) GetEarlyStoppingThreshold added in v2.12.4

func (h *Hyperparameters) GetEarlyStoppingThreshold() *float64

func (*Hyperparameters) GetExtraProperties added in v2.8.2

func (h *Hyperparameters) GetExtraProperties() map[string]interface{}

func (*Hyperparameters) GetLearningRate added in v2.12.4

func (h *Hyperparameters) GetLearningRate() *float64

func (*Hyperparameters) GetLoraAlpha added in v2.12.4

func (h *Hyperparameters) GetLoraAlpha() *int

func (*Hyperparameters) GetLoraRank added in v2.12.4

func (h *Hyperparameters) GetLoraRank() *int

func (*Hyperparameters) GetLoraTargetModules added in v2.12.4

func (h *Hyperparameters) GetLoraTargetModules() *LoraTargetModules

func (*Hyperparameters) GetTrainBatchSize added in v2.12.4

func (h *Hyperparameters) GetTrainBatchSize() *int

func (*Hyperparameters) GetTrainEpochs added in v2.12.4

func (h *Hyperparameters) GetTrainEpochs() *int

func (*Hyperparameters) String

func (h *Hyperparameters) String() string

func (*Hyperparameters) UnmarshalJSON

func (h *Hyperparameters) UnmarshalJSON(data []byte) error

type ListEventsResponse

type ListEventsResponse struct {
	// List of events for the fine-tuned model.
	Events []*Event `json:"events,omitempty" url:"events,omitempty"`
	// Pagination token to retrieve the next page of results. If the value is "",
	// it means no further results for the request.
	NextPageToken *string `json:"next_page_token,omitempty" url:"next_page_token,omitempty"`
	// Total count of results.
	TotalSize *int `json:"total_size,omitempty" url:"total_size,omitempty"`
	// contains filtered or unexported fields
}

Response to a request to list events of a fine-tuned model.

func (*ListEventsResponse) GetEvents added in v2.12.4

func (l *ListEventsResponse) GetEvents() []*Event

func (*ListEventsResponse) GetExtraProperties added in v2.8.2

func (l *ListEventsResponse) GetExtraProperties() map[string]interface{}

func (*ListEventsResponse) GetNextPageToken added in v2.12.4

func (l *ListEventsResponse) GetNextPageToken() *string

func (*ListEventsResponse) GetTotalSize added in v2.12.4

func (l *ListEventsResponse) GetTotalSize() *int

func (*ListEventsResponse) String

func (l *ListEventsResponse) String() string

func (*ListEventsResponse) UnmarshalJSON

func (l *ListEventsResponse) UnmarshalJSON(data []byte) error

type ListFinetunedModelsResponse

type ListFinetunedModelsResponse struct {
	// List of fine-tuned models matching the request.
	FinetunedModels []*FinetunedModel `json:"finetuned_models,omitempty" url:"finetuned_models,omitempty"`
	// Pagination token to retrieve the next page of results. If the value is "",
	// it means no further results for the request.
	NextPageToken *string `json:"next_page_token,omitempty" url:"next_page_token,omitempty"`
	// Total count of results.
	TotalSize *int `json:"total_size,omitempty" url:"total_size,omitempty"`
	// contains filtered or unexported fields
}

Response to a request to list fine-tuned models.

func (*ListFinetunedModelsResponse) GetExtraProperties added in v2.8.2

func (l *ListFinetunedModelsResponse) GetExtraProperties() map[string]interface{}

func (*ListFinetunedModelsResponse) GetFinetunedModels added in v2.12.4

func (l *ListFinetunedModelsResponse) GetFinetunedModels() []*FinetunedModel

func (*ListFinetunedModelsResponse) GetNextPageToken added in v2.12.4

func (l *ListFinetunedModelsResponse) GetNextPageToken() *string

func (*ListFinetunedModelsResponse) GetTotalSize added in v2.12.4

func (l *ListFinetunedModelsResponse) GetTotalSize() *int

func (*ListFinetunedModelsResponse) String

func (l *ListFinetunedModelsResponse) String() string

func (*ListFinetunedModelsResponse) UnmarshalJSON

func (l *ListFinetunedModelsResponse) UnmarshalJSON(data []byte) error

type ListTrainingStepMetricsResponse

type ListTrainingStepMetricsResponse struct {
	// The metrics for each step the evaluation was run on.
	StepMetrics []*TrainingStepMetrics `json:"step_metrics,omitempty" url:"step_metrics,omitempty"`
	// Pagination token to retrieve the next page of results. If the value is "",
	// it means no further results for the request.
	NextPageToken *string `json:"next_page_token,omitempty" url:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

Response to a request to list training-step metrics of a fine-tuned model.

func (*ListTrainingStepMetricsResponse) GetExtraProperties added in v2.8.2

func (l *ListTrainingStepMetricsResponse) GetExtraProperties() map[string]interface{}

func (*ListTrainingStepMetricsResponse) GetNextPageToken added in v2.12.4

func (l *ListTrainingStepMetricsResponse) GetNextPageToken() *string

func (*ListTrainingStepMetricsResponse) GetStepMetrics added in v2.12.4

func (*ListTrainingStepMetricsResponse) String

func (*ListTrainingStepMetricsResponse) UnmarshalJSON

func (l *ListTrainingStepMetricsResponse) UnmarshalJSON(data []byte) error

type LoraTargetModules added in v2.12.0

type LoraTargetModules string

The possible combinations of LoRA modules to target.

  • LORA_TARGET_MODULES_UNSPECIFIED: Unspecified LoRA target modules.
  • LORA_TARGET_MODULES_QV: LoRA adapts the query and value matrices in transformer attention layers.
  • LORA_TARGET_MODULES_QKVO: LoRA adapts query, key, value, and output matrices in attention layers.
  • LORA_TARGET_MODULES_QKVO_FFN: LoRA adapts attention projection matrices and feed-forward networks (FFN).
const (
	LoraTargetModulesLoraTargetModulesUnspecified LoraTargetModules = "LORA_TARGET_MODULES_UNSPECIFIED"
	LoraTargetModulesLoraTargetModulesQv          LoraTargetModules = "LORA_TARGET_MODULES_QV"
	LoraTargetModulesLoraTargetModulesQkvo        LoraTargetModules = "LORA_TARGET_MODULES_QKVO"
	LoraTargetModulesLoraTargetModulesQkvoFfn     LoraTargetModules = "LORA_TARGET_MODULES_QKVO_FFN"
)

func NewLoraTargetModulesFromString added in v2.12.0

func NewLoraTargetModulesFromString(s string) (LoraTargetModules, error)

func (LoraTargetModules) Ptr added in v2.12.0

type Settings

type Settings struct {
	// The base model to fine-tune.
	BaseModel *BaseModel `json:"base_model,omitempty" url:"base_model,omitempty"`
	// The data used for training and evaluating the fine-tuned model.
	DatasetId string `json:"dataset_id" url:"dataset_id"`
	// Fine-tuning hyper-parameters.
	Hyperparameters *Hyperparameters `json:"hyperparameters,omitempty" url:"hyperparameters,omitempty"`
	// read-only. Whether the model is single-label or multi-label (only for classification).
	MultiLabel *bool `json:"multi_label,omitempty" url:"multi_label,omitempty"`
	// The Weights & Biases configuration (Chat fine-tuning only).
	Wandb *WandbConfig `json:"wandb,omitempty" url:"wandb,omitempty"`
	// contains filtered or unexported fields
}

The configuration used for fine-tuning.

func (*Settings) GetBaseModel added in v2.12.4

func (s *Settings) GetBaseModel() *BaseModel

func (*Settings) GetDatasetId added in v2.12.4

func (s *Settings) GetDatasetId() string

func (*Settings) GetExtraProperties added in v2.8.2

func (s *Settings) GetExtraProperties() map[string]interface{}

func (*Settings) GetHyperparameters added in v2.12.4

func (s *Settings) GetHyperparameters() *Hyperparameters

func (*Settings) GetMultiLabel added in v2.12.4

func (s *Settings) GetMultiLabel() *bool

func (*Settings) GetWandb added in v2.12.4

func (s *Settings) GetWandb() *WandbConfig

func (*Settings) String

func (s *Settings) String() string

func (*Settings) UnmarshalJSON

func (s *Settings) UnmarshalJSON(data []byte) error

type Status

type Status string

The possible stages of a fine-tuned model life-cycle.

  • STATUS_UNSPECIFIED: Unspecified status.
  • STATUS_FINETUNING: The fine-tuned model is being fine-tuned.
  • STATUS_DEPLOYING_API: Deprecated: The fine-tuned model is being deployed.
  • STATUS_READY: The fine-tuned model is ready to receive requests.
  • STATUS_FAILED: The fine-tuned model failed.
  • STATUS_DELETED: The fine-tuned model was deleted.
  • STATUS_TEMPORARILY_OFFLINE: Deprecated: The fine-tuned model is temporarily unavailable.
  • STATUS_PAUSED: Deprecated: The fine-tuned model is paused (Vanilla only).
  • STATUS_QUEUED: The fine-tuned model is queued for training.
const (
	StatusStatusUnspecified        Status = "STATUS_UNSPECIFIED"
	StatusStatusFinetuning         Status = "STATUS_FINETUNING"
	StatusStatusDeployingApi       Status = "STATUS_DEPLOYING_API"
	StatusStatusReady              Status = "STATUS_READY"
	StatusStatusFailed             Status = "STATUS_FAILED"
	StatusStatusDeleted            Status = "STATUS_DELETED"
	StatusStatusTemporarilyOffline Status = "STATUS_TEMPORARILY_OFFLINE"
	StatusStatusPaused             Status = "STATUS_PAUSED"
	StatusStatusQueued             Status = "STATUS_QUEUED"
)

func NewStatusFromString

func NewStatusFromString(s string) (Status, error)

func (Status) Ptr

func (s Status) Ptr() *Status

type Strategy

type Strategy string

The possible strategy used to serve a fine-tuned models.

  • STRATEGY_UNSPECIFIED: Unspecified strategy.
  • STRATEGY_VANILLA: Deprecated: Serve the fine-tuned model on a dedicated GPU.
  • STRATEGY_TFEW: Deprecated: Serve the fine-tuned model on a shared GPU.
const (
	StrategyStrategyUnspecified Strategy = "STRATEGY_UNSPECIFIED"
	StrategyStrategyVanilla     Strategy = "STRATEGY_VANILLA"
	StrategyStrategyTfew        Strategy = "STRATEGY_TFEW"
)

func NewStrategyFromString

func NewStrategyFromString(s string) (Strategy, error)

func (Strategy) Ptr

func (s Strategy) Ptr() *Strategy

type TrainingStepMetrics

type TrainingStepMetrics struct {
	// Creation timestamp.
	CreatedAt *time.Time `json:"created_at,omitempty" url:"created_at,omitempty"`
	// Step number.
	StepNumber *int `json:"step_number,omitempty" url:"step_number,omitempty"`
	// Map of names and values for each evaluation metrics.
	Metrics map[string]float64 `json:"metrics,omitempty" url:"metrics,omitempty"`
	// contains filtered or unexported fields
}

The evaluation metrics at a given step of the training of a fine-tuned model.

func (*TrainingStepMetrics) GetCreatedAt added in v2.12.4

func (t *TrainingStepMetrics) GetCreatedAt() *time.Time

func (*TrainingStepMetrics) GetExtraProperties added in v2.8.2

func (t *TrainingStepMetrics) GetExtraProperties() map[string]interface{}

func (*TrainingStepMetrics) GetMetrics added in v2.12.4

func (t *TrainingStepMetrics) GetMetrics() map[string]float64

func (*TrainingStepMetrics) GetStepNumber added in v2.12.4

func (t *TrainingStepMetrics) GetStepNumber() *int

func (*TrainingStepMetrics) MarshalJSON

func (t *TrainingStepMetrics) MarshalJSON() ([]byte, error)

func (*TrainingStepMetrics) String

func (t *TrainingStepMetrics) String() string

func (*TrainingStepMetrics) UnmarshalJSON

func (t *TrainingStepMetrics) UnmarshalJSON(data []byte) error

type UpdateFinetunedModelResponse

type UpdateFinetunedModelResponse struct {
	// Information about the fine-tuned model.
	FinetunedModel *FinetunedModel `json:"finetuned_model,omitempty" url:"finetuned_model,omitempty"`
	// contains filtered or unexported fields
}

Response to a request to update a fine-tuned model.

func (*UpdateFinetunedModelResponse) GetExtraProperties added in v2.8.2

func (u *UpdateFinetunedModelResponse) GetExtraProperties() map[string]interface{}

func (*UpdateFinetunedModelResponse) GetFinetunedModel added in v2.12.4

func (u *UpdateFinetunedModelResponse) GetFinetunedModel() *FinetunedModel

func (*UpdateFinetunedModelResponse) String

func (*UpdateFinetunedModelResponse) UnmarshalJSON

func (u *UpdateFinetunedModelResponse) UnmarshalJSON(data []byte) error

type WandbConfig added in v2.10.0

type WandbConfig struct {
	// The WandB project name to be used during training.
	Project string `json:"project" url:"project"`
	// The WandB API key to be used during training.
	ApiKey string `json:"api_key" url:"api_key"`
	// The WandB entity name to be used during training.
	Entity *string `json:"entity,omitempty" url:"entity,omitempty"`
	// contains filtered or unexported fields
}

The Weights & Biases configuration.

func (*WandbConfig) GetApiKey added in v2.12.4

func (w *WandbConfig) GetApiKey() string

func (*WandbConfig) GetEntity added in v2.12.4

func (w *WandbConfig) GetEntity() *string

func (*WandbConfig) GetExtraProperties added in v2.10.0

func (w *WandbConfig) GetExtraProperties() map[string]interface{}

func (*WandbConfig) GetProject added in v2.12.4

func (w *WandbConfig) GetProject() string

func (*WandbConfig) String added in v2.10.0

func (w *WandbConfig) String() string

func (*WandbConfig) UnmarshalJSON added in v2.10.0

func (w *WandbConfig) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL