Documentation
¶
Index ¶
- Constants
- Variables
- func BaseDockerImageName(projectDir string) string
- func CUDABaseImageFor(cuda string, cuDNN string) (string, error)
- func DockerImageName(projectDir string) string
- func GetProjectDir(configFilename string) (string, error)
- func Validate(yamlConfig string, version string) error
- func ValidateConfig(config *Config, version string) error
- func ValidateCudaVersion(cudaVersion string) error
- func ValidateModelPythonVersion(cfg *Config) error
- func ValidateSchema(schemaLoader, dataLoader gojsonschema.JSONLoader) error
- type ArgumentType
- type Build
- type CUDABaseImage
- type Concurrency
- type Config
- func (c *Config) CUDABaseImageTag() (string, error)
- func (c *Config) ContainsCoglet() bool
- func (c *Config) Filename() string
- func (c *Config) ParsedEnvironment() map[string]string
- func (c *Config) PythonRequirementsForArch(goos string, goarch string, includePackages []string) (string, error)
- func (c *Config) RequirementsFile(projectDir string) string
- func (c *Config) TensorFlowVersion() (string, bool)
- func (c *Config) TorchVersion() (string, bool)
- func (c *Config) TorchaudioVersion() (string, bool)
- func (c *Config) TorchvisionVersion() (string, bool)
- func (c *Config) ValidateAndComplete(projectDir string) error
- type Example
- type Image
- type RunArgument
- type RunItem
- type Stats
- type TFCompatibility
- type TorchCompatibility
- type Version
Constants ¶
const ( MinimumMajorPythonVersion int = 3 MinimumMinorPythonVersion int = 8 MinimumMinorPythonVersionForConcurrency int = 11 MinimumMajorCudaVersion int = 11 )
Variables ¶
var ( BuildSourceEpochTimestamp int64 = -1 BuildXCachePath string PipPackageNameRegex = regexp.MustCompile(`^([^>=<~ \n[#]+)`) )
var CUDABaseImages []CUDABaseImage
var EnvironmentVariableDenyList = []string{
"PATH",
"LD_LIBRARY_PATH",
"PYTHONPATH",
"VIRTUAL_ENV",
"PYTHONUNBUFFERED",
"R8_*",
"REPLICATE_*",
"LIBRARY_PATH",
"CUDA_*",
"NVIDIA_*",
"NV_*",
"PGET_*",
"HF_ENDPOINT",
"HF_HUB_ENABLE_HF_TRANSFER",
"KUBERNETES_*",
}
EnvironmentVariableDenyList is a list of environment variable patterns that are used internally during build or runtime and thus not allowed to be set by the user. There are ways around this restriction, but it's likely to cause unexpected behavior and hard to debug issues. So on Cog's predict-build-push happy path, we don't allow these to be set. This list may change at any time. For more context, see: https://github.com/replicate/cog/pull/2274/#issuecomment-2831823185
var TFCompatibilityMatrix []TFCompatibility
var TorchCompatibilityMatrix []TorchCompatibility
Functions ¶
func BaseDockerImageName ¶ added in v0.0.8
BaseDockerImageName returns the Docker image name for base images
func CUDABaseImageFor ¶ added in v0.0.8
func DockerImageName ¶ added in v0.0.8
DockerImageName returns the default Docker image name for images
func GetProjectDir ¶
Returns the project's root directory, or the directory specified by the --project-dir flag
func ValidateConfig ¶ added in v0.0.19
func ValidateCudaVersion ¶ added in v0.9.10
func ValidateModelPythonVersion ¶ added in v0.9.6
func ValidateSchema ¶ added in v0.0.19
func ValidateSchema(schemaLoader, dataLoader gojsonschema.JSONLoader) error
Types ¶
type ArgumentType ¶ added in v0.0.8
type ArgumentType string
const ( ArgumentTypeString ArgumentType = "str" ArgumentTypeInt ArgumentType = "int" ArgumentTypeFloat ArgumentType = "float" ArgumentTypeBool ArgumentType = "bool" ArgumentTypePath ArgumentType = "Path" )
type Build ¶ added in v0.0.8
type Build struct { GPU bool `json:"gpu,omitempty" yaml:"gpu,omitempty"` PythonVersion string `json:"python_version,omitempty" yaml:"python_version"` PythonRequirements string `json:"python_requirements,omitempty" yaml:"python_requirements,omitempty"` PythonPackages []string `json:"python_packages,omitempty" yaml:"python_packages,omitempty"` // Deprecated, but included for backwards compatibility Run []RunItem `json:"run,omitempty" yaml:"run,omitempty"` SystemPackages []string `json:"system_packages,omitempty" yaml:"system_packages,omitempty"` PreInstall []string `json:"pre_install,omitempty" yaml:"pre_install,omitempty"` // Deprecated, but included for backwards compatibility CUDA string `json:"cuda,omitempty" yaml:"cuda,omitempty"` CuDNN string `json:"cudnn,omitempty" yaml:"cudnn,omitempty"` Fast bool `json:"fast,omitempty" yaml:"fast,omitempty"` CogRuntime *bool `json:"cog_runtime,omitempty" yaml:"cog_runtime,omitempty"` PythonOverrides string `json:"python_overrides,omitempty" yaml:"python_overrides,omitempty"` // contains filtered or unexported fields }
type CUDABaseImage ¶ added in v0.0.8
func (*CUDABaseImage) ImageTag ¶ added in v0.0.8
func (i *CUDABaseImage) ImageTag() string
type Concurrency ¶ added in v0.13.7
type Concurrency struct {
Max int `json:"max,omitempty" yaml:"max"`
}
type Config ¶ added in v0.0.8
type Config struct { Build *Build `json:"build" yaml:"build"` Image string `json:"image,omitempty" yaml:"image,omitempty"` Predict string `json:"predict,omitempty" yaml:"predict"` Train string `json:"train,omitempty" yaml:"train,omitempty"` Concurrency *Concurrency `json:"concurrency,omitempty" yaml:"concurrency,omitempty"` Environment []string `json:"environment,omitempty" yaml:"environment,omitempty"` // contains filtered or unexported fields }
func DefaultConfig ¶ added in v0.0.8
func DefaultConfig() *Config
func GetConfig ¶
Loads and instantiates a Config object customDir can be specified to override the default - current working directory
func GetRawConfig ¶ added in v0.14.9
func (*Config) CUDABaseImageTag ¶ added in v0.0.8
func (*Config) ContainsCoglet ¶ added in v0.15.10
func (*Config) ParsedEnvironment ¶ added in v0.14.9
func (*Config) PythonRequirementsForArch ¶ added in v0.5.0
func (c *Config) PythonRequirementsForArch(goos string, goarch string, includePackages []string) (string, error)
PythonRequirementsForArch returns a requirements.txt file with all the GPU packages resolved for given OS and architecture.
func (*Config) RequirementsFile ¶ added in v0.15.2
func (*Config) TensorFlowVersion ¶ added in v0.9.7
func (*Config) TorchVersion ¶ added in v0.9.7
func (*Config) TorchaudioVersion ¶ added in v0.9.21
func (*Config) TorchvisionVersion ¶ added in v0.9.7
func (*Config) ValidateAndComplete ¶ added in v0.5.0
type RunArgument ¶ added in v0.0.8
type RunItem ¶ added in v0.7.0
type RunItem struct { Command string `json:"command,omitempty" yaml:"command"` Mounts []struct { Type string `json:"type,omitempty" yaml:"type"` ID string `json:"id,omitempty" yaml:"id"` Target string `json:"target,omitempty" yaml:"target"` } `json:"mounts,omitempty" yaml:"mounts,omitempty"` }
func (*RunItem) UnmarshalJSON ¶ added in v0.7.1
func (*RunItem) UnmarshalYAML ¶ added in v0.7.0
type TFCompatibility ¶ added in v0.0.8
type TFCompatibility struct { TF string TFCPUPackage string TFGPUPackage string CUDA string CuDNN string Pythons []string }
func (*TFCompatibility) UnmarshalJSON ¶ added in v0.0.8
func (compat *TFCompatibility) UnmarshalJSON(data []byte) error
type TorchCompatibility ¶ added in v0.0.8
type TorchCompatibility struct { Torch string Torchvision string Torchaudio string FindLinks string ExtraIndexURL string CUDA *string Pythons []string }
func (*TorchCompatibility) TorchVersion ¶ added in v0.0.8
func (c *TorchCompatibility) TorchVersion() string
func (*TorchCompatibility) TorchvisionVersion ¶ added in v0.0.8
func (c *TorchCompatibility) TorchvisionVersion() string