Documentation
¶
Index ¶
- func IsRuntimeNotReady(err error) bool
- func PyPIIndexURL() string
- func TorchIndexURL(hw HardwareKind) string
- type DiffusersEngine
- type Engine
- type HardwareKind
- type PackageIndexes
- type PackageMirror
- type ProgressFunc
- type RuntimeManager
- func (m *RuntimeManager) ASRInstallCommand(hw HardwareKind) []string
- func (m *RuntimeManager) ASRStatus(ctx context.Context) RuntimeStatus
- func (m *RuntimeManager) EmbeddingInstallCommand(hw HardwareKind) []string
- func (m *RuntimeManager) EmbeddingStatus(ctx context.Context) RuntimeStatus
- func (m *RuntimeManager) EnsureASRReady(ctx context.Context) error
- func (m *RuntimeManager) EnsureEmbeddingReady(ctx context.Context) error
- func (m *RuntimeManager) EnsureQwenASRReady(ctx context.Context) error
- func (m *RuntimeManager) EnsureReady(ctx context.Context) error
- func (m *RuntimeManager) Install(ctx context.Context) (RuntimeStatus, error)
- func (m *RuntimeManager) InstallASRWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
- func (m *RuntimeManager) InstallCommand(hw HardwareKind) []string
- func (m *RuntimeManager) InstallEmbeddingWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
- func (m *RuntimeManager) InstallWithProgress(ctx context.Context, progress ProgressFunc) (RuntimeStatus, error)
- func (m *RuntimeManager) InstallWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
- func (m *RuntimeManager) PythonPath() string
- func (m *RuntimeManager) RootDir() string
- func (m *RuntimeManager) Status(ctx context.Context) RuntimeStatus
- func (m *RuntimeManager) VenvDir() string
- type RuntimeManifest
- type RuntimeNotReadyError
- type RuntimeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRuntimeNotReady ¶
func PyPIIndexURL ¶
func PyPIIndexURL() string
func TorchIndexURL ¶
func TorchIndexURL(hw HardwareKind) string
Types ¶
type DiffusersEngine ¶
type DiffusersEngine struct {
// contains filtered or unexported fields
}
func NewDiffusersEngine ¶
func NewDiffusersEngine(ctx context.Context, modelName, modelDir string, runtimeManager *RuntimeManager) (*DiffusersEngine, error)
func (*DiffusersEngine) Close ¶
func (e *DiffusersEngine) Close() error
func (*DiffusersEngine) Generate ¶
func (e *DiffusersEngine) Generate(ctx context.Context, req api.OpenAIImagesGenerationRequest) (*api.OpenAIImagesGenerationResponse, error)
func (*DiffusersEngine) ModelName ¶
func (e *DiffusersEngine) ModelName() string
type Engine ¶
type Engine interface {
Generate(ctx context.Context, req api.OpenAIImagesGenerationRequest) (*api.OpenAIImagesGenerationResponse, error)
Close() error
ModelName() string
}
Engine is the interface for local image generation backends.
type HardwareKind ¶
type HardwareKind string
HardwareKind describes the PyTorch wheel/runtime family to use.
const ( HardwareCPU HardwareKind = "cpu" HardwareMPS HardwareKind = "mps" HardwareCUDA HardwareKind = "cuda" HardwareROCm HardwareKind = "rocm" )
func DetectHardware ¶
func DetectHardware() HardwareKind
type PackageIndexes ¶
type PackageIndexes struct {
Mirror PackageMirror
TorchIndexURL string
TorchFindLinksURL string
PyPIIndexURL string
}
func ResolvePackageIndexes ¶
func ResolvePackageIndexes(hw HardwareKind) PackageIndexes
type PackageMirror ¶
type PackageMirror string
const ( PackageMirrorOfficial PackageMirror = "official" PackageMirrorAliyun PackageMirror = "aliyun" )
func ResolvePackageMirror ¶
func ResolvePackageMirror() PackageMirror
type ProgressFunc ¶
type RuntimeManager ¶
type RuntimeManager struct {
// contains filtered or unexported fields
}
func NewASRRuntimeManager ¶
func NewASRRuntimeManager() (*RuntimeManager, error)
func NewEmbeddingRuntimeManager ¶ added in v0.9.8
func NewEmbeddingRuntimeManager() (*RuntimeManager, error)
func NewRuntimeManager ¶
func NewRuntimeManager() (*RuntimeManager, error)
func NewRuntimeManagerAt ¶
func NewRuntimeManagerAt(rootDir string) *RuntimeManager
func (*RuntimeManager) ASRInstallCommand ¶
func (m *RuntimeManager) ASRInstallCommand(hw HardwareKind) []string
func (*RuntimeManager) ASRStatus ¶
func (m *RuntimeManager) ASRStatus(ctx context.Context) RuntimeStatus
func (*RuntimeManager) EmbeddingInstallCommand ¶ added in v0.9.8
func (m *RuntimeManager) EmbeddingInstallCommand(hw HardwareKind) []string
func (*RuntimeManager) EmbeddingStatus ¶ added in v0.9.8
func (m *RuntimeManager) EmbeddingStatus(ctx context.Context) RuntimeStatus
func (*RuntimeManager) EnsureASRReady ¶
func (m *RuntimeManager) EnsureASRReady(ctx context.Context) error
func (*RuntimeManager) EnsureEmbeddingReady ¶ added in v0.9.8
func (m *RuntimeManager) EnsureEmbeddingReady(ctx context.Context) error
func (*RuntimeManager) EnsureQwenASRReady ¶
func (m *RuntimeManager) EnsureQwenASRReady(ctx context.Context) error
func (*RuntimeManager) EnsureReady ¶
func (m *RuntimeManager) EnsureReady(ctx context.Context) error
func (*RuntimeManager) Install ¶
func (m *RuntimeManager) Install(ctx context.Context) (RuntimeStatus, error)
func (*RuntimeManager) InstallASRWithProgressOptions ¶
func (m *RuntimeManager) InstallASRWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
func (*RuntimeManager) InstallCommand ¶
func (m *RuntimeManager) InstallCommand(hw HardwareKind) []string
func (*RuntimeManager) InstallEmbeddingWithProgressOptions ¶ added in v0.9.8
func (m *RuntimeManager) InstallEmbeddingWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
func (*RuntimeManager) InstallWithProgress ¶
func (m *RuntimeManager) InstallWithProgress(ctx context.Context, progress ProgressFunc) (RuntimeStatus, error)
func (*RuntimeManager) InstallWithProgressOptions ¶
func (m *RuntimeManager) InstallWithProgressOptions(ctx context.Context, progress ProgressFunc, upgradePackages bool) (RuntimeStatus, error)
func (*RuntimeManager) PythonPath ¶
func (m *RuntimeManager) PythonPath() string
func (*RuntimeManager) RootDir ¶
func (m *RuntimeManager) RootDir() string
func (*RuntimeManager) Status ¶
func (m *RuntimeManager) Status(ctx context.Context) RuntimeStatus
func (*RuntimeManager) VenvDir ¶
func (m *RuntimeManager) VenvDir() string
type RuntimeManifest ¶
type RuntimeManifest struct {
Python string `json:"python"`
Platform string `json:"platform"`
Arch string `json:"arch"`
Hardware HardwareKind `json:"hardware"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TorchIndex string `json:"torch_index_url,omitempty"`
PyPIIndex string `json:"pypi_index_url,omitempty"`
PackageSpec []string `json:"package_spec"`
}
type RuntimeNotReadyError ¶
type RuntimeNotReadyError struct {
Status RuntimeStatus
}
func (*RuntimeNotReadyError) Error ¶
func (e *RuntimeNotReadyError) Error() string
type RuntimeStatus ¶
type RuntimeStatus struct {
Ready bool `json:"ready"`
RuntimeDir string `json:"runtime_dir"`
VenvDir string `json:"venv_dir"`
Python string `json:"python,omitempty"`
Platform string `json:"platform"`
Arch string `json:"arch"`
Hardware HardwareKind `json:"hardware"`
TorchIndexURL string `json:"torch_index_url,omitempty"`
MissingPackages []string `json:"missing_packages,omitempty"`
InstallCommand []string `json:"install_command,omitempty"`
Error string `json:"error,omitempty"`
}
RuntimeStatus describes whether the Diffusers runtime is ready.
func RuntimeStatusFromError ¶
func RuntimeStatusFromError(err error) (RuntimeStatus, bool)
Click to show internal directories.
Click to hide internal directories.