From ef0adca9b2c267d67ab2aa898db4c3b95644bd4d Mon Sep 17 00:00:00 2001 From: Aron Carroll Date: Tue, 20 Feb 2024 11:10:19 +0000 Subject: [PATCH 1/2] Update README.md --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91ba9182..3f98d52a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ We recommend not adding the token directly to your source code, because you don' ## Run a model -Create a new Python file and add the following code: +Create a new Python file and add the following code, replacing the model identifier and input with your own: ```python >>> import replicate @@ -42,6 +42,24 @@ Create a new Python file and add the following code: ['https://replicate.com/api/models/stability-ai/stable-diffusion/files/50fcac81-865d-499e-81ac-49de0cb79264/out-0.png'] ``` +Some models, particularly language models, may be missing the version string. Refer to the API documentation for the model for more on the specifics: + +```python +replicate.run( + "meta/llama-2-70b-chat", + input={ + "debug": False, + "top_k": 50, + "top_p": 1, + "prompt": "Can you write a poem about open source machine learning? Let's make it in the style of E. E. Cummings.", + "temperature": 0.5, + "system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.", + "max_new_tokens": 500, + "min_new_tokens": -1 + }, +) +``` + Some models, like [andreasjansson/blip-2](https://replicate.com/andreasjansson/blip-2), have files as inputs. To run a model that takes a file input, pass a URL to a publicly accessible file. From 143573c745d7a9bec853d2378d2a9d31dfd1644b Mon Sep 17 00:00:00 2001 From: Mattt Date: Thu, 22 Feb 2024 03:56:35 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Zeke Sikelianos --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3f98d52a..e1d8a885 100644 --- a/README.md +++ b/README.md @@ -42,20 +42,14 @@ Create a new Python file and add the following code, replacing the model identif ['https://replicate.com/api/models/stability-ai/stable-diffusion/files/50fcac81-865d-499e-81ac-49de0cb79264/out-0.png'] ``` -Some models, particularly language models, may be missing the version string. Refer to the API documentation for the model for more on the specifics: +Some models, particularly language models, may not require the version string. Refer to the API documentation for the model for more on the specifics: ```python replicate.run( "meta/llama-2-70b-chat", input={ - "debug": False, - "top_k": 50, - "top_p": 1, - "prompt": "Can you write a poem about open source machine learning? Let's make it in the style of E. E. Cummings.", - "temperature": 0.5, - "system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.", - "max_new_tokens": 500, - "min_new_tokens": -1 + "prompt": "Can you write a poem about open source machine learning?", + "system_prompt": "You are a helpful, respectful and honest assistant.", }, ) ```