8000 Do not show option to change code if code is equal by 8W9aG · Pull Request #2309 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Do not show option to change code if code is equal #2309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
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
0