8000 Add cog pull by 8W9aG · Pull Request #2386 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add cog pull #2386

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 17 commits into from
Jun 6, 2025
Merged

Add cog pull #2386

merged 17 commits into from
Jun 6, 2025

Conversation

8W9aG
Copy link
Contributor
@8W9aG 8W9aG commented Jun 3, 2025
  • Adds an API client package
  • Removes API calls from the web client making the web client responsible for fetching a token
  • Uses the API to pull the source of a pipeline, if no tag is provided it fetches the model info and uses the latest version as the tag
  • Adds a pull command (hidden) which makes a call to the API client and extracts the tarball into the local directory, note that it does some checking here to ensure there are no relative paths outside the directory
  • Creates a common errors source file so common errors can be shared between packages

8W9aG and others added 6 commits June 4, 2025 13:24
…tracting an archive containing symbolic links

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Sackfield <will.sackfield@gmail.com>
* Allow automatic deferment of close on response
* Security warnings have been accounted for by
resolving the path and making sure it is within
the project directory.
@8W9aG 8W9aG requested review from michaeldwan and aron June 4, 2025 19:34
Copy link
Contributor
@aron aron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @8W9aG I could do with some context on this one ideally a PR description with an example of the changes.

It looks like it's implemented:

cog pull r8.im/pipelines-beta/hn-search

But when I run this I get:

Bad response: 404 attempting to fetch the image source

If I run cog pull on it's own in a directory I get:

cog.yaml not found in /Users/Aron/Code/cog-examples (or in any parent directories)

If I run cog pull --help I get:

ⅹ unknown command "pull" for "cog"
ⅹ
ⅹ Did you mean this?
ⅹ       push
ⅹ

I think this is entirely for pipelines at the moment right? So I think we should use the --x-pipeline flag and leave off the r8.im identifier for now.

cog pull --x-pipeline pipelines-beta/hn-search

If no pipeline flag is provided we can have an error message that says use docker pull to get images for now.

The rest of it I'm not sure why it's not working, the API code looks correct.

8W9aG and others added 4 commits June 5, 2025 10:13
Co-authored-by: Aron Carroll <aron@replicate.com>
Signed-off-by: Will Sackfield <will.sackfield@gmail.com>
@8W9aG
Copy link
Contributor Author
8W9aG commented Jun 5, 2025

@aron Made the following changes:

  1. Added more detail to the PR
  2. Removed getting image name from config, now the command has a minimum of 1 positional argument enforcing image name in the CLI
  3. cog pull --help seemed to work for me, can you confirm that you don't see it?
  4. Enforced the usage of --x-pipeline and if not added an error message about docker pull

@aron
Copy link
Contributor
aron commented Jun 5, 2025

cog pull --help seemed to work for me, can you confirm that you don't see it?

@8W9aG seems to work in the cog directory, if I run the binary outside of the project directory I get an error message...

@8W9aG
Copy link
Contributor Author
8W9aG commented Jun 5, 2025

cog pull --help seemed to work for me, can you confirm that you don't see it?

@8W9aG seems to work in the cog directory, if I run the binary outside of the project directory I get an error message...

This seems very odd, I did the following test:

sackfield@Mac cog % cd ..
sackfield@Mac dev % ./cog/cog pull --help
Pull the contents of a model into your local directory.

Usage:
  cog pull [IMAGE] [flags]

Examples:
cog pull r8.im/your-username/hotdog-detector

Flags:
  -h, --help   help for pull

Global Flags:
      --debug     Show debugging output
      --version   Show version of Cog

Can you run cog --version just to confirm that you are running this test against the main dev branch?

Copy link
Contributor
@aron aron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This is working great 👍

@8W9aG 8W9aG merged commit 243d297 into main Jun 6, 2025
7 of 10 checks passed
@8W9aG 8W9aG deleted the sackfield/cog-pull branch June 6, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0