pai

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BucketName = "sqlflow-models"

BucketName is the OSS bucket to save trained models

Variables

This section is empty.

Functions

func CleanupPAIModel

func CleanupPAIModel(ir *ir.TrainStmt, session *pb.Session) error

CleanupPAIModel can drop saved PAI model

func Evaluate

func Evaluate(ir *ir.EvaluateStmt, session *pb.Session, tarball, paramsFile, modelName, ossModelPath, cwd string, modelType int) (code, paiCmd, requirements string, e error)

Evaluate generates a Python program for evaluate a TensorFlow model.

func InitializeKMeansAttributes

func InitializeKMeansAttributes(trainStmt *ir.TrainStmt) error

InitializeKMeansAttributes initializes the attributes of KMeans and does type checking for them

func OSSModelURL

func OSSModelURL(modelFullPath string) string

OSSModelURL returns model path on OSS like: oss://bucket/project/userid/modelname/

func Predict

func Predict(ir *ir.PredictStmt, session *pb.Session, tarball, paramsFile, modelName, ossModelPath, cwd string, modelType int) (code, paiCmd, requirements string, e error)

Predict generates a Python program for train a TensorFlow model.

func TFLoadAndEvaluate

func TFLoadAndEvaluate(ir *ir.EvaluateStmt, session *pb.Session, modelPath string) (string, error)

TFLoadAndEvaluate generates PAI-TF evaluate program.

func TFLoadAndExplain

func TFLoadAndExplain(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender) (string, error)

TFLoadAndExplain generates PAI-TF explain program.

func TFLoadAndPredict

func TFLoadAndPredict(ir *ir.PredictStmt, session *pb.Session, modelPath string) (string, error)

TFLoadAndPredict generates PAI-TF prediction program.

func TFTrainWithLoadAndSave

func TFTrainWithLoadAndSave(ir *ir.TrainStmt, session *pb.Session, modelPathToSave, modelPathToLoad string, cc *ClusterConfig) (string, error)

TFTrainWithLoadAndSave generates PAI-TF train program. Load pre-trained model if modelPathToLoad != "". Save the trained model to modelPathToSave.

func Train

func Train(ir *ir.TrainStmt, session *pb.Session, tarball, paramsFile, modelName, ossModelPathToSave, ossModelPathToLoad, cwd string) (code, paiCmd, requirements string, e error)

Train generates a Python program a PAI command arguments to train a TensorFlow model.

Types

type ClusterConfig

type ClusterConfig struct {
	PS        PSConfig      `json:"ps"`
	Worker    WorkerConfig  `json:"worker"`
	Evaluator *WorkerConfig `json:"evaluator,omitempty"`
}

ClusterConfig implicates PAI distributed task meta

func GetClusterConfig

func GetClusterConfig(attrs map[string]interface{}) (*ClusterConfig, error)

GetClusterConfig returns ClusterConfig object comes from WITH clause

type ExplainRender

type ExplainRender struct {
	Code         string
	PaiCmd       string
	Requirements string
	// contains filtered or unexported fields
}

ExplainRender used for PAI

func Explain

func Explain(ir *ir.ExplainStmt, session *pb.Session, tarball, paramsFile, modelName, ossModelPath, cwd string, modelType int) (*ExplainRender, error)

Explain generates a Python program for train a TensorFlow model.

func (*ExplainRender) Draw

func (expn *ExplainRender) Draw() (string, error)

Draw returns the explain result(png) as HTML

type PSConfig

type PSConfig struct {
	Count int `json:"count"`
	GPU   int `json:"gpu"`
	CPU   int `json:"cpu"`
}

PSConfig implicates Parameter Server Config

type WorkerConfig

type WorkerConfig struct {
	Count int `json:"count"`
	GPU   int `json:"gpu"`
	CPU   int `json:"cpu"`
}

WorkerConfig implicates Worker Config

Jump to

Keyboard shortcuts

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