Skip to content
Merged
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
25 changes: 23 additions & 2 deletions pkg/migrate/migrator_v1_v1fast.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,27 @@ func (g *MigratorV1ToV1Fast) runPythonScript(ctx context.Context, file *zip.File
return err
}
newContent := out.String()

pythonFilepath := filepath.Join(dir, pythonFilename)
pythonFile, err := os.Open(pythonFilepath)
if err != nil {
return err
}
content, err := io.ReadAll(pythonFile)
pythonFile.Close()
if err != nil {
return err
}

if newContent == string(content) {
if predictorType == PredictorTypePredict {
g.logCtx.PythonPredictStatus = coglog.StatusPassed
} else {
g.logCtx.PythonTrainStatus = coglog.StatusPassed
}
return nil
}

if strings.TrimSpace(newContent) == "" {
if predictorType == PredictorTypePredict {
g.logCtx.PythonPredictStatus = coglog.StatusPassed
Expand Down Expand Up @@ -336,8 +357,8 @@ func (g *MigratorV1ToV1Fast) runPythonScript(ctx context.Context, file *zip.File
} else {
g.logCtx.PythonTrainStatus = coglog.StatusAccepted
}
pythonFilepath := filepath.Join(dir, pythonFilename)
pythonFile, err := os.Create(pythonFilepath)

pythonFile, err = os.Create(pythonFilepath)
if err != nil {
return util.WrapError(err, "Could not open python predictor file")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Configuration for Cog ⚙️
# Reference: https://cog.run/yaml

build:
# set to true if your model requires a GPU
gpu: true

# a list of ubuntu apt packages to install
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"

# python version in the form '3.11' or '3.11.4'
python_version: "3.11"

# path to a Python requirements.txt file
python_requirements: requirements.txt

# commands run after the environment is setup
run:
- curl -o /usr/local/bin/pget -L "https://github.com/replicate/pget/releases/latest/download/pget_$(uname -s)_$(uname -m)"
- chmod +x /usr/local/bin/pget

# predict.py defines how predictions are run on your model
predict: "predict.py:Predictor"
Loading