Documentation
¶
Index ¶
Constants ¶
View Source
const ( WeightName = "model.gt" ConfigName = "config.json" S3BucketPrefix = "https://s3.amazonaws.com/models.huggingface.co/bert" CloudfrontDistribPrefix = "https://cdn.huggingface.co" )
Variables ¶
View Source
var ( DefaultCachePath string PytorchPretrainedBertCache string PytorchTransformersCache string TransformersCache string )
View Source
var ActivationFnMap map[string]ActivationFn = map[string]ActivationFn{ "gelu": NewGelu(), "relu": NewRelu(), "tanh": NewTanh(), "swish": NewSwish(), "mish": NewMish(), }
View Source
var Gelu = GeluActivation{}
View Source
var Mish = MishActivation{}
View Source
var Relu = ReluActivation{}
View Source
var Swish = SwishActivation{}
View Source
var Tanh = TanhActivation{}
Functions ¶
func CachedPath ¶
CachedPath resolves and caches data based on input string, then returns fullpath to the cached data.
Parameters: - `urlOrFilename`: can be either `URL` to remote file or fullpath a local file.
CachedPath does several things consequently: 1. Resolves input string to a fullpath cached filename candidate. 2. Check it at `CachePath`, if exists, then return the candidate. If not 3. Retrieves and Caches data to `CachePath` and returns path to cached data
Types ¶
type ActivationFn ¶
type ActivationFn interface {
// Fwd is a forward pass through x.
Fwd(x *ts.Tensor) *ts.Tensor
Name() string
}
ActivationFn is an activation function.
type GeluActivation ¶
type GeluActivation struct {
// contains filtered or unexported fields
}
func NewGelu ¶
func NewGelu() GeluActivation
func (GeluActivation) Name ¶
func (g GeluActivation) Name() (retVal string)
type LinearNoBias ¶
func NewLinearNoBias ¶
func NewLinearNoBias(vs *nn.Path, inDim, outDim int64, config *LinearNoBiasConfig) *LinearNoBias
type LinearNoBiasConfig ¶
func DefaultLinearNoBiasConfig ¶
func DefaultLinearNoBiasConfig() *LinearNoBiasConfig
type MishActivation ¶
type MishActivation struct {
// contains filtered or unexported fields
}
func NewMish ¶
func NewMish() MishActivation
func (MishActivation) Name ¶
func (m MishActivation) Name() (retVal string)
type ReluActivation ¶
type ReluActivation struct {
// contains filtered or unexported fields
}
func NewRelu ¶
func NewRelu() ReluActivation
func (ReluActivation) Name ¶
func (r ReluActivation) Name() (retVal string)
type SwishActivation ¶
type SwishActivation struct {
// contains filtered or unexported fields
}
func NewSwish ¶
func NewSwish() SwishActivation
func (SwishActivation) Name ¶
func (s SwishActivation) Name() (retVal string)
type TanhActivation ¶
type TanhActivation struct {
// contains filtered or unexported fields
}
func NewTanh ¶
func NewTanh() TanhActivation
func (TanhActivation) Name ¶
func (t TanhActivation) Name() string
Click to show internal directories.
Click to hide internal directories.