loader

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 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) CreateBaseModel

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

CreateBaseModel creates a base model.

func (*FakeModelClient) CreateHFModelRepo added in v1.4.0

func (c *FakeModelClient) CreateHFModelRepo(ctx context.Context, in *mv1.CreateHFModelRepoRequest, opts ...grpc.CallOption) (*mv1.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 *mv1.GetHFModelRepoRequest, opts ...grpc.CallOption) (*mv1.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.

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(
	baseModels []string,
	models []config.ModelConfig,
	objectStorePathPrefix string,
	baseModelPathPrefix string,
	modelDownloader ModelDownloader,
	isDownloadingFromHuggingFace bool,
	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) error

LoadModels loads base and non-base models.

func (*L) Run

func (l *L) Run(ctx context.Context, interval time.Duration) error

Run runs the loader.

type ModelClient

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

	CreateHFModelRepo(ctx context.Context, in *mv1.CreateHFModelRepoRequest, opts ...grpc.CallOption) (*mv1.HFModelRepo, error)
	GetHFModelRepo(ctx context.Context, in *mv1.GetHFModelRepoRequest, opts ...grpc.CallOption) (*mv1.HFModelRepo, 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 NoopModelDownloader

type NoopModelDownloader struct {
}

NoopModelDownloader is a no-op model downloader.

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, 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, 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, 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