petalsserver

package
v0.0.1-test1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthPage = "https://health.petals.dev/api/v1/state"
)

Variables

This section is empty.

Functions

func EmptyCache

func EmptyCache() error

func ForceKill

func ForceKill()

func GetComputeProcessCount

func GetComputeProcessCount() int

func GetFreeMemory

func GetFreeMemory() float64

func GetInstalledGITSHA

func GetInstalledGITSHA() (string, error)

func GetLatestGitCommitSHA

func GetLatestGitCommitSHA() (string, error)

func IsPetalsServerInstalled

func IsPetalsServerInstalled() bool

func IsPetalsServerRunning

func IsPetalsServerRunning() bool

IsPetalsServerRunning returns true if the Petals Server process is running.

func LaunchPetalsServer

func LaunchPetalsServer(options *RunOptions, outchan chan []byte) (context.CancelFunc, *exec.Cmd, error)

func PipInstallPetals

func PipInstallPetals(pythonPath string) (chan []byte, error)

func UpdatePetals

func UpdatePetals() error

Types

type GPU

type GPU struct {
	ID            string        `xml:"id,attr"`
	Utilization   Utilization   `xml:"utilization"`
	Processes     []ProcessInfo `xml:"processes>process_info"`
	FBMemoryUsage MemoryInfo    `xml:"fb_memory_usage"`
}

GPU is the representeation of the GPU in the nvidia-smi -q -x (XML) command.

type MemoryInfo

type MemoryInfo struct {
	Total string `xml:"total"`
	Used  string `xml:"used"`
	Free  string `xml:"free"`
}

type Peer

type Peer struct {
	PeerID string `json:"peer_id"`
	State  string `json:"state"`
	Span   struct {
		ServerInfo struct {
			PublicName string `json:"public_name"`
			State      string `json:"state"`
			StartBlock int    `json:"start_block"`
			EndBlock   int    `json:"end_block"`
			UsingRelay bool   `json:"using_relay"`
			Version    string `json:"version"`
		} `json:"server_info"`
	} `json:"span"`
}

type ProcessInfo

type ProcessInfo struct {
	Type string `xml:"type"`
	Name string `xml:"process_name"`
}

type RunOptions

type RunOptions struct {
	PublicName    string   // public name to use for the server
	MaxDiskSize   int      // max disk size to use for the server
	NumBlocks     int      // number of blocks to use for the server
	AutoStart     bool     // if true, will start server automatically
	ModelName     string   // e.g. "petals-team/StableBeluga2"
	StopOnProcess []string // process names that will stop the server

}

type SMILogs

type SMILogs struct {
	XMLName       string `xml:"nvidia_smi_log"`
	CUDAVersion   string `xml:"cuda_version"`
	DriverVersion string `xml:"driver_version"`
	GPU           []GPU  `xml:"gpu"`
}

SMILogs is the representeation of the logs of the nvidia-smi -q -x (XML) command.

var GPUStatus *SMILogs

type Status

type Status struct {
	ModelReports []struct {
		Name       string `json:"name"`
		State      string `json:"state"`
		NumBlocks  int    `json:"num_blocks"`
		ServerRows []Peer `json:"server_rows"`
	} `json:"model_reports"`
}

func GetStatus

func GetStatus() (*Status, error)

type Utilization

type Utilization struct {
	GPUUtil    string `xml:"gpu_util"`
	MemoryUtil string `xml:"memory_util"`
}

Jump to

Keyboard shortcuts

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