loader

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeModelClient

type FakeModelClient struct {
	// contains filtered or unexported fields
}

FakeModelClient is a fake model client.

func NewFakeModelClient

func NewFakeModelClient() *FakeModelClient

NewFakeModelClient creates a fake model client.

func (*FakeModelClient) AcquireUnloadedBaseModel added in v1.10.0

AcquireUnloadedBaseModel acquires an unloaded base model.

func (*FakeModelClient) AcquireUnloadedModel added in v1.14.0

AcquireUnloadedModel acquires an unloaded model.

func (*FakeModelClient) CreateBaseModel

func (c *FakeModelClient) CreateBaseModel(ctx context.Context, in *v1.CreateBaseModelRequest, opts ...grpc.CallOption) (*v1.BaseModel, error)

CreateBaseModel creates a base model.

func (*FakeModelClient) CreateHFModelRepo added in v1.4.0

func (c *FakeModelClient) CreateHFModelRepo(ctx context.Context, in *v1.CreateHFModelRepoRequest, opts ...grpc.CallOption) (*v1.HFModelRepo, error)

CreateHFModelRepo creates a new HuggingFace model repo.

func (*FakeModelClient) GetBaseModelPath

GetBaseModelPath gets the path of a base model.

func (*FakeModelClient) GetHFModelRepo added in v1.4.0

func (c *FakeModelClient) GetHFModelRepo(ctx context.Context, in *v1.GetHFModelRepoRequest, opts ...grpc.CallOption) (*v1.HFModelRepo, error)

GetHFModelRepo returns a HuggingFace model repo.

func (*FakeModelClient) GetModelPath added in v0.119.0

GetModelPath gets the path of a model.

func (*FakeModelClient) PublishModel added in v0.119.0

PublishModel publishes a model.

func (*FakeModelClient) RegisterModel added in v0.119.0

RegisterModel register a model.

func (*FakeModelClient) UpdateBaseModelLoadingStatus added in v1.10.0

UpdateBaseModelLoadingStatus updates the loading status of a base model.

func (*FakeModelClient) UpdateModelLoadingStatus added in v1.14.0

UpdateModelLoadingStatus updates the loading status of a model.

type HuggingFaceDownloader

type HuggingFaceDownloader struct {
	// contains filtered or unexported fields
}

HuggingFaceDownloader downloads models from Hugging Face.

func NewHuggingFaceDownloader

func NewHuggingFaceDownloader(cacheDir string, log logr.Logger) *HuggingFaceDownloader

NewHuggingFaceDownloader creates a new HuggingFaceDownloader.

type L

type L struct {
	// contains filtered or unexported fields
}

L is a loader.

func New

func New(
	objectStoreBucket string,
	objectStorePathPrefix string,
	baseModelPathPrefix string,
	modelDownloaderFactory modelDownloaderFactory,
	s3Client S3Client,
	modelClient ModelClient,
	log logr.Logger,
) *L

New creates a new loader.

func (*L) LoadModels added in v0.119.0

func (l *L) LoadModels(
	ctx context.Context,
	baseModels []string,
	models []config.ModelConfig,
	sourceRepository v1.SourceRepository,
) error

LoadModels loads base and non-base models.

func (*L) Run

func (l *L) Run(
	ctx context.Context,
	baseModels []string,
	models []config.ModelConfig,
	sourceRepository v1.SourceRepository,
	interval time.Duration,
) error

Run runs the loader.

type ModelClient

type ModelClient interface {
	CreateBaseModel(ctx context.Context, in *v1.CreateBaseModelRequest, opts ...grpc.CallOption) (*v1.BaseModel, error)
	GetBaseModelPath(ctx context.Context, in *v1.GetBaseModelPathRequest, opts ...grpc.CallOption) (*v1.GetBaseModelPathResponse, error)
	GetModelPath(ctx context.Context, in *v1.GetModelPathRequest, opts ...grpc.CallOption) (*v1.GetModelPathResponse, error)
	RegisterModel(ctx context.Context, in *v1.RegisterModelRequest, opts ...grpc.CallOption) (*v1.RegisterModelResponse, error)
	PublishModel(ctx context.Context, in *v1.PublishModelRequest, opts ...grpc.CallOption) (*v1.PublishModelResponse, error)

	CreateHFModelRepo(ctx context.Context, in *v1.CreateHFModelRepoRequest, opts ...grpc.CallOption) (*v1.HFModelRepo, error)
	GetHFModelRepo(ctx context.Context, in *v1.GetHFModelRepoRequest, opts ...grpc.CallOption) (*v1.HFModelRepo, error)

	AcquireUnloadedBaseModel(ctx context.Context, in *v1.AcquireUnloadedBaseModelRequest, opts ...grpc.CallOption) (*v1.AcquireUnloadedBaseModelResponse, error)
	UpdateBaseModelLoadingStatus(ctx context.Context, in *v1.UpdateBaseModelLoadingStatusRequest, opts ...grpc.CallOption) (*v1.UpdateBaseModelLoadingStatusResponse, error)

	AcquireUnloadedModel(ctx context.Context, in *v1.AcquireUnloadedModelRequest, opts ...grpc.CallOption) (*v1.AcquireUnloadedModelResponse, error)
	UpdateModelLoadingStatus(ctx context.Context, in *v1.UpdateModelLoadingStatusRequest, opts ...grpc.CallOption) (*v1.UpdateModelLoadingStatusResponse, error)
}

ModelClient is an interface for the model client.

type ModelDownloader

type ModelDownloader interface {
	// contains filtered or unexported methods
}

ModelDownloader is an interface for downloading a model.

type NoopS3Client

type NoopS3Client struct {
}

NoopS3Client is a no-op S3 client.

func (*NoopS3Client) Upload

func (c *NoopS3Client) Upload(ctx context.Context, r io.Reader, bucket, key string) error

Upload uploads a file to S3.

type OllamaDownloader added in v1.6.0

type OllamaDownloader struct {
	// contains filtered or unexported fields
}

OllamaDownloader downloads models from Ollama.

func NewOllamaDownloader added in v1.6.0

func NewOllamaDownloader(port int, log logr.Logger) *OllamaDownloader

NewOllamaDownloader creates a new OllamaDownloader.

type S3Client

type S3Client interface {
	Upload(ctx context.Context, r io.Reader, bucket, key string) error
}

S3Client is an interface for uploading a file to S3.

type S3Downloader

type S3Downloader struct {
	// contains filtered or unexported fields
}

S3Downloader downloads models from S3.

func NewS3Downloader

func NewS3Downloader(s3Client s3Client, bucket, pathPrefix string, log logr.Logger) *S3Downloader

NewS3Downloader returns a new S3Downloader.

Jump to

Keyboard shortcuts

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