Documentation
¶
Index ¶
- func Dump(value interface{}, pretty bool) ([]byte, error)
- type ClassConfidencePair
- type ClassifyResponse
- type ServerForSequenceClassification
- func (s *ServerForSequenceClassification) Classify(_ context.Context, req *grpcapi.ClassifyRequest) (*grpcapi.ClassifyReply, error)
- func (s *ServerForSequenceClassification) ClassifyHandler(w http.ResponseWriter, req *http.Request)
- func (s *ServerForSequenceClassification) ClassifyNLI(_ context.Context, req *grpcapi.ClassifyNLIRequest) (*grpcapi.ClassifyReply, error)
- func (s *ServerForSequenceClassification) ClassifyNLIHandler(w http.ResponseWriter, req *http.Request)
- func (s *ServerForSequenceClassification) StartDefaultHTTPServer(address, tlsCert, tlsKey string, tlsDisable bool)
- func (s *ServerForSequenceClassification) StartDefaultServer(grpcAddress, tlsCert, tlsKey string, tlsDisable bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClassConfidencePair ¶
type ClassConfidencePair struct { Class string `json:"class"` Confidence mat.Float `json:"confidence"` }
ClassConfidencePair is a JSON-serializable pair of Class and Confidence.
type ClassifyResponse ¶
type ClassifyResponse struct { Class string `json:"class"` Confidence mat.Float `json:"confidence"` Distribution []ClassConfidencePair `json:"distribution"` // Took is the number of milliseconds it took the server to execute the request. Took int64 `json:"took"` }
ClassifyResponse is a JSON-serializable structure which holds server classification response data.
type ServerForSequenceClassification ¶
type ServerForSequenceClassification struct { TimeoutSeconds int MaxRequestBytes int // UnimplementedBARTServer must be embedded to have forward compatible implementations for gRPC. grpcapi.UnimplementedBARTServer // contains filtered or unexported fields }
ServerForSequenceClassification contains everything needed to run a BART server.
func NewServer ¶
func NewServer( model *barthead.SequenceClassification, tokenizer *bpetokenizer.BPETokenizer, ) *ServerForSequenceClassification
NewServer returns a new ServerForSequenceClassification.
func (*ServerForSequenceClassification) Classify ¶
func (s *ServerForSequenceClassification) Classify(_ context.Context, req *grpcapi.ClassifyRequest) (*grpcapi.ClassifyReply, error)
Classify handles a classification request over gRPC.
func (*ServerForSequenceClassification) ClassifyHandler ¶
func (s *ServerForSequenceClassification) ClassifyHandler(w http.ResponseWriter, req *http.Request)
ClassifyHandler handles a classify request over HTTP.
func (*ServerForSequenceClassification) ClassifyNLI ¶
func (s *ServerForSequenceClassification) ClassifyNLI(_ context.Context, req *grpcapi.ClassifyNLIRequest) (*grpcapi.ClassifyReply, error)
ClassifyNLI handles a zero-shot classification request over gRPC.
func (*ServerForSequenceClassification) ClassifyNLIHandler ¶
func (s *ServerForSequenceClassification) ClassifyNLIHandler(w http.ResponseWriter, req *http.Request)
ClassifyNLIHandler handles a classify request over HTTP.
func (*ServerForSequenceClassification) StartDefaultHTTPServer ¶
func (s *ServerForSequenceClassification) StartDefaultHTTPServer(address, tlsCert, tlsKey string, tlsDisable bool)
StartDefaultHTTPServer is used to start a basic BERT HTTP server. If you want more control of the HTTP server you can run your own HTTP router using the public handler functions
func (*ServerForSequenceClassification) StartDefaultServer ¶
func (s *ServerForSequenceClassification) StartDefaultServer(grpcAddress, tlsCert, tlsKey string, tlsDisable bool)
StartDefaultServer is used to start a basic BART gRPC server.