From 862268175e382d81213e96281e5c582341cd36e0 Mon Sep 17 00:00:00 2001 From: Lance Martin <122662504+rlancemartin@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:09:09 -0700 Subject: [PATCH] Add llama-v2 to docs (#7893) --- .../models/llms/integrations/replicate.ipynb | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/docs/extras/modules/model_io/models/llms/integrations/replicate.ipynb b/docs/extras/modules/model_io/models/llms/integrations/replicate.ipynb index 91dbf9a96e7..9d55cdc57c4 100644 --- a/docs/extras/modules/model_io/models/llms/integrations/replicate.ipynb +++ b/docs/extras/modules/model_io/models/llms/integrations/replicate.ipynb @@ -61,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": { "tags": [] }, @@ -85,15 +85,49 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Calling a model\n", "\n", - "Find a model on the [replicate explore page](https://replicate.com/explore), and then paste in the model name and version in this format: model_name/version\n", + "Find a model on the [replicate explore page](https://replicate.com/explore), and then paste in the model name and version in this format: model_name/version.\n", "\n", - "For example, for this [dolly model](https://replicate.com/replicate/dolly-v2-12b), click on the API tab. The model name/version would be: `replicate/dolly-v2-12b:ef0e1aefc61f8e096ebe4db6b2bacc297daf2ef6899f0f7e001ec445893500e5`\n", + "For example, here is [`LLama-V2`](https://replicate.com/a16z-infra/llama13b-v2-chat)." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'1. Dogs do not have the ability to operate complex machinery like cars.\\n2. Dogs do not have hands or fingers to manipulate the steering wheel, pedals, or other controls.\\n3. Dogs do not have the cognitive ability to understand traffic laws or navigate roads.\\n\\nTherefore, the answer is no, a dog cannot drive a car.'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "llm = Replicate(\n", + " model=\"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5\",\n", + " input={\"temperature\": 0.75, \"max_length\": 500, \"top_p\": 1},\n", + ")\n", + "prompt = \"\"\"\n", + "User: Answer the following yes/no question by reasoning step by step. Can a dog drive a car?\n", + "Assistant:\n", + "\"\"\"\n", + "llm(prompt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As another example, for this [dolly model](https://replicate.com/replicate/dolly-v2-12b), click on the API tab. The model name/version would be: `replicate/dolly-v2-12b:ef0e1aefc61f8e096ebe4db6b2bacc297daf2ef6899f0f7e001ec445893500e5`\n", "\n", "Only the `model` param is required, but we can add other model params when initializing.\n", "\n", @@ -403,7 +437,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.9.16" }, "vscode": { "interpreter": {