Skip to content
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

[Sample]Enable automatic runtime sample #218

Merged
merged 8 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
20 changes: 20 additions & 0 deletions examples/flows/chat/chat-with-pdf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ fi

### CLI Example

#### Run flow in local
D-W- marked this conversation as resolved.
Show resolved Hide resolved

```bash
# test with default input value in flow.dag.yaml
pf flow test --flow .
Expand All @@ -47,3 +49,21 @@ pf run create --flow . --data ./data/bert-paper-qna-3-line.jsonl --stream --colu
# visualize run output details
pf run visualize --name $run_name
```

#### Submit run to cloud

Assume we already have a connection named `open_ai_connection` in workspace.

```bash
# set default workspace
az account set -s <your_subscription_id>
az configure --defaults group=<your_resource_group_name> workspace=<your_workspace_name>
```

``` bash
# create run
pfazure run create --flow . --data ./data/bert-paper-qna-3-line.jsonl --stream --column-mapping question='${data.question}' pdf_url='${data.pdf_url}' chat_history='${data.chat_history}' config='{ \"EMBEDDING_MODEL_DEPLOYMENT_NAME\": \"text-embedding-ada-002\", \"CHAT_MODEL_DEPLOYMENT_NAME\": \"gpt-35-turbo\", \"PROMPT_TOKEN_LIMIT\": \"2000\", \"MAX_COMPLETION_TOKENS\": \"256\", \"VERBOSE\": \"True\", \"CHUNK_SIZE\": \"256\", \"CHUNK_OVERLAP\": \"32\" }' --name $run_name --runtime chat_with_pdf_runtime
D-W- marked this conversation as resolved.
Show resolved Hide resolved
# pfazure run create --flow . --data ./data/bert-paper-qna-3-line.jsonl --stream --column-mapping question='${data.question}' pdf_url='${data.pdf_url}' chat_history='${data.chat_history}' config='{ \"EMBEDDING_MODEL_DEPLOYMENT_NAME\": \"text-embedding-ada-002\", \"CHAT_MODEL_DEPLOYMENT_NAME\": \"gpt-35-turbo\", \"PROMPT_TOKEN_LIMIT\": \"2000\", \"MAX_COMPLETION_TOKENS\": \"256\", \"VERBOSE\": \"True\", \"CHUNK_SIZE\": \"256\", \"CHUNK_OVERLAP\": \"32\" }' --name $run_name # automatic runtime
```

Note: Click portal_url of the run to view the final snapshot.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"# Get a handle to workspace\n",
"pf = azure.PFClient.from_config(credential=credential)\n",
"runtime = \"chat_with_pdf_runtime\" # TODO add guide to create runtime\n",
"# runtime = None # serverless"
"# runtime = None # automatic runtime"
wangchao1230 marked this conversation as resolved.
Show resolved Hide resolved
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions examples/flows/chat/chat-with-pdf/flow.dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ nodes:
question: ${inputs.question}
history: ${inputs.chat_history}
env_ready_signal: ${setup_env.output}
environment:
python_requirements_txt: requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUp(self):

self.pf = azure.PFClient.from_config(credential=credential)
self.runtime = "chat_with_pdf_runtime"
# self.runtime = None # serverless
# self.runtime = None # automatic runtime

def tearDown(self) -> None:
return super().tearDown()
Expand Down
18 changes: 13 additions & 5 deletions examples/flows/standard/flow-with-additional-includes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,20 @@ pf run create --file run.yml --stream

#### Submit run to cloud

Assume we already have a connection named `open_ai_connection` in workspace.

```bash
# set default workspace
az account set -s <your_subscription_id>
az configure --defaults group=<your_resource_group_name> workspace=<your_workspace_name>
```

``` bash
# create run
# pfazure run create --flow . --data ./data.jsonl --stream --runtime demo-mir --subscription <your_subscription_id> -g <your_resource_group_name> -w <your_workspace_name>
# pfazure run create --flow . --data ./data.jsonl --stream # serverless compute
# pfazure run create --file run.yml --runtime demo-mir
# pfazure run create --file run.yml --stream # serverless compute
pfazure run create --flow . --data ./data.jsonl --stream --runtime demo-mir
# pfazure run create --flow . --data ./data.jsonl --stream # automatic runtime
pfazure run create --file run.yml --runtime demo-mir
# pfazure run create --file run.yml --stream # automatic runtime
```

Note: Click portal_url of the run to view the final snapshot.
Note: Click portal_url of the run to view the final snapshot.
4 changes: 2 additions & 2 deletions examples/flows/standard/flow-with-symlinks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ pf run create --file run.yml --stream
``` bash
# create run
pfazure run create --flow . --data ./data.jsonl --stream --runtime demo-mir --subscription <your_subscription_id> -g <your_resource_group_name> -w <your_workspace_name>
# pfazure run create --flow . --data ./data.jsonl --stream # serverless compute
pfazure run create --flow . --data ./data.jsonl --stream # automatic runtime

# set default workspace
az account set -s <your_subscription_id>
az configure --defaults group=<your_resource_group_name> workspace=<your_workspace_name>

pfazure run create --file run.yml --runtime demo-mir --stream
# pfazure run create --file run.yml --stream # serverless compute
# pfazure run create --file run.yml --stream # automatic runtime
```
6 changes: 3 additions & 3 deletions examples/flows/standard/web-classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ az account set -s <your_subscription_id>
az configure --defaults group=<your_resource_group_name> workspace=<your_workspace_name>

# create run
pfazure run create --flow . --data ./data.jsonl --stream --runtime demo-mir --subscription <your_subscription_id> -g <your_resource_group_name> -w <your_workspace_name>
# pfazure run create --flow . --data ./data.jsonl --stream # serverless compute
pfazure run create --flow . --data ./data.jsonl --stream --runtime demo-mir
pfazure run create --flow . --data ./data.jsonl --stream # automatic runtime

# (Optional) create a new random run name for further use
run_name="web_classification_"$(openssl rand -hex 12)

# create run using yaml file, --name is optional
pfazure run create --file run.yml --runtime demo-mir --name $run_name
# pfazure run create --file run.yml --stream --name $run_name # serverless compute
pfazure run create --file run.yml --stream --name $run_name # automatic runtime


pfazure run stream --name $run_name
Expand Down
34 changes: 32 additions & 2 deletions examples/tutorials/run-management/cloud-run-management.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"- create run with remote data\n",
"- create run which references another runs inputs\n",
"- manage runs via run.yaml\n",
"- serverless runtime\n",
"- automatic runtime\n",
"\n",
"\n",
"**Motivations** - This guide will walk you through cloud run management abilities."
Expand Down Expand Up @@ -265,6 +265,36 @@
" runtime=runtime,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4 Create a flow run with uses automatic runtime\n",
"\n",
"If you don't want to create your own runtime, you can leave the `runtime` field empty to use system automatic created runtime."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create run\n",
"run = Run(\n",
" # local flow file\n",
" flow=\"../../flows/standard/web-classification\",\n",
" # remote data\n",
" data=data_id,\n",
")\n",
"\n",
"base_run = pf.runs.create_or_update(\n",
" run=run,\n",
" # leave runtime None to use automatic runtime\n",
" runtime=None,\n",
")"
]
}
],
"metadata": {
Expand All @@ -284,7 +314,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
"version": "3.8.13"
D-W- marked this conversation as resolved.
Show resolved Hide resolved
}
},
"nbformat": 4,
Expand Down