Documentation
¶
Index ¶
- Constants
- Variables
- func BaseImageConfigurationExists(cudaVersion, pythonVersion, torchVersion string) (bool, string, string, string)
- func BaseImageName(cudaVersion string, pythonVersion string, torchVersion string) string
- func BuildCogTempDir(dir string) (string, error)
- func BuildTempDir(dir string) (string, error)
- func UserCache() (string, error)
- func UserCacheFolder(folder string) (string, error)
- type AvailableBaseImageConfigurations
- type BaseImageConfiguration
- type BaseImageGenerator
- type CUDAVersion
- type FastGenerator
- func (g *FastGenerator) BaseImage() (string, error)
- func (g *FastGenerator) Cleanup() error
- func (g *FastGenerator) GenerateDockerfileWithoutSeparateWeights() (string, error)
- func (g *FastGenerator) GenerateInitialSteps() (string, error)
- func (g *FastGenerator) GenerateModelBase() (string, error)
- func (g *FastGenerator) GenerateModelBaseWithSeparateWeights(imageName string) (weightsBase string, dockerfile string, dockerignoreContents string, err error)
- func (g *FastGenerator) GenerateWeightsManifest() (*weights.Manifest, error)
- func (g *FastGenerator) IsUsingCogBaseImage() bool
- func (g *FastGenerator) Name() string
- func (g *FastGenerator) SetPrecompile(precompile bool)
- func (g *FastGenerator) SetStrip(strip bool)
- func (g *FastGenerator) SetUseCogBaseImage(useCogBaseImage bool)
- func (g *FastGenerator) SetUseCogBaseImagePtr(useCogBaseImage *bool)
- func (g *FastGenerator) SetUseCudaBaseImage(argumentValue string)
- type Generator
- type PyTorchVersion
- type PythonVersion
- type StandardGenerator
- func (g *StandardGenerator) BaseImage() (string, error)
- func (g *StandardGenerator) Cleanup() error
- func (g *StandardGenerator) GenerateDockerfileWithoutSeparateWeights() (string, error)
- func (g *StandardGenerator) GenerateInitialSteps() (string, error)
- func (g *StandardGenerator) GenerateModelBase() (string, error)
- func (g *StandardGenerator) GenerateModelBaseWithSeparateWeights(imageName string) (weightsBase string, dockerfile string, dockerignoreContents string, err error)
- func (g *StandardGenerator) GenerateWeightsManifest() (*weights.Manifest, error)
- func (g *StandardGenerator) IsUsingCogBaseImage() bool
- func (g *StandardGenerator) Name() string
- func (g *StandardGenerator) SetPrecompile(precompile bool)
- func (g *StandardGenerator) SetStrip(strip bool)
- func (g *StandardGenerator) SetUseCogBaseImage(useCogBaseImage bool)
- func (g *StandardGenerator) SetUseCogBaseImagePtr(useCogBaseImage *bool)
- func (g *StandardGenerator) SetUseCudaBaseImage(argumentValue string)
- type Weight
Constants ¶
View Source
const APT_CACHE_MOUNT = "--mount=type=cache,target=/var/cache/apt,id=apt-cache"
View Source
const BaseImageRegistry = "r8.im"
View Source
const CFlags = "ENV CFLAGS=\"-O3 -funroll-loops -fno-strict-aliasing -flto -S\""
View Source
const COG_CACHE_FOLDER = ".cog_cache"
View Source
const DockerignoreHeader = `` /* 231-byte string literal not displayed */
View Source
const FAST_GENERATOR_NAME = "FAST_GENERATOR"
View Source
const FUSE_RPC_WEIGHTS_PATH = "/srv/r8/fuse-rpc/weights"
View Source
const LDConfigCacheBuildCommand = "RUN find / -type f -name \"*python*.so\" -printf \"%h\\n\" | sort -u > /etc/ld.so.conf.d/cog.conf && ldconfig"
View Source
const MONOBASE_CACHE_PATH = "/var/cache/monobase"
View Source
const MinimumCUDAVersion = "11.6"
View Source
const MinimumPythonVersion = "3.8"
View Source
const MinimumTorchVersion = "1.13.1"
View Source
const PrecompilePythonCommand = "" /* 247-byte string literal not displayed */
View Source
const STANDARD_GENERATOR_NAME = "STANDARD_GENERATOR"
View Source
const StripDebugSymbolsCommand = "find / -type f -name \"*python*.so\" -not -name \"*cpython*.so\" -exec strip -S {} \\;"
View Source
const UV_CACHE_DIR = "/srv/r8/monobase/uv/cache"
View Source
const UV_CACHE_MOUNT = "--mount=type=cache,target=" + UV_CACHE_DIR + ",id=pip-cache"
View Source
const WEIGHT_FILE = "weights.json"
View Source
const WEIGHT_FILE_SIZE_EXCLUSION = 1024 * 1024
View Source
const WEIGHT_FILE_SIZE_INCLUSION = 128 * 1024 * 1024
Variables ¶
View Source
var CogEmbed embed.FS
View Source
var WEIGHT_FILE_EXCLUSIONS = []string{
".gif",
".ipynb",
".jpeg",
".jpg",
".log",
".mp4",
".png",
".svg",
".webp",
}
View Source
var WEIGHT_FILE_INCLUSIONS = []string{
".ckpt",
".h5",
".onnx",
".pb",
".pbtxt",
".pt",
".pth",
".safetensors",
".tflite",
}
Functions ¶
func BaseImageConfigurationExists ¶ added in v0.9.7
func BaseImageName ¶ added in v0.9.7
func BuildCogTempDir ¶ added in v0.13.7
func BuildTempDir ¶ added in v0.13.7
func UserCacheFolder ¶ added in v0.13.7
Types ¶
type AvailableBaseImageConfigurations ¶ added in v0.9.10
type AvailableBaseImageConfigurations struct {
PythonVersions []PythonVersion `json:"python_versions"`
}
type BaseImageConfiguration ¶ added in v0.9.7
type BaseImageConfiguration struct {
CUDAVersion string `json:"cuda_version" yaml:"cuda_version"`
PythonVersion string `json:"python_version" yaml:"python_version"`
TorchVersion string `json:"torch_version" yaml:"torch_version"`
}
func BaseImageConfigurations ¶ added in v0.9.7
func BaseImageConfigurations() []BaseImageConfiguration
BaseImageConfigurations returns a list of CUDA/Python/Torch versions
func (BaseImageConfiguration) MarshalJSON ¶ added in v0.9.7
func (b BaseImageConfiguration) MarshalJSON() ([]byte, error)
type BaseImageGenerator ¶ added in v0.9.7
type BaseImageGenerator struct {
// contains filtered or unexported fields
}
func NewBaseImageGenerator ¶ added in v0.9.7
func NewBaseImageGenerator(cudaVersion string, pythonVersion string, torchVersion string) (*BaseImageGenerator, error)
func (*BaseImageGenerator) GenerateDockerfile ¶ added in v0.9.7
func (g *BaseImageGenerator) GenerateDockerfile() (string, error)
type CUDAVersion ¶ added in v0.9.10
type CUDAVersion struct {
Version string `json:"versions"`
}
type FastGenerator ¶ added in v0.13.7
func NewFastGenerator ¶ added in v0.13.7
func NewFastGenerator(config *config.Config, dir string) (*FastGenerator, error)
func (*FastGenerator) BaseImage ¶ added in v0.13.7
func (g *FastGenerator) BaseImage() (string, error)
func (*FastGenerator) Cleanup ¶ added in v0.13.7
func (g *FastGenerator) Cleanup() error
func (*FastGenerator) GenerateDockerfileWithoutSeparateWeights ¶ added in v0.13.7
func (g *FastGenerator) GenerateDockerfileWithoutSeparateWeights() (string, error)
func (*FastGenerator) GenerateInitialSteps ¶ added in v0.13.7
func (g *FastGenerator) GenerateInitialSteps() (string, error)
func (*FastGenerator) GenerateModelBase ¶ added in v0.13.7
func (g *FastGenerator) GenerateModelBase() (string, error)
func (*FastGenerator) GenerateModelBaseWithSeparateWeights ¶ added in v0.13.7
func (*FastGenerator) GenerateWeightsManifest ¶ added in v0.13.7
func (g *FastGenerator) GenerateWeightsManifest() (*weights.Manifest, error)
func (*FastGenerator) IsUsingCogBaseImage ¶ added in v0.13.7
func (g *FastGenerator) IsUsingCogBaseImage() bool
func (*FastGenerator) Name ¶ added in v0.13.7
func (g *FastGenerator) Name() string
func (*FastGenerator) SetPrecompile ¶ added in v0.13.7
func (g *FastGenerator) SetPrecompile(precompile bool)
func (*FastGenerator) SetStrip ¶ added in v0.13.7
func (g *FastGenerator) SetStrip(strip bool)
func (*FastGenerator) SetUseCogBaseImage ¶ added in v0.13.7
func (g *FastGenerator) SetUseCogBaseImage(useCogBaseImage bool)
func (*FastGenerator) SetUseCogBaseImagePtr ¶ added in v0.13.7
func (g *FastGenerator) SetUseCogBaseImagePtr(useCogBaseImage *bool)
func (*FastGenerator) SetUseCudaBaseImage ¶ added in v0.13.7
func (g *FastGenerator) SetUseCudaBaseImage(argumentValue string)
type Generator ¶ added in v0.0.16
type Generator interface {
GenerateInitialSteps() (string, error)
SetUseCogBaseImage(bool)
SetUseCogBaseImagePtr(*bool)
GenerateModelBaseWithSeparateWeights(string) (string, string, string, error)
Cleanup() error
SetStrip(bool)
SetPrecompile(bool)
SetUseCudaBaseImage(string)
IsUsingCogBaseImage() bool
BaseImage() (string, error)
GenerateWeightsManifest() (*weights.Manifest, error)
GenerateDockerfileWithoutSeparateWeights() (string, error)
GenerateModelBase() (string, error)
Name() string
}
type PyTorchVersion ¶ added in v0.9.10
type PyTorchVersion struct {
Version string `json:"version"`
}
type PythonVersion ¶ added in v0.9.10
type PythonVersion struct {
Version string `json:"version"`
PyTorch []PyTorchVersion `json:"pytorch"`
CUDA []CUDAVersion `json:"cuda"`
}
type StandardGenerator ¶ added in v0.13.7
type StandardGenerator struct {
Config *config.Config
Dir string
// these are here to make this type testable
GOOS string
GOARCH string
// contains filtered or unexported fields
}
func NewStandardGenerator ¶ added in v0.13.7
func NewStandardGenerator(config *config.Config, dir string) (*StandardGenerator, error)
func (*StandardGenerator) BaseImage ¶ added in v0.13.7
func (g *StandardGenerator) BaseImage() (string, error)
func (*StandardGenerator) Cleanup ¶ added in v0.13.7
func (g *StandardGenerator) Cleanup() error
func (*StandardGenerator) GenerateDockerfileWithoutSeparateWeights ¶ added in v0.13.7
func (g *StandardGenerator) GenerateDockerfileWithoutSeparateWeights() (string, error)
GenerateDockerfileWithoutSeparateWeights generates a Dockerfile that doesn't write model weights to a separate layer.
func (*StandardGenerator) GenerateInitialSteps ¶ added in v0.13.7
func (g *StandardGenerator) GenerateInitialSteps() (string, error)
func (*StandardGenerator) GenerateModelBase ¶ added in v0.13.7
func (g *StandardGenerator) GenerateModelBase() (string, error)
func (*StandardGenerator) GenerateModelBaseWithSeparateWeights ¶ added in v0.13.7
func (g *StandardGenerator) GenerateModelBaseWithSeparateWeights(imageName string) (weightsBase string, dockerfile string, dockerignoreContents string, err error)
GenerateModelBaseWithSeparateWeights creates the Dockerfile and .dockerignore file contents for model weights It returns four values: - weightsBase: The base image used for Dockerfile generation for model weights. - dockerfile: A string that represents the Dockerfile content generated by the function. - dockerignoreContents: A string that represents the .dockerignore content. - err: An error object if an error occurred during Dockerfile generation; otherwise nil.
func (*StandardGenerator) GenerateWeightsManifest ¶ added in v0.13.7
func (g *StandardGenerator) GenerateWeightsManifest() (*weights.Manifest, error)
func (*StandardGenerator) IsUsingCogBaseImage ¶ added in v0.13.7
func (g *StandardGenerator) IsUsingCogBaseImage() bool
func (*StandardGenerator) Name ¶ added in v0.13.7
func (g *StandardGenerator) Name() string
func (*StandardGenerator) SetPrecompile ¶ added in v0.13.7
func (g *StandardGenerator) SetPrecompile(precompile bool)
func (*StandardGenerator) SetStrip ¶ added in v0.13.7
func (g *StandardGenerator) SetStrip(strip bool)
func (*StandardGenerator) SetUseCogBaseImage ¶ added in v0.13.7
func (g *StandardGenerator) SetUseCogBaseImage(useCogBaseImage bool)
func (*StandardGenerator) SetUseCogBaseImagePtr ¶ added in v0.13.7
func (g *StandardGenerator) SetUseCogBaseImagePtr(useCogBaseImage *bool)
func (*StandardGenerator) SetUseCudaBaseImage ¶ added in v0.13.7
func (g *StandardGenerator) SetUseCudaBaseImage(argumentValue string)
Click to show internal directories.
Click to hide internal directories.