Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coglet/python/tests/schemas/cog.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build:
python_version: "3.8"
python_version: "3.9"
predict: "predict.py:Predictor"
2 changes: 1 addition & 1 deletion docs/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,7 @@ build:
python_version: "3.11.1"
```

Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11, 3.12, 3.13. If you don't define a version, Cog will use the latest version of Python 3.12 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.
Cog supports all active branches of Python: 3.9, 3.10, 3.11, 3.12, 3.13. If you don't define a version, Cog will use the latest version of Python 3.12 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.

Note that these are the versions supported **in the Docker container**, not your host machine. You can run any version(s) of Python you wish on your host machine.

Expand Down
2 changes: 1 addition & 1 deletion docs/yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ build:
python_version: "3.11.1"
```

Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11, 3.12, 3.13. If you don't define a version, Cog will use the latest version of Python 3.12 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.
Cog supports all active branches of Python: 3.9, 3.10, 3.11, 3.12, 3.13. If you don't define a version, Cog will use the latest version of Python 3.12 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.

Note that these are the versions supported **in the Docker container**, not your host machine. You can run any version(s) of Python you wish on your host machine.

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (

const (
MinimumMajorPythonVersion int = 3
MinimumMinorPythonVersion int = 8
MinimumMinorPythonVersion int = 9 // Python 3.8 EOL October 2024
MinimumMinorPythonVersionForConcurrency int = 11
MinimumMajorCudaVersion int = 11
)
Expand Down
44 changes: 22 additions & 22 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestValidateModelPythonVersion(t *testing.T) {
},
{
name: "MinimumVersion",
pythonVersion: "3.8",
pythonVersion: "3.9",
},
{
name: "MinimumVersionForConcurrency",
Expand All @@ -34,9 +34,9 @@ func TestValidateModelPythonVersion(t *testing.T) {
},
{
name: "TooOldForConcurrency",
pythonVersion: "3.8",
pythonVersion: "3.9",
concurrencyMax: 5,
expectedErr: "when concurrency.max is set, minimum supported Python version is 3.11. requested 3.8",
expectedErr: "when concurrency.max is set, minimum supported Python version is 3.11. requested 3.9",
},
{
name: "FullyQualifiedVersion",
Expand All @@ -54,8 +54,8 @@ func TestValidateModelPythonVersion(t *testing.T) {
},
{
name: "LessThanMinimum",
pythonVersion: "3.7",
expectedErr: "minimum supported Python version is 3.8. requested 3.7",
pythonVersion: "3.8",
expectedErr: "minimum supported Python version is 3.9. requested 3.8",
},
}

Expand Down Expand Up @@ -154,7 +154,7 @@ func assertMinorVersion(t *testing.T, expected, actual string) {
func TestPythonPackagesAndRequirementsCantBeUsedTogether(t *testing.T) {
config := &Config{
Build: &Build{
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"replicate==1.0.0",
},
Expand All @@ -177,7 +177,7 @@ foo==1.0.0`), 0o644)
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonRequirements: "requirements.txt",
},
}
Expand Down Expand Up @@ -207,7 +207,7 @@ foo==1.0.0`), 0o644)
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonRequirements: "requirements.txt",
},
}
Expand Down Expand Up @@ -242,7 +242,7 @@ flask>0.4
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonRequirements: "requirements.txt",
},
}
Expand All @@ -264,7 +264,7 @@ func TestValidateAndCompleteCUDAForAllTF(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==" + compat.TF,
},
Expand All @@ -283,7 +283,7 @@ func TestValidateAndCompleteCUDAForAllTorch(t *testing.T) {
config := &Config{
Build: &Build{
GPU: compat.CUDA != nil,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==" + compat.TorchVersion(),
},
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestValidateAndCompleteCUDAForSelectedTorch(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==" + tt.torch,
},
Expand All @@ -338,7 +338,7 @@ func TestUnsupportedTorch(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==0.4.1",
},
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestUnsupportedTensorflow(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==0.4.1",
},
Expand All @@ -389,7 +389,7 @@ func TestUnsupportedTensorflow(t *testing.T) {
Build: &Build{
GPU: true,
CUDA: "11.8",
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==0.4.1",
},
Expand All @@ -405,7 +405,7 @@ func TestPythonPackagesForArchTorchGPU(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==1.7.1",
"torchvision==0.8.2",
Expand Down Expand Up @@ -434,7 +434,7 @@ func TestPythonPackagesForArchTorchCPU(t *testing.T) {
config := &Config{
Build: &Build{
GPU: false,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==1.7.1",
"torchvision==0.8.2",
Expand All @@ -461,7 +461,7 @@ func TestPythonPackagesForArchTensorflowGPU(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==2.12.0",
"foo==1.0.0",
Expand Down Expand Up @@ -516,7 +516,7 @@ func TestCUDABaseImageTag(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==2.12.0",
},
Expand Down Expand Up @@ -640,7 +640,7 @@ func TestTorchWithExistingExtraIndexURL(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==1.12.1 --extra-index-url=https://download.pytorch.org/whl/cu116",
},
Expand Down Expand Up @@ -670,7 +670,7 @@ func TestPythonRequirementsForArchWithAddedPackage(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"torch==2.4.0 --extra-index-url=https://download.pytorch.org/whl/cu116",
},
Expand Down Expand Up @@ -739,7 +739,7 @@ func TestAbsolutePathInPythonRequirements(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonRequirements: requirementsFilePath,
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

const testConfig = `
build:
python_version: "3.8"
python_version: "3.9"
python_requirements: requirements.txt
system_packages:
- libgl1-mesa-glx
Expand Down
10 changes: 5 additions & 5 deletions pkg/config/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func TestValidateConfig(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.8",
PythonVersion: "3.9",
PythonPackages: []string{
"tensorflow==1.15.0",
"foo==1.0.0",
Expand All @@ -28,7 +28,7 @@ func TestValidateSuccess(t *testing.T) {
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"
python_version: "3.8"
python_version: "3.9"
python_packages:
- "torch==1.8.1"`

Expand Down Expand Up @@ -56,7 +56,7 @@ func TestValidateBuildIsRequired(t *testing.T) {
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"
python_version: "3.8"
python_version: "3.9"
python_packages:
- "torch==1.8.1"`

Expand All @@ -68,7 +68,7 @@ func TestValidateBuildIsRequired(t *testing.T) {
func TestValidatePythonVersionIsRequired(t *testing.T) {
config := `build:
gpu: true
python_versions: "3.8"
python_versions: "3.9"
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"
Expand All @@ -83,7 +83,7 @@ func TestValidatePythonVersionIsRequired(t *testing.T) {
func TestValidateNullListsAllowed(t *testing.T) {
config := `build:
gpu: true
python_version: "3.8"
python_version: "3.9"
system_packages:
python_packages:
run:`
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerfile/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const MinimumCUDAVersion = "11.6"
const MinimumPythonVersion = "3.8"
const MinimumPythonVersion = "3.9" // Python 3.8 EOL October 2024
const MinimumTorchVersion = "1.13.1"
const CogBaseImageName = "cog-base"

Expand Down
28 changes: 14 additions & 14 deletions pkg/dockerfile/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ func TestBaseImageName(t *testing.T) {
torch string
expected string
}{
{"", "3.8", "",
"r8.im/cog-base:python3.8"},
{"", "3.8", "2.1",
"r8.im/cog-base:python3.8-torch2.1.2"},
{"12.1", "3.8", "",
"r8.im/cog-base:cuda12.1-python3.8"},
{"12.1", "3.8", "2.1",
"r8.im/cog-base:cuda12.1-python3.8-torch2.1.2"},
{"12.1", "3.8", "2.1",
"r8.im/cog-base:cuda12.1-python3.8-torch2.1.2"},
{"", "3.9", "",
"r8.im/cog-base:python3.9"},
{"", "3.9", "2.1",
"r8.im/cog-base:python3.9-torch2.1.2"},
{"12.1", "3.9", "",
"r8.im/cog-base:cuda12.1-python3.9"},
{"12.1", "3.9", "2.1",
"r8.im/cog-base:cuda12.1-python3.9-torch2.1.2"},
{"12.1", "3.9", "2.1",
"r8.im/cog-base:cuda12.1-python3.9-torch2.1.2"},
} {
actual := BaseImageName(tt.cuda, tt.python, tt.torch)
require.Equal(t, tt.expected, actual)
Expand All @@ -36,7 +36,7 @@ func TestBaseImageName(t *testing.T) {

func TestGenerateDockerfile(t *testing.T) {
cudaVersion := "12.1"
pythonVersion := "3.8"
pythonVersion := "3.9"
torchVersion := "2.1.0"
client := registrytest.NewMockRegistryClient()
client.AddMockImage(BaseImageName(cudaVersion, pythonVersion, torchVersion))
Expand All @@ -57,8 +57,8 @@ func TestGenerateDockerfile(t *testing.T) {
}

func TestBaseImageNameWithVersionModifier(t *testing.T) {
actual := BaseImageName("11.8", "3.8", "2.0.1+cu118")
require.Equal(t, "r8.im/cog-base:cuda11.8-python3.8-torch2.0.1", actual)
actual := BaseImageName("11.8", "3.9", "2.0.1+cu118")
require.Equal(t, "r8.im/cog-base:cuda11.8-python3.9-torch2.0.1", actual)
}

func TestBaseImageConfigurationExists(t *testing.T) {
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestBaseImageConfigurationExistsNoTorch(t *testing.T) {

func TestBaseImageConfigurationExistsNoCUDA(t *testing.T) {
cudaVersion := ""
pythonVersion := "3.8"
pythonVersion := "3.9"
torchVersion := "2.1"
client := registrytest.NewMockRegistryClient()
client.AddMockImage(BaseImageName(cudaVersion, pythonVersion, torchVersion))
Expand Down
4 changes: 2 additions & 2 deletions pkg/dockerfile/monobase_matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func (m MonobaseMatrix) DefaultCudnnVersion() string {
}

func (m MonobaseMatrix) IsSupported(python string, torch string, cuda string) bool {
// Python 3.8 support was removed (EOL October 2024)
// Config validation will reject 3.8 before we get here, but keep check for safety
if python == "3.8" {
// coglet does not support Python 3.8, so we cannot use it for fast-push
// even though it's in the matrix for older models
return false
}
if torch == "" {
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ license.file = "LICENSE"
urls."Source" = "https://github.com/replicate/cog"

classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.8"
requires-python = ">=3.9"

dependencies = [
# intentionally loose. perhaps these should be vendored to not collide with user code?
Expand Down
10 changes: 6 additions & 4 deletions python/cog/server/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,9 @@ def _predict(
predict: Callable[..., Any],
redirector: StreamRedirector,
) -> None:
with evolve_scope(context=context), self._handle_predict_error(
redirector, tag=tag
with (
evolve_scope(context=context),
self._handle_predict_error(redirector, tag=tag),
):
result = predict(**payload)

Expand Down Expand Up @@ -695,8 +696,9 @@ async def _apredict(
predict: Callable[..., Any],
redirector: SimpleStreamRedirector,
) -> None:
with evolve_scope(context=context, tag=tag), self._handle_predict_error(
redirector, tag=tag
with (
evolve_scope(context=context, tag=tag),
self._handle_predict_error(redirector, tag=tag),
):
future_result = predict(**payload)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build:
python_version: "3.8"
python_version: "3.9"
predict: "predict.py:Predictor"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build:
python_version: "3.8"
python_version: "3.9"
predict: "predict.py:Predictor"
Loading