replicate / cli Goto Github PK
View Code? Open in Web Editor NEWCLI for Replicate
Home Page: https://replicate.com
License: Apache License 2.0
CLI for Replicate
Home Page: https://replicate.com
License: Apache License 2.0
Training Llama 13B fails with the following error:
replicate train a16z-infra/llama-2-13b-chat train_data="@/Users/andreas/Downloads/massive_abcnotation_dataset.pruned.jsonl" --destination=andreasjansson/abc-llama
Error: failed to parse inputs: failed to upload file: file is not a zip file
Usage:
replicate train <owner/model[:version]> [input=value] ... [flags]
Flags:
-d, --destination string Destination model for training
-h, --help help for train
--json Emit JSON
-s, --separator string Separator between input key and value (default "=")
--web View on web
I get the following error when trying to create a model via the CLI tool. Any idea what could be the issue here? I have set the API Key correctly and replicate model show <owner-redacted>/<name>
works:
ยป replicate model create <owner-redacted>/<name-redacted> --private --hardware gpu-a40-large
Error: failed to create model: failed to create model: Replicate API error: Unknown error: json: cannot unmarshal object into Go struct field APIError.detail of type string
Usage:
replicate model create <owner>/<name> [flags]
Flags:
--cover-image-url string URL of the cover image
--description string Description of the model
--github-url string URL of the GitHub repository
--hardware string SKU of the hardware to run the model
-h, --help help for create
--json Emit JSON
--license-url string URL of the license
--paper-url string URL of the paper
--private Make the new model private
--public Make the new model public
--web View on web
It would be cool if we had release binaries for Linux. At the moment, we only have a streamlined solution for installing the Replicate CLI on MacOS with Homebrew.
brew tap replicate/tap
brew install replicate
If you are on LInux, the only way to install the CLI is to clone the code, install the right version of golang, and build the binary yourself -- which would be a deal breaker for me if I were a Linux user.
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x86a3b6]
goroutine 1 [running]:
github.com/replicate/cli/internal/cmd/model.init.func4(0xd8f940, {0xc000192150, 0x4?, 0x94b1d4?})
/tmp/cli-0.7.1/internal/cmd/model/show.go:77 +0x4d6
github.com/spf13/cobra.(*Command).execute(0xd8f940, {0xc000192120, 0x1, 0x1})
/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xd8c860)
/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/replicate/cli/cmd/replicate.Execute()
/tmp/cli-0.7.1/cmd/replicate/main.go:27 +0x1a
main.main()
/tmp/cli-0.7.1/main.go:6 +0xf
It would be nice to provide access to the UploadFile function from the CLI
Currently when generating the scaffolded project it just prints the stdout of the subprocess directly. This makes it look like the scaffold has failed rather than just the test. It took me a while to work out:
replicate scaffold 3p2twllb5nsudqmtakaygg4dz4 --template=node
Cloning starter repo and installing dependencies...
Cloning into '3p2twllb5nsudqmtakaygg4dz4'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 22 (delta 10), reused 8 (delta 2), pack-reused 0
Receiving objects: 100% (22/22), 4.32 KiB | 4.32 MiB/s, done.
Resolving deltas: 100% (10/10), done.
added 2 packages in 1s
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.2.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.4
npm notice Run npm install -g [email protected] to update!
npm notice
Writing new index.js...
Running example prediction...
Uh oh, an error occurred.
ApiError: Request to https://api.replicate.com/v1/predictions failed with status 402 Payment Required: {"title":"Monthly spend limit reached","detail":"You've hit your monthly spend limit. You can change or remove your limit at https://replicate.com/account/billing#limits.","status":402}
.
at Replicate.request (/Users/Aron/Code/sandbox/3p2twllb5nsudqmtakaygg4dz4/node_modules/replicate/index.js:229:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Replicate.createPrediction (/Users/Aron/Code/sandbox/3p2twllb5nsudqmtakaygg4dz4/node_modules/replicate/lib/predictions.js:24:20)
at async Replicate.run (/Users/Aron/Code/sandbox/3p2twllb5nsudqmtakaygg4dz4/node_modules/replicate/index.js:126:22)
at async main (file:///Users/Aron/Code/sandbox/3p2twllb5nsudqmtakaygg4dz4/index.js:17:18) {
request: Request {
[Symbol(realm)]: { settingsObject: [Object] },
[Symbol(state)]: {
method: 'POST',
localURLsOnly: false,
unsafeRequest: false,
body: [Object],
client: [Object],
reservedClient: null,
replacesClientId: '',
window: 'client',
keepalive: false,
serviceWorkers: 'all',
initiator: '',
destination: '',
priority: null,
origin: 'client',
policyContainer: 'client',
referrer: 'client',
referrerPolicy: '',
mode: 'cors',
useCORSPreflightFlag: false,
credentials: 'same-origin',
useCredentials: false,
cache: 'default',
redirect: 'follow',
integrity: '',
cryptoGraphicsNonceMetadata: '',
parserMetadata: '',
reloadNavigation: false,
historyNavigation: false,
userActivation: false,
taintedOrigin: false,
redirectCount: 0,
responseTainting: 'basic',
preventNoCacheCacheControlHeaderModification: false,
done: false,
timingAllowFailed: false,
headersList: [HeadersList],
urlList: [Array],
url: URL {}
},
[Symbol(signal)]: AbortSignal { aborted: false },
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
}
},
response: Response {
[Symbol(realm)]: null,
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 402,
timingInfo: [Object],
cacheState: '',
statusText: 'Payment Required',
headersList: [HeadersList],
urlList: [Array],
body: [Object]
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
}
}
}
I think a simple place to start would be to have some form of delimiters.
--- START OF OUTPUT ---
...
--- END OF OUTPUT ---
But it might also be worth cleaning up the error messages of the template to make it more friendly too. If this sounds good ๐ and I'll implement it.
The following file gets corrupted when passed in as replicate train stability-ai/sdxl [email protected]
: https://storage.googleapis.com/andreas-scratch-public/input-sprites.zip
md5 input-sprites.zip
: 49ad5c3d2c34b28a1a7376873b64f737
stat -f%z input-sprites.zip
: 870466
md5 data.zip
: f91ab76022a4457aa9f72c3541722520
stat -f%z data.zip
: 869954
When I try to set crop_based_on_salience
to false
, I try:
replicate train stability-ai/sdxl [email protected] resolution=128 crop_based_on_salience=false caption_prefix="pixelart sprites in the style of TOK, " --destination=andreasjansson/sdxl-pixelart-sprites
Training created: https://replicate.com/p/7tyxhvtboyeblkprtiulb6aeqm
The training doesn't actually include the crop_based_on_salience
argument
On my local dev environment, running the following command produces an error:
$ replicate scaffold --template=python
Error: failed to create virtualenv: failed to run command: exit status 127
Running python -m venv env
works for me, though, and I suspect that's more likely to work for other folks, too.
It would be nice to zip a folder or list of inputs automatically when parsing inputs, rather than having to provide a .zip
https://pkg.go.dev/archive/zip is in the go standard library
replicate show
and replicate scaffold
works for predictions owned by my token, but not for any other predictions, even if they're shared.
I'm not sure if this is a regression, or if it has never worked for non-owners.
I tried running the scaffold example in the README
I can see that prediction on the web, even in an incognito window: https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4
But when I tried to scaffold from it, I get an error:
$ replicate scaffold https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4 --template=node
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
Sometimes zsh is a bit finicky about unquoted strings, so I tried quoting the URL:
replicate scaffold "https://replicate.com/p/jpgp263bdekvxileu2ppsy46v4" --template=node
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
Then I tried just the prediction id, but still no joy:
$ replicate scaffold jpgp263bdekvxileu2ppsy46v4 --template=node
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
So then I thought.. maybe I'm not authenticated?
But I can run the scaffold command for my own predictions, created with my zeke
account on Replicate:
$ replicate scaffold 7khq4kzbhoogsnjgcujur7hhgi
Cloning starter repo and installing dependencies...
Cloning into '7khq4kzbhoogsnjgcujur7hhgi'...
...
Done!
Next I created a prediction from one of my orgs (replicate
), then shared it: https://replicate.com/p/elqle2bbcval7o53g7w5wpub4u
But using the CLI with my personal token (not the org token), it fails:
$ replicate prediction show elqle2bbcval7o53g7w5wpub4u
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
$ replicate scaffold elqle2bbcval7o53g7w5wpub4u
Error: failed to get prediction: failed to get prediction: The requested resource could not be found.
$ replicate --version
replicate version 0.7.0
cc @replicate/product @replicate/hackers
AFAIK, there is no other method available aside from passing the token via stdin like following.
echo $REPLICATE_API_TOKEN | replicate auth login --token-stdin
I'm curious about why the token isn't an argument of the login command. Are there any other factors besides security considerations like exposing it in logs?
Alternatively, CLI could access $REPLICATE_API_TOKEN
environment variable and extract the token automatically without requiring any explicit argument. This approach provides a more secure and seamless authentication process for users.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.