8000 Remove check for image before pushing by 8W9aG · Pull Request #2339 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove check for image before pushing #2339

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 1 commit into from
May 15, 2025
Merged
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
23 changes: 4 additions & 19 deletions pkg/cli/push.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cli

import (
"errors"
"fmt"
"strings"
"time"
Expand All @@ -16,7 +15,6 @@ import (
"github.com/replicate/cog/pkg/global"
"github.com/replicate/cog/pkg/http"
"github.com/replicate/cog/pkg/image"
"github.com/replicate/cog/pkg/registry"
"github.com/replicate/cog/pkg/util/console"
)

Expand Down Expand Up @@ -78,23 +76,10 @@ func push(cmd *cobra.Command, args []string) error {
}

replicatePrefix := fmt.Sprintf("%s/", global.ReplicateRegistryHost)
if strings.HasPrefix(imageName, replicatePrefix) {
if !buildFast {
if _, err := registry.NewClient().Inspect(ctx, imageName, nil); err != nil {
if errors.Is(err, registry.NotFoundError) {
// TODO[md]: can we create a new model on the fly?
err = fmt.Errorf("Unable to find Replicate existing model for %s. Go to replicate.com and create a new model before pushing.", imageName)
logClient.EndPush(ctx, err, logCtx)
return err
}
}
}
} else {
if buildLocalImage {
err = fmt.Errorf("Unable to push a local image model to a non replicate host, please disable the local image flag before pushing to this host.")
logClient.EndPush(ctx, err, logCtx)
return err
}
if !strings.HasPrefix(imageName, replicatePrefix) && buildLocalImage {
err = fmt.Errorf("Unable to push a local image model to a non replicate host, please disable the local image flag before pushing to this host.")
logClient.EndPush(ctx, err, logCtx)
return err
}

annotations := map[string]string{}
Expand Down
0