modelfile

package
v0.0.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunGenModelfile

func RunGenModelfile(ctx context.Context, modelPath string, genConfig *ModelfileGenConfig) error

Types

type Modelfile

type Modelfile interface {
	// GetConfigs returns the args of the config command in the modelfile,
	// and deduplicates the args. The order of the args is the same as the
	// order in the modelfile.
	GetConfigs() []string

	// GetModels returns the args of the model command in the modelfile,
	// and deduplicates the args. The order of the args is the same as the
	// order in the modelfile.
	GetModels() []string

	// GetCode returns the args of the code command in the modelfile,
	// and deduplicates the args. The order of the args is the same as the
	// order in the modelfile.
	GetCodes() []string

	// GetDatasets returns the args of the dataset command in the modelfile,
	// and deduplicates the args. The order of the args is the same as the
	// order in the modelfile.
	GetDatasets() []string

	// GetDocs returns the args of the doc command in the modelfile,
	// and deduplicates the args. The order of the args is the same as the
	// order in the modelfile.
	GetDocs() []string

	// GetName returns the value of the name command in the modelfile.
	GetName() string

	// GetArch returns the value of the arch command in the modelfile.
	GetArch() string

	// GetFamily returns the value of the family command in the modelfile.
	GetFamily() string

	// GetFormat returns the value of the format command in the modelfile.
	GetFormat() string

	// GetParamsize returns the value of the paramsize command in the modelfile.
	GetParamsize() string

	// GetPrecision returns the value of the precision command in the modelfile.
	GetPrecision() string

	// GetQuantization returns the value of the quantization command in the modelfile.
	GetQuantization() string

	// SaveToFile saves the modelfile to the file.
	SaveToFile(path string) error
}

Modelfile is the interface for the modelfile. It is used to parse the modelfile by the path and get the information of the modelfile.

func AutoModelfile

func AutoModelfile(path string, config *ModelfileGenConfig) (Modelfile, error)

AutoModelfile creates a new modelfile by the path of the model directory. It walks the directory and returns the auto-generated modelfile interface.

func NewModelfile

func NewModelfile(path string) (Modelfile, error)

NewModelfile creates a new modelfile by the path of the modelfile. It parses the modelfile and returns the modelfile interface.

type ModelfileGenConfig

type ModelfileGenConfig struct {
	Name               string
	Version            string
	OutputPath         string
	IgnoreUnrecognized bool
	Overwrite          bool
	Arch               string
	Family             string
	Format             string
	Paramsize          string
	Precision          string
	Quantization       string
}

func NewModelfileGenConfig

func NewModelfileGenConfig() *ModelfileGenConfig

func (*ModelfileGenConfig) Validate

func (c *ModelfileGenConfig) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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