Skip to content

Commit

Permalink
Add test for using Torch & Tensorflow together (#1023)
Browse files Browse the repository at this point in the history
* Failing test for using Torch & Tensorflow together

Signed-off-by: Ben Firshman <ben@firshman.com>

* Update to latest versions of CUDA, PyTorch and TensorFlow

---------

Signed-off-by: Ben Firshman <ben@firshman.com>
Co-authored-by: Mattt Zmuda <mattt@replicate.com>
  • Loading branch information
bfirsh and mattt authored Jun 25, 2024
1 parent e2ce64c commit 5c75010
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,31 @@ foo==1.0.0`
require.NotContains(t, requirements, "tensorflow_gpu")
}

func TestPythonPackagesBothTorchAndTensorflow(t *testing.T) {
config := &Config{
Build: &Build{
GPU: true,
PythonVersion: "3.11",
PythonPackages: []string{
"tensorflow==2.16.1",
"torch==2.3.1",
},
CUDA: "12.3",
},
}
err := config.ValidateAndComplete("")
require.NoError(t, err)
require.Equal(t, "12.3", config.Build.CUDA)
require.Equal(t, "8", config.Build.CuDNN)

requirements, err := config.PythonRequirementsForArch("", "", []string{})
require.NoError(t, err)
expected := `--extra-index-url https://download.pytorch.org/whl/cu121
tensorflow==2.16.1
torch==2.3.1+cu121`
require.Equal(t, expected, requirements)
}

func TestCUDABaseImageTag(t *testing.T) {
config := &Config{
Build: &Build{
Expand Down

0 comments on commit 5c75010

Please sign in to comment.