Documentation ¶
Index ¶
- func Load[T any](conf *Config) (T, error)
- func LoadModelForQuestionAnswering(conf *Config) (questionanswering.Interface, error)
- func LoadModelForTextClassification(conf *Config) (textclassification.Interface, error)
- func LoadModelForTextEncoding(conf *Config) (textencoding.Interface, error)
- func LoadModelForTextGeneration(conf *Config) (textgeneration.Interface, error)
- func LoadModelForTokenClassification(conf *Config) (tokenclassification.Interface, error)
- func LoadModelForZeroShotTextClassification(conf *Config) (zeroshotclassifier.Interface, error)
- func LoadModelLanguageModeling(conf *Config) (languagemodeling.Interface, error)
- type Config
- type ConversionPolicy
- type DownloadPolicy
- type FloatPrecision
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadModelForQuestionAnswering ¶
func LoadModelForQuestionAnswering(conf *Config) (questionanswering.Interface, error)
func LoadModelForTextClassification ¶
func LoadModelForTextClassification(conf *Config) (textclassification.Interface, error)
func LoadModelForTextEncoding ¶
func LoadModelForTextEncoding(conf *Config) (textencoding.Interface, error)
func LoadModelForTextGeneration ¶
func LoadModelForTextGeneration(conf *Config) (textgeneration.Interface, error)
func LoadModelForTokenClassification ¶
func LoadModelForTokenClassification(conf *Config) (tokenclassification.Interface, error)
func LoadModelForZeroShotTextClassification ¶
func LoadModelForZeroShotTextClassification(conf *Config) (zeroshotclassifier.Interface, error)
func LoadModelLanguageModeling ¶ added in v0.1.2
func LoadModelLanguageModeling(conf *Config) (languagemodeling.Interface, error)
Types ¶
type Config ¶
type Config struct { // ModelsDir is the directory where the models are stored. ModelsDir string // ModelName is the name of the model (format: <org>/<model>). ModelName string // HubAccessToken is the access token for the Hugging Face Hub. HubAccessToken string // DownloadPolicy is the policy for downloading the model (default missing) DownloadPolicy DownloadPolicy // ConversionPolicy is the policy for converting the model (default missing) ConversionPolicy ConversionPolicy // ConversionPrecision is the floating-point precision of the converted model (default 32) ConversionPrecision FloatPrecision }
Config is the configuration for the loader.
func (*Config) FullModelPath ¶
FullModelPath returns the full model path.
type ConversionPolicy ¶
type ConversionPolicy int
ConversionPolicy is a policy for converting a pre-trained model.
const ( // ConvertMissing converts the model only if it does not exist. ConvertMissing ConversionPolicy = iota // ConvertAlways converts the model even if it already exists. ConvertAlways // ConvertNever does not convert the model. ConvertNever )
func ParseConversionPolicy ¶
func ParseConversionPolicy(s string) (ConversionPolicy, error)
ParseConversionPolicy parses a string into a conversion policy.
type DownloadPolicy ¶
type DownloadPolicy int
DownloadPolicy is a policy for downloading a model.
const ( // DownloadMissing means that the model will be downloaded only if it doesn't exist. DownloadMissing DownloadPolicy = iota // DownloadAlways means that the model will be downloaded even if it already exists. DownloadAlways // DownloadNever means that the model will not be downloaded. DownloadNever )
func ParseDownloadPolicy ¶
func ParseDownloadPolicy(s string) (DownloadPolicy, error)
ParseDownloadPolicy parses a string into a download policy.
type FloatPrecision ¶
type FloatPrecision int
FloatPrecision is the floating-point precision of the converted model.
const ( // F32 is the 32 floating-point precision. F32 FloatPrecision = iota // F64 is the 64 floating-point precision. F64 )
func ParseFloatPrecision ¶
func ParseFloatPrecision(s string) (FloatPrecision, error)
ParseFloatPrecision parses a string into a FloatPrecision precision type.
Click to show internal directories.
Click to hide internal directories.