A programming framework for agentic AI
azure oai (#920)
Chi Wang35ce9b79e8cc
diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.ymlindex fe62edd1b..90cdb13f0 100644--- a/.github/workflows/deploy-website.yml+++ b/.github/workflows/deploy-website.yml@@ -14,6 +14,8 @@ on:- 'website/*'- '.github/workflows/deploy-website.yml'workflow_dispatch:+ merge_group:+ types: [checks_requested]jobs:checks:diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.ymlindex f187dcd65..14d251236 100644--- a/.github/workflows/python-package.yml+++ b/.github/workflows/python-package.yml@@ -20,6 +20,8 @@ on:- 'notebook/**'- '.github/workflows/python-package.yml'- 'setup.py'+ merge_group:+ types: [checks_requested]jobs:build:diff --git a/flaml/integrations/oai/completion.py b/flaml/integrations/oai/completion.pyindex db5cf4783..0d79e755b 100644--- a/flaml/integrations/oai/completion.py+++ b/flaml/integrations/oai/completion.py@@ -45,8 +45,8 @@ class Completion:"text-ada-001": 0.0004,"text-babbage-001": 0.0005,"text-curie-001": 0.002,- "code-cushman-001": 0.002, # TODO: update when available- "code-davinci-002": 0.02, # TODO: update when available+ "code-cushman-001": 0.024,+ "code-davinci-002": 0.1,"text-davinci-002": 0.02,"text-davinci-003": 0.02,}diff --git a/notebook/integrate_openai.ipynb b/notebook/integrate_openai.ipynbindex d82a23ee6..563a631a3 100644--- a/notebook/integrate_openai.ipynb+++ b/notebook/integrate_openai.ipynb@@ -30,10 +30,10 @@"execution_count": 1,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:46.718963Z",- "iopub.status.busy": "2023-02-05T17:10:46.718348Z",- "iopub.status.idle": "2023-02-05T17:10:46.722958Z",- "shell.execute_reply": "2023-02-05T17:10:46.721858Z"+ "iopub.execute_input": "2023-02-13T23:40:52.317406Z",+ "iopub.status.busy": "2023-02-13T23:40:52.316561Z",+ "iopub.status.idle": "2023-02-13T23:40:52.321193Z",+ "shell.execute_reply": "2023-02-13T23:40:52.320628Z"}},"outputs": [],@@ -54,10 +54,10 @@"execution_count": 2,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:46.725945Z",- "iopub.status.busy": "2023-02-05T17:10:46.725628Z",- "iopub.status.idle": "2023-02-05T17:10:46.732477Z",- "shell.execute_reply": "2023-02-05T17:10:46.731947Z"+ "iopub.execute_input": "2023-02-13T23:40:52.324240Z",+ "iopub.status.busy": "2023-02-13T23:40:52.323783Z",+ "iopub.status.idle": "2023-02-13T23:40:52.330570Z",+ "shell.execute_reply": "2023-02-13T23:40:52.329750Z"}},"outputs": [],@@ -68,6 +68,32 @@" os.environ[\"OPENAI_API_KEY\"] = \"<your OpenAI API key here>\""]},+ {+ "attachments": {},+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "If you use Azure OpenAI, uncomment the following:"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": 3,+ "metadata": {+ "execution": {+ "iopub.execute_input": "2023-02-13T23:40:52.333547Z",+ "iopub.status.busy": "2023-02-13T23:40:52.333249Z",+ "iopub.status.idle": "2023-02-13T23:40:52.336508Z",+ "shell.execute_reply": "2023-02-13T23:40:52.335858Z"+ }+ },+ "outputs": [],+ "source": [+ "# openai.api_type = \"azure\"\n",+ "# openai.api_base = \"https://<your_endpoint>.openai.azure.com/\"\n",+ "# openai.api_version = \"2022-12-01\" # change if necessary"+ ]+ },{"attachments": {},"cell_type": "markdown",@@ -80,13 +106,13 @@},{"cell_type": "code",- "execution_count": 3,+ "execution_count": 4,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:46.735236Z",- "iopub.status.busy": "2023-02-05T17:10:46.734852Z",- "iopub.status.idle": "2023-02-05T17:10:49.037146Z",- "shell.execute_reply": "2023-02-05T17:10:49.036349Z"+ "iopub.execute_input": "2023-02-13T23:40:52.339977Z",+ "iopub.status.busy": "2023-02-13T23:40:52.339556Z",+ "iopub.status.idle": "2023-02-13T23:40:54.603349Z",+ "shell.execute_reply": "2023-02-13T23:40:54.602630Z"}},"outputs": [@@ -100,7 +126,7 @@{"data": {"application/vnd.jupyter.widget-view+json": {- "model_id": "f0cac133ee7d4d9b91352e1002d0ece0",+ "model_id": "454146d0f7224f038689031002906e6f","version_major": 2,"version_minor": 0},@@ -157,13 +183,13 @@},{"cell_type": "code",- "execution_count": 4,+ "execution_count": 5,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:49.042363Z",- "iopub.status.busy": "2023-02-05T17:10:49.041641Z",- "iopub.status.idle": "2023-02-05T17:10:49.050482Z",- "shell.execute_reply": "2023-02-05T17:10:49.049608Z"+ "iopub.execute_input": "2023-02-13T23:40:54.607152Z",+ "iopub.status.busy": "2023-02-13T23:40:54.606441Z",+ "iopub.status.idle": "2023-02-13T23:40:54.610504Z",+ "shell.execute_reply": "2023-02-13T23:40:54.609759Z"},"slideshow": {"slide_type": "subslide"@@ -209,13 +235,13 @@},{"cell_type": "code",- "execution_count": 5,+ "execution_count": 6,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:49.054027Z",- "iopub.status.busy": "2023-02-05T17:10:49.053625Z",- "iopub.status.idle": "2023-02-05T17:10:49.058153Z",- "shell.execute_reply": "2023-02-05T17:10:49.057421Z"+ "iopub.execute_input": "2023-02-13T23:40:54.613590Z",+ "iopub.status.busy": "2023-02-13T23:40:54.613168Z",+ "iopub.status.idle": "2023-02-13T23:40:54.616873Z",+ "shell.execute_reply": "2023-02-13T23:40:54.616193Z"}},"outputs": [@@ -258,13 +284,13 @@},{"cell_type": "code",- "execution_count": 6,+ "execution_count": 7,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:49.061566Z",- "iopub.status.busy": "2023-02-05T17:10:49.061259Z",- "iopub.status.idle": "2023-02-05T17:10:49.066812Z",- "shell.execute_reply": "2023-02-05T17:10:49.066136Z"+ "iopub.execute_input": "2023-02-13T23:40:54.619618Z",+ "iopub.status.busy": "2023-02-13T23:40:54.619218Z",+ "iopub.status.idle": "2023-02-13T23:40:54.624272Z",+ "shell.execute_reply": "2023-02-13T23:40:54.623664Z"}},"outputs": [],@@ -308,13 +334,13 @@},{"cell_type": "code",- "execution_count": 7,+ "execution_count": 8,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:49.070111Z",- "iopub.status.busy": "2023-02-05T17:10:49.069513Z",- "iopub.status.idle": "2023-02-05T17:10:49.077679Z",- "shell.execute_reply": "2023-02-05T17:10:49.076855Z"+ "iopub.execute_input": "2023-02-13T23:40:54.626998Z",+ "iopub.status.busy": "2023-02-13T23:40:54.626593Z",+ "iopub.status.idle": "2023-02-13T23:40:54.631383Z",+ "shell.execute_reply": "2023-02-13T23:40:54.630770Z"}},"outputs": [],@@ -362,13 +388,13 @@},{"cell_type": "code",- "execution_count": 8,+ "execution_count": 9,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:49.081129Z",- "iopub.status.busy": "2023-02-05T17:10:49.080837Z",- "iopub.status.idle": "2023-02-05T17:10:50.481290Z",- "shell.execute_reply": "2023-02-05T17:10:50.480663Z"+ "iopub.execute_input": "2023-02-13T23:40:54.634335Z",+ "iopub.status.busy": "2023-02-13T23:40:54.633929Z",+ "iopub.status.idle": "2023-02-13T23:40:56.105700Z",+ "shell.execute_reply": "2023-02-13T23:40:56.105085Z"},"slideshow": {"slide_type": "slide"@@ -389,13 +415,13 @@},{"cell_type": "code",- "execution_count": 9,+ "execution_count": 10,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:50.484663Z",- "iopub.status.busy": "2023-02-05T17:10:50.484113Z",- "iopub.status.idle": "2023-02-05T17:10:50.487729Z",- "shell.execute_reply": "2023-02-05T17:10:50.487104Z"+ "iopub.execute_input": "2023-02-13T23:40:56.109177Z",+ "iopub.status.busy": "2023-02-13T23:40:56.108624Z",+ "iopub.status.idle": "2023-02-13T23:40:56.112651Z",+ "shell.execute_reply": "2023-02-13T23:40:56.112076Z"},"slideshow": {"slide_type": "slide"@@ -415,11 +441,11 @@"\n","### Perform tuning\n","\n",- "The tuning will take a while to finish, depending on the optimization budget (~15 mins for the current budget). The tuning will be performed under the specified optimization budgets.\n",+ "The tuning will take a while to finish, depending on the optimization budget (~1 min for the current budget). The tuning will be performed under the specified optimization budgets.\n","\n",- "* inference_budget is the target average inference budget per instance in the benchmark. For example, 0.02 means the target inference budget is 0.02 dollars, which translates to 1000 tokens (input + output combined) if the Davinci model is used.\n",- "* optimization_budget is the total budget allowed to perform the tuning. For example, 5 means 5 dollars are allowed in total, which translates to 250K tokens for the Davinci model.\n",- "* num_sumples is the number of different hyperparameter configurations which is allowed to try. The tuning will stop after either num_samples trials or after optimization_budget dollars spent, whichever happens first. -1 means no hard restriction in the number of trials and the actual number is decided by optimization_budget.\n",+ "* `inference_budget` is the target average inference budget per instance in the benchmark. For example, 0.02 means the target inference budget is 0.02 dollars, which translates to 1000 tokens (input + output combined) if the text Davinci model is used.\n",+ "* `optimization_budget` is the total budget allowed to perform the tuning. For example, 5 means 5 dollars are allowed in total, which translates to 250K tokens for the text Davinci model.\n",+ "* `num_sumples` is the number of different hyperparameter configurations which is allowed to try. The tuning will stop after either num_samples trials or after optimization_budget dollars spent, whichever happens first. -1 means no hard restriction in the number of trials and the actual number is decided by `optimization_budget`.\n","\n","Users can specify tuning data, optimization metric, optimization mode, evaluation function, search spaces etc.. The default search space is \n","```python\n",@@ -427,8 +453,8 @@" \"text-ada-001\": 0.0004,\n"," \"text-babbage-001\": 0.0005,\n"," \"text-curie-001\": 0.002,\n",- " \"code-cushman-001\": 0.002, # TODO: update when available\n",- " \"code-davinci-002\": 0.02, # TODO: update when available\n",+ " \"code-cushman-001\": 0.024,\n",+ " \"code-davinci-002\": 0.1,\n"," \"text-davinci-002\": 0.02,\n"," \"text-davinci-003\": 0.02,\n"," }\n",@@ -452,13 +478,13 @@},{"cell_type": "code",- "execution_count": 10,+ "execution_count": 11,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:10:50.490897Z",- "iopub.status.busy": "2023-02-05T17:10:50.490347Z",- "iopub.status.idle": "2023-02-05T17:25:42.172098Z",- "shell.execute_reply": "2023-02-05T17:25:42.171428Z"+ "iopub.execute_input": "2023-02-13T23:40:56.115383Z",+ "iopub.status.busy": "2023-02-13T23:40:56.114975Z",+ "iopub.status.idle": "2023-02-13T23:41:55.045654Z",+ "shell.execute_reply": "2023-02-13T23:41:55.044973Z"}},"outputs": [@@ -466,343 +492,119 @@"name": "stderr","output_type": "stream","text": [- "\u001b[32m[I 2023-02-05 17:10:50,543]\u001b[0m A new study created in memory with name: optuna\u001b[0m\n"+ "\u001b[32m[I 2023-02-13 23:40:56,159]\u001b[0m A new study created in memory with name: optuna\u001b[0m\n"]},{"name": "stderr","output_type": "stream","text": [- "\u001b[32m[I 2023-02-05 17:10:50,545]\u001b[0m A new study created in memory with name: optuna\u001b[0m\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:10:50] {806} INFO - trial 1 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:11:20] {215} INFO - result: {'expected_success': 0.6, 'success': 0.6, 'total_cost': 0.0925, 'cost': 0.0925, 'inference_cost': 0.004625, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.36865945026811975}, 'config/max_tokens': 347, 'config/n': 1, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 30.013915538787842}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:11:20] {806} INFO - trial 2 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:11:38] {215} INFO - result: {'expected_success': 0.35, 'success': 0.35, 'total_cost': 0.101218, 'cost': 0.008718, 'inference_cost': 0.0004359, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.36865945026811975}, 'config/max_tokens': 347, 'config/n': 1, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 18.025962352752686}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:11:38] {806} INFO - trial 3 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.4985070123025904}, 'max_tokens': 97, 'n': 20, 'prompt': 0, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:12:19] {215} INFO - result: {'expected_success': 0.5080706992649381, 'success': 0.55, 'total_cost': 0.1527, 'cost': 0.051482, 'inference_cost': 0.0023973000000000006, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.4985070123025904}, 'max_tokens': 97, 'n': 20, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.4985070123025904}, 'config/max_tokens': 97, 'config/n': 20, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 41.3308367729187}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:12:19] {806} INFO - trial 4 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6125260668293881}, 'max_tokens': 433, 'n': 29, 'prompt': 0, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:14:02] {215} INFO - result: {'expected_success': 0.6186627404336135, 'success': 0.65, 'total_cost': 0.255956, 'cost': 0.103256, 'inference_cost': 0.0049683999999999996, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6125260668293881}, 'max_tokens': 433, 'n': 29, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6125260668293881}, 'config/max_tokens': 433, 'config/n': 29, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 102.09728980064392}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:14:02] {806} INFO - trial 5 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.6177669784693172}, 'max_tokens': 231, 'n': 65, 'prompt': 3, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:14:10] {215} INFO - result: {'expected_success': 0, 'total_cost': 0.298296, 'cost': 0.04234, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.6177669784693172}, 'max_tokens': 231, 'n': 65, 'prompt': 3, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.6177669784693172}, 'config/max_tokens': 231, 'config/n': 65, 'config/prompt': 3, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 8.231895685195923}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:14:10] {806} INFO - trial 6 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.8286813263076767}, 'max_tokens': 57, 'n': 63, 'prompt': 3, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:28] {215} INFO - result: {'expected_success': 0.5406309492528286, 'success': 0.6, 'total_cost': 0.427626, 'cost': 0.12933, 'inference_cost': 0.0061049, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.8286813263076767}, 'max_tokens': 57, 'n': 63, 'prompt': 3, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.8286813263076767}, 'config/max_tokens': 57, 'config/n': 63, 'config/prompt': 3, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 78.36990714073181}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:28] {806} INFO - trial 7 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.3255116378322488}, 'max_tokens': 81, 'n': 39, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:38] {215} INFO - result: {'expected_success': 0, 'total_cost': 0.515286, 'cost': 0.08766, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.3255116378322488}, 'max_tokens': 81, 'n': 39, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'top_p': 0.3255116378322488}, 'config/max_tokens': 81, 'config/n': 39, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 9.500893115997314}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:38] {806} INFO - trial 8 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.25137413420705934}, 'max_tokens': 298, 'n': 90, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:38] {215} INFO - result: {'inference_cost': inf, 'expected_success': -inf, 'cost': 0, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.25137413420705934}, 'max_tokens': 298, 'n': 90, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'top_p': 0.25137413420705934}, 'config/max_tokens': 298, 'config/n': 90, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 0.0005786418914794922}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:38] {806} INFO - trial 9 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.039959208689977266}, 'max_tokens': 180, 'n': 32, 'prompt': 3, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:45] {215} INFO - result: {'expected_success': 0, 'total_cost': 0.6413860000000001, 'cost': 0.12610000000000002, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.039959208689977266}, 'max_tokens': 180, 'n': 32, 'prompt': 3, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'top_p': 0.039959208689977266}, 'config/max_tokens': 180, 'config/n': 32, 'config/prompt': 3, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 7.046289443969727}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:15:45] {806} INFO - trial 10 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.5134666274082884}, 'max_tokens': 298, 'n': 26, 'prompt': 2, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:00] {215} INFO - result: {'expected_success': 0, 'total_cost': 0.7098260000000002, 'cost': 0.06844, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'top_p': 0.5134666274082884}, 'max_tokens': 298, 'n': 26, 'prompt': 2, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'top_p': 0.5134666274082884}, 'config/max_tokens': 298, 'config/n': 26, 'config/prompt': 2, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 14.856077432632446}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:00] {806} INFO - trial 11 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.06425106069482445}, 'max_tokens': 938, 'n': 34, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:00] {215} INFO - result: {'inference_cost': inf, 'expected_success': -inf, 'cost': 0, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.06425106069482445}, 'max_tokens': 938, 'n': 34, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.06425106069482445}, 'config/max_tokens': 938, 'config/n': 34, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 0.0007066726684570312}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:00] {806} INFO - trial 12 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.46453080777933253}, 'max_tokens': 519, 'n': 72, 'prompt': 0, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:29] {215} INFO - result: {'expected_success': 0, 'total_cost': 0.9465260000000002, 'cost': 0.2367, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.46453080777933253}, 'max_tokens': 519, 'n': 72, 'prompt': 0, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.46453080777933253}, 'config/max_tokens': 519, 'config/n': 72, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 29.099194526672363}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:16:29] {806} INFO - trial 13 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.05047767015399762}, 'max_tokens': 137, 'n': 11, 'prompt': 1, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:02] {215} INFO - result: {'expected_success': 0.5496534795196485, 'success': 0.55, 'total_cost': 1.2338460000000002, 'cost': 0.28731999999999996, 'inference_cost': 0.013529000000000001, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.05047767015399762}, 'max_tokens': 137, 'n': 11, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.05047767015399762}, 'config/max_tokens': 137, 'config/n': 11, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 33.49773073196411}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:02] {806} INFO - trial 14 config: {'model': 'code-davinci-002', 'max_tokens': 263, 'n': 41, 'prompt': 0, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.49834557213253655}}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:14] {215} INFO - result: {'expected_success': 0, 'total_cost': 1.293506, 'cost': 0.05966, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'max_tokens': 263, 'n': 41, 'prompt': 0, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.49834557213253655}}, 'config/model': 'code-davinci-002', 'config/max_tokens': 263, 'config/n': 41, 'config/prompt': 0, 'config/stop': 0, 'config/temperature_or_top_p': {'top_p': 0.49834557213253655}, 'experiment_tag': 'exp', 'time_total_s': 11.869095802307129}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:14] {806} INFO - trial 15 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.9770922524005169}, 'max_tokens': 941, 'n': 2, 'prompt': 0, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:54] {215} INFO - result: {'expected_success': 0.3, 'success': 0.35, 'total_cost': 1.310104, 'cost': 0.016598, 'inference_cost': 0.0008100000000000001, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.9770922524005169}, 'max_tokens': 941, 'n': 2, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.9770922524005169}, 'config/max_tokens': 941, 'config/n': 2, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 40.00577735900879}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:17:54] {806} INFO - trial 16 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.012199907437239511}, 'max_tokens': 133, 'n': 1, 'prompt': 0, 'stop': 0}\n"- ]- },- {- "name": "stdout",- "output_type": "stream",- "text": [- "[flaml.tune.tune: 02-05 17:18:09] {215} INFO - result: {'expected_success': 0.3, 'success': 0.3, 'total_cost': 1.31851, 'cost': 0.008406, 'inference_cost': 0.0004203, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.012199907437239511}, 'max_tokens': 133, 'n': 1, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.012199907437239511}, 'config/max_tokens': 133, 'config/n': 1, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 15.392771005630493}\n"+ "\u001b[32m[I 2023-02-13 23:40:56,161]\u001b[0m A new study created in memory with name: optuna\u001b[0m\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:18:09] {806} INFO - trial 17 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.7782116249357127}, 'max_tokens': 488, 'n': 16, 'prompt': 1, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:40:56] {806} INFO - trial 1 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:19:31] {215} INFO - result: {'expected_success': 0.5380678912760336, 'success': 0.55, 'total_cost': 1.3893579999999999, 'cost': 0.07084800000000002, 'inference_cost': 0.0034208000000000003, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.7782116249357127}, 'max_tokens': 488, 'n': 16, 'prompt': 1, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.7782116249357127}, 'config/max_tokens': 488, 'config/n': 16, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 81.26592254638672}\n"+ "[flaml.tune.tune: 02-13 23:40:59] {215} INFO - result: {'expected_success': 0.6, 'success': 0.6, 'total_cost': 0.4624999999999999, 'cost': 0.4624999999999999, 'inference_cost': 0.023125, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.36865945026811975}, 'config/max_tokens': 347, 'config/n': 1, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 3.7016141414642334}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:19:31] {806} INFO - trial 18 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.30477882371544746}, 'max_tokens': 109, 'n': 14, 'prompt': 2, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:40:59] {806} INFO - trial 2 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:20:08] {215} INFO - result: {'expected_success': 0.5087862474147904, 'success': 0.55, 'total_cost': 1.4376559999999998, 'cost': 0.04829800000000001, 'inference_cost': 0.0023106, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.30477882371544746}, 'max_tokens': 109, 'n': 14, 'prompt': 2, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.30477882371544746}, 'config/max_tokens': 109, 'config/n': 14, 'config/prompt': 2, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 37.49694466590881}\n"+ "[flaml.tune.tune: 02-13 23:41:00] {215} INFO - result: {'expected_success': 0.35, 'success': 0.35, 'total_cost': 0.5671159999999997, 'cost': 0.104616, 'inference_cost': 0.0052308, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.36865945026811975}, 'max_tokens': 347, 'n': 1, 'prompt': 1, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.36865945026811975}, 'config/max_tokens': 347, 'config/n': 1, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 0.673302412033081}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:20:08] {806} INFO - trial 19 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.23467418274340088}, 'max_tokens': 491, 'n': 15, 'prompt': 0, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:41:00] {806} INFO - trial 3 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.4985070123025904}, 'max_tokens': 97, 'n': 20, 'prompt': 0, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:21:08] {215} INFO - result: {'expected_success': 0.4990449716057748, 'success': 0.5, 'total_cost': 1.4980659999999997, 'cost': 0.06041, 'inference_cost': 0.0029204000000000005, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.23467418274340088}, 'max_tokens': 491, 'n': 15, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.23467418274340088}, 'config/max_tokens': 491, 'config/n': 15, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 59.75101923942566}\n"+ "[flaml.tune.tune: 02-13 23:41:17] {215} INFO - result: {'expected_success': 0.5080706992649381, 'success': 0.55, 'total_cost': 1.1848999999999996, 'cost': 0.617784, 'inference_cost': 0.0287676, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.4985070123025904}, 'max_tokens': 97, 'n': 20, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.4985070123025904}, 'config/max_tokens': 97, 'config/n': 20, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 16.56331181526184}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:21:08] {806} INFO - trial 20 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6715981837068888}, 'max_tokens': 162, 'n': 44, 'prompt': 1, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:41:17] {806} INFO - trial 4 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6125260668293881}, 'max_tokens': 433, 'n': 29, 'prompt': 0, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:22:22] {215} INFO - result: {'expected_success': 0.7360027932558347, 'success': 0.8, 'total_cost': 1.6311499999999999, 'cost': 0.13308399999999998, 'inference_cost': 0.0064402, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6715981837068888}, 'max_tokens': 162, 'n': 44, 'prompt': 1, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6715981837068888}, 'config/max_tokens': 162, 'config/n': 44, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 73.76863956451416}\n"+ "[flaml.tune.tune: 02-13 23:41:51] {215} INFO - result: {'expected_success': 0.6186627404336135, 'success': 0.65, 'total_cost': 2.4239719999999987, 'cost': 1.2390720000000002, 'inference_cost': 0.059620799999999995, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6125260668293881}, 'max_tokens': 433, 'n': 29, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6125260668293881}, 'config/max_tokens': 433, 'config/n': 29, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 34.57707595825195}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:22:22] {806} INFO - trial 21 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6909471554430933}, 'max_tokens': 333, 'n': 48, 'prompt': 0, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:41:51] {806} INFO - trial 5 config: {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.6177669784693172}, 'max_tokens': 231, 'n': 65, 'prompt': 3, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:24:07] {215} INFO - result: {'expected_success': 0.6707939218514837, 'success': 0.7, 'total_cost': 1.7942219999999998, 'cost': 0.16307199999999997, 'inference_cost': 0.0080082, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6909471554430933}, 'max_tokens': 333, 'n': 48, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6909471554430933}, 'config/max_tokens': 333, 'config/n': 48, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 104.97240209579468}\n"+ "[flaml.tune.tune: 02-13 23:41:51] {215} INFO - result: {'expected_success': 0, 'total_cost': 2.6356719999999987, 'cost': 0.2117, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'temperature_or_top_p': {'temperature': 0.6177669784693172}, 'max_tokens': 231, 'n': 65, 'prompt': 3, 'stop': 0}, 'config/model': 'code-davinci-002', 'config/temperature_or_top_p': {'temperature': 0.6177669784693172}, 'config/max_tokens': 231, 'config/n': 65, 'config/prompt': 3, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 0.0022132396697998047}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:24:07] {806} INFO - trial 22 config: {'model': 'code-cushman-001', 'max_tokens': 130, 'n': 41, 'prompt': 1, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.5350214472192576}}\n"+ "[flaml.tune.tune: 02-13 23:41:51] {806} INFO - trial 6 config: {'model': 'code-davinci-002', 'max_tokens': 263, 'n': 41, 'prompt': 0, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.49834557213253655}}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:25:09] {215} INFO - result: {'expected_success': 0.6432731468677959, 'success': 0.7, 'total_cost': 1.9095459999999997, 'cost': 0.11532400000000001, 'inference_cost': 0.0057662, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'max_tokens': 130, 'n': 41, 'prompt': 1, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.5350214472192576}}, 'config/model': 'code-cushman-001', 'config/max_tokens': 130, 'config/n': 41, 'config/prompt': 1, 'config/stop': 0, 'config/temperature_or_top_p': {'top_p': 0.5350214472192576}, 'experiment_tag': 'exp', 'time_total_s': 62.217190980911255}\n"+ "[flaml.tune.tune: 02-13 23:41:54] {215} INFO - result: {'expected_success': 0, 'total_cost': 3.003171999999999, 'cost': 0.3675, 'training_iteration': 0, 'config': {'model': 'code-davinci-002', 'max_tokens': 263, 'n': 41, 'prompt': 0, 'stop': 0, 'temperature_or_top_p': {'top_p': 0.49834557213253655}}, 'config/model': 'code-davinci-002', 'config/max_tokens': 263, 'config/n': 41, 'config/prompt': 0, 'config/stop': 0, 'config/temperature_or_top_p': {'top_p': 0.49834557213253655}, 'experiment_tag': 'exp', 'time_total_s': 3.3002660274505615}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:25:09] {806} INFO - trial 23 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.829558896181596}, 'max_tokens': 211, 'n': 48, 'prompt': 0, 'stop': 0}\n"+ "[flaml.tune.tune: 02-13 23:41:55] {806} INFO - trial 7 config: {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.8286813263076767}, 'max_tokens': 57, 'n': 63, 'prompt': 3, 'stop': 0}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:25:42] {215} INFO - result: {'expected_success': 0, 'total_cost': 2.00839, 'cost': 0.09884399999999999, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.829558896181596}, 'max_tokens': 211, 'n': 48, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.829558896181596}, 'config/max_tokens': 211, 'config/n': 48, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 32.64395809173584}\n"+ "[flaml.tune.tune: 02-13 23:41:55] {215} INFO - result: {'expected_success': 0, 'total_cost': 4.046379999999999, 'cost': 1.043208, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'temperature': 0.8286813263076767}, 'max_tokens': 57, 'n': 63, 'prompt': 3, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'temperature': 0.8286813263076767}, 'config/max_tokens': 57, 'config/n': 63, 'config/prompt': 3, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 0.007852792739868164}\n"]},{"name": "stdout","output_type": "stream","text": [- "[flaml.tune.tune: 02-05 17:25:42] {827} WARNING - fail to sample a trial for 100 times in a row, stopping.\n"+ "[flaml.tune.tune: 02-13 23:41:55] {827} WARNING - fail to sample a trial for 100 times in a row, stopping.\n"]}],@@ -813,17 +615,16 @@" mode=\"max\", # the optimization mode\n"," eval_func=success_metrics, # the evaluation function to return the success metrics\n"," # log_file_name=\"logs/humaneval.log\", # the log file name\n",- " inference_budget=0.02, # the inference budget (dollar)\n",- " optimization_budget=2, # the optimization budget (dollar)\n",+ " inference_budget=0.1, # the inference budget (dollar)\n",+ " optimization_budget=4, # the optimization budget (dollar)\n"," # num_samples can further limit the number of trials for different hyperparameter configurations;\n"," # -1 means decided by the optimization budget only\n"," num_samples=-1,\n"," model=tune.choice(\n"," [\n",- " # These two models are currently free to use,\n",- " # so no actual cost will incur.\n",- " # We use a pseudo price according to their size to simulate the case\n",- " # where the cost is not zero.\n",+ " # These two models are currently free to use from OpenAI,\n",+ " # so no actual cost will incur. They are not free in Azure OpenAI.\n",+ " # The optimization is based on the price in Azure OpenAI.\n"," \"code-cushman-001\", \n"," \"code-davinci-002\",\n"," ]\n",@@ -850,13 +651,13 @@},{"cell_type": "code",- "execution_count": 11,+ "execution_count": 12,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:25:42.175398Z",- "iopub.status.busy": "2023-02-05T17:25:42.175079Z",- "iopub.status.idle": "2023-02-05T17:25:42.179509Z",- "shell.execute_reply": "2023-02-05T17:25:42.178837Z"+ "iopub.execute_input": "2023-02-13T23:41:55.049204Z",+ "iopub.status.busy": "2023-02-13T23:41:55.048871Z",+ "iopub.status.idle": "2023-02-13T23:41:55.053284Z",+ "shell.execute_reply": "2023-02-13T23:41:55.052574Z"}},"outputs": [@@ -864,8 +665,8 @@"name": "stdout","output_type": "stream","text": [- "optimized config {'model': 'code-cushman-001', 'max_tokens': 162, 'n': 44, 'prompt': '# Python 3{prompt}', 'stop': ['\\nclass', '\\ndef', '\\nif', '\\nprint'], 'top_p': 0.6715981837068888}\n",- "best result on tuning data {'expected_success': 0.7360027932558347, 'success': 0.8, 'total_cost': 1.6311499999999999, 'cost': 0.13308399999999998, 'inference_cost': 0.0064402, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6715981837068888}, 'max_tokens': 162, 'n': 44, 'prompt': 1, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6715981837068888}, 'config/max_tokens': 162, 'config/n': 44, 'config/prompt': 1, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 73.76863956451416}\n"+ "optimized config {'model': 'code-cushman-001', 'max_tokens': 433, 'n': 29, 'prompt': '{prompt}', 'stop': ['\\nclass', '\\ndef', '\\nif', '\\nprint'], 'top_p': 0.6125260668293881}\n",+ "best result on tuning data {'expected_success': 0.6186627404336135, 'success': 0.65, 'total_cost': 2.4239719999999987, 'cost': 1.2390720000000002, 'inference_cost': 0.059620799999999995, 'training_iteration': 0, 'config': {'model': 'code-cushman-001', 'temperature_or_top_p': {'top_p': 0.6125260668293881}, 'max_tokens': 433, 'n': 29, 'prompt': 0, 'stop': 0}, 'config/model': 'code-cushman-001', 'config/temperature_or_top_p': {'top_p': 0.6125260668293881}, 'config/max_tokens': 433, 'config/n': 29, 'config/prompt': 0, 'config/stop': 0, 'experiment_tag': 'exp', 'time_total_s': 34.57707595825195}\n"]}],@@ -890,13 +691,13 @@},{"cell_type": "code",- "execution_count": 12,+ "execution_count": 13,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:25:42.182382Z",- "iopub.status.busy": "2023-02-05T17:25:42.181954Z",- "iopub.status.idle": "2023-02-05T17:25:43.701944Z",- "shell.execute_reply": "2023-02-05T17:25:43.701038Z"+ "iopub.execute_input": "2023-02-13T23:41:55.056205Z",+ "iopub.status.busy": "2023-02-13T23:41:55.055631Z",+ "iopub.status.idle": "2023-02-13T23:41:56.039259Z",+ "shell.execute_reply": "2023-02-13T23:41:56.038427Z"},"slideshow": {"slide_type": "subslide"@@ -914,85 +715,85 @@" \"finish_reason\": \"stop\",\n"," \"index\": 0,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 1,\n"," \"logprobs\": null,\n",- " \"text\": \" l = len(game)\\n l1 = len(guess)\\n if l!=l1:\\n return []\\n else:\\n list1 = []\\n for i in range(l):\\n if game[i]==guess[i]:\\n list1.append(0)\\n else:\\n list1.append(abs(game[i]-guess[i]))\\n return list1\\n \\n \\n \\n\\n# Testing\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 2,\n"," \"logprobs\": null,\n",- " \"text\": \" score = 0\\n res = []\\n for i in range(len(game)):\\n if game[i] == guess[i]:\\n res.append(0)\\n else:\\n res.append(abs(guess[i] - game[i]))\\n return res\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 3,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(guess-game[i]) for i in range(len(game))]\"\n",+ " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\\n\\n#print(compare([1,2,3,4,5,1],[1,2,3,4,2,-2]))\\n#print(compare([0,5,0,0,0,4],[4,1,1,0,0,-2]))\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 4,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\\n\"\n",+ " \"text\": \" #\\n # TODO: Define compare\\n #\\n return None\\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 5,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(guess-game[i]) for i in range(len(game))]\"\n",+ " \"text\": \" # your code here\\n return [abs(game[i]-guess[i]) for i in range(len(game))]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 6,\n"," \"logprobs\": null,\n",- " \"text\": \" score = [abs(game[i]-guess[i]) for i in range(len(game))]\\n return score\\n\\n# solution\"\n",+ " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\\n \\n\\n# Recursion\\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"stop\",\n",+ " \"finish_reason\": \"length\",\n"," \"index\": 7,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\\n\\n# Some random testing\\nimport random\"\n",+ " \"text\": \" #return a list of the absolute difference between guess and score\\n return [abs(score-guess) for score,guess in zip(game,guess)]\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 8,\n"," \"logprobs\": null,\n",- " \"text\": \" res = []\\n for i in range(len(guess)):\\n if game[i] == guess[i]:\\n res.append(0)\\n else:\\n res.append(abs(game[i]-guess[i]))\\n return res\"\n",+ " \"text\": \" #Your code goes here\\n guess = np.array(guess)\\n score = np.array(game)\\n res = np.zeros(len(guess))\\n for i in range(len(guess)):\\n if guess[i] == score[i]:\\n res[i] = 0\\n else:\\n res[i] = abs(guess[i] - score[i])\\n return res\\n\\n#print(compare([1,2,3,4,5,1],[1,2,3,4,2,-2]))\\n#print(compare([0,5,0,0,0,4],[4,1,1,0,0,-2]))\\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 9,\n"," \"logprobs\": null,\n",- " \"text\": \" assert(len(game) == len(guess))\\n diff = []\\n for i in range(len(game)):\\n diff.append(abs(game[i]-guess[i]))\\n return diff\"\n",+ " \"text\": \" if len(game) != len(guess):\\n return \\\"Your arrays are not of equal length.\\\"\\n else:\\n return [abs(guess[i]-game[i]) for i in range(len(guess))]\"\n"," },\n"," {\n"," \"finish_reason\": \"length\",\n"," \"index\": 10,\n"," \"logprobs\": null,\n",- " \"text\": \" if len(game) != len(guess):\\n raise ValueError(\\\"Arrays must be of same length\\\")\\n elif len(game) < 2:\\n raise ValueError(\\\"Arrays must contain more than one element\\\")\\n elif len(game) == 2:\\n if game[0] == guess[0]:\\n return [0]\\n else:\\n return [abs(guess[0]-game[0])]\\n else:\\n if guess[0] == game[0]:\\n return [0] + compare(game[1:],guess[1:])\\n else:\\n return [abs(guess[0]-game[0])] + compare(game\"\n",+ " \"text\": \" l = []\\n for i in range(len(guess)):\\n if guess[i] == game[i]:\\n l.append(0)\\n else:\\n l.append(abs(guess[i] - game[i]))\\n return l\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 11,\n"," \"logprobs\": null,\n",- " \"text\": \" l=len(game)\\n l2=len(guess)\\n res=[]\\n if l!=l2:\\n return \\\"different lengths\\\"\\n for i in range(l):\\n res.append(abs(game[i]-guess[i]))\\n return res\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"length\",\n",+ " \"finish_reason\": \"stop\",\n"," \"index\": 12,\n"," \"logprobs\": null,\n",- " \"text\": \" if len(game) != len(guess):\\n return None\\n #1st way\\n #result = []\\n #for i in range(len(game)):\\n # result.append(game[i] - guess[i])\\n #return result\\n #2nd way\\n return [game[i] - guess[i] for i in range(len(game))]\\n \\n #3rd way\\n #return [abs(game[i] - guess[i]) for i in range(len(game))]\\n\\n# 4. \\n# Sort the scores in ascending order. If two scores are the same, put the player with the lower rank \\n# at the start\"\n",+ " \"text\": \" assert len(game) == len(guess), \\\"the length of game and guess must be equal\\\"\\n return [abs(guess[i] - game[i]) for i in range(len(game))]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 13,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(game))]\"\n",+ " \"text\": \" return [abs(a-b) for a,b in zip(game,guess)]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n",@@ -1004,185 +805,95 @@" \"finish_reason\": \"length\",\n"," \"index\": 15,\n"," \"logprobs\": null,\n",- " \"text\": \" #TODO: \\n\\n\\n#Test.describe(\\\"Basic tests\\\")\\n#Test.assert_equals(compare([1,2,3,4,5,1],[1,2,3,4,2,-2]), [0,0,0,0,3,3])\\n#Test.assert_equals(compare([0,5,0,0,0,4],[4,1,1,0,0,-2]), [4,4,1,0,0,6])\\n#Test.assert_equals(compare([0,0,0,0,0,0],[4,1,1,0,0,-2]), [4,4,1,0,\"\n",+ " \"text\": \" answer = []\\n for i in range(len(guess)):\\n answer.append(guess[i]-game[i])\\n return answer\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 16,\n"," \"logprobs\": null,\n",- " \"text\": \" # your code here\\n guess=guess[:]\\n for i in range(len(game)):\\n guess[i]+=abs(guess[i]-game[i])\\n return guess\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\\n\\n#%%\\n#EXAMPLE\\n#%%\\ngame = [1,2,3,4,5,1]\\nguess = [1,2,3,4,2,-2]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 17,\n"," \"logprobs\": null,\n",- " \"text\": \" assert(len(game)==len(guess))\\n ans = []\\n for i in range(len(game)):\\n if game[i]==guess[i]:\\n ans.append(0)\\n else:\\n ans.append(abs(game[i]-guess[i]))\\n return ans\"\n",+ " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\\n \\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 18,\n"," \"logprobs\": null,\n",- " \"text\": \" diffs = []\\n for i in range(len(game)):\\n diffs.append(abs(guess[i]-game[i]))\\n return diffs\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"stop\",\n",+ " \"finish_reason\": \"length\",\n"," \"index\": 19,\n"," \"logprobs\": null,\n",- " \"text\": \" if len(game) != len(guess):\\n return \\\"the game and guess must be the same length\\\"\\n else:\\n newlist = []\\n for i in range(len(game)):\\n if game[i] == guess[i]:\\n newlist.append(0)\\n else:\\n newlist.append(abs(guess[i]-game[i]))\\n return newlist\\n\\ngame = [1,2,3,4,5,1]\\nguess = [1,2,3,4,2,-2]\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"stop\",\n",+ " \"finish_reason\": \"length\",\n"," \"index\": 20,\n"," \"logprobs\": null,\n",- " \"text\": \" #game = [1,2,3,4,5,1]\\n #guess = [1,2,3,4,2,-2]\\n assert len(game) == len(guess), \\\"The number of guesses and the number of scores must be equal.\\\"\\n result = []\\n for i in range(len(game)):\\n if game[i] == guess[i]:\\n result.append(0)\\n else:\\n result.append(abs(game[i]-guess[i]))\\n return result\\n\"\n",+ " \"text\": \" if len(game) != len(guess):\\n return []\\n results = []\\n for i in range(len(game)):\\n results.append(abs(guess[i] - game[i]))\\n return results\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 21,\n"," \"logprobs\": null,\n",- " \"text\": \" results = []\\n for i in range(len(game)):\\n if game[i] == guess[i]:\\n results.append(0)\\n else:\\n results.append(abs(game[i]-guess[i]))\\n return results\"\n",+ " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"stop\",\n",+ " \"finish_reason\": \"length\",\n"," \"index\": 22,\n"," \"logprobs\": null,\n",- " \"text\": \" # Check that both inputs are the same length\\n if len(game) != len(guess):\\n raise ValueError(\\\"input arrays must be the same length\\\")\\n # Compare scores to guesses\\n result = []\\n for index in range(len(game)):\\n if game[index] == guess[index]:\\n result.append(0)\\n else:\\n result.append(abs(game[index] - guess[index]))\\n return result\\n\\n# My solution\"\n",+ " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(game))]\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\"\n"," },\n"," {\n",- " \"finish_reason\": \"stop\",\n",+ " \"finish_reason\": \"length\",\n"," \"index\": 23,\n"," \"logprobs\": null,\n",- " \"text\": \" res = []\\n for i in range(len(guess)):\\n if guess[i] == game[i]:\\n res.append(0)\\n else:\\n res.append(abs(guess[i] - game[i]))\\n return res\"\n",+ " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(guess))]\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 24,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(x-y) for x,y in zip(game,guess)]\"\n",+ " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(guess))]\\n \"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 25,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(game[i] - guess[i]) for i in range(len(game))]\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\\n\\n#or use the following solution\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 26,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(x-y) for x,y in zip(game,guess)]\"\n",+ " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\\n\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 27,\n"," \"logprobs\": null,\n",- " \"text\": \" #my code\\n diff = [abs(x - y) for x, y in zip(guess, game)]\\n return diff\\n\\n\\n# ----------------------------------------------------------------------------------------------------------------------\\n\"\n",+ " \"text\": \" return [abs(score-guess) for score,guess in zip(game,guess)]\"\n"," },\n"," {\n"," \"finish_reason\": \"stop\",\n"," \"index\": 28,\n"," \"logprobs\": null,\n",- " \"text\": \" return [abs(x-y) for x,y in zip(game,guess)]\\n \\n# Main\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 29,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(game))]\\n\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 30,\n",- " \"logprobs\": null,\n",- " \"text\": \" # Your code here\\n return [abs(guess-score) for score,guess in zip(game,guess)]\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"length\",\n",- " \"index\": 31,\n",- " \"logprobs\": null,\n",- " \"text\": \" # Your code here\\n if not game or not guess:\\n return []\\n diff = [abs(a - b) for a, b in zip(game, guess)]\\n return diff\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"length\",\n",- " \"index\": 32,\n",- " \"logprobs\": null,\n",- " \"text\": \" # if len(game) != len(guess):\\n # return \\\"arrays are not of equal length\\\"\\n # for i in range(len(game)):\\n # if game[i] == guess[i]:\\n # continue\\n # else:\\n # game[i] = abs(game[i] - guess[i])\\n # return game\\n return [abs(game[i] - guess[i]) for i in range(len(game))]\\n \\n \\n# compare([1,2,3,4,5,1],[1,2,3,4,2,-2])\\n\\n# # Test.describe(\\\"Basic tests\\\")\\n#\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 33,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i]-game[i]) for i in range(len(guess))]\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 34,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(game))]\\n\\n# These \\\"asserts\\\" using only for self-checking and not necessary for auto-testing\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 35,\n",- " \"logprobs\": null,\n",- " \"text\": \" # game = [1,2,3,4,5,1]\\n # guess = [1,2,3,4,2,-2]\\n answer = []\\n for i in range(len(game)):\\n answer.append(game[i] - guess[i])\\n return answer\\n\\n\\n#Python 2\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 36,\n",- " \"logprobs\": null,\n",- " \"text\": \" #YOUR CODE GOES HERE\\n pass\\n\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"length\",\n",- " \"index\": 37,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(x-y) for x,y in zip(game,guess)]\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 38,\n",- " \"logprobs\": null,\n",- " \"text\": \" # your code\\n return [0 if i == j else abs(i-j) for i,j in zip(game,guess)]\\n\\n# print(compare([1,2,3,4,5,1],[1,2,3,4,2,-2]))\\n\\n# Python 3\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 39,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(game[i]-guess[i]) for i in range(len(game))]\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 40,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(game[i] - guess[i]) for i in range(len(game))]\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 41,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(guess[i] - game[i]) for i in range(len(guess))]\\n\\n#print(compare([1,2,3,4,5,1],[1,2,3,4,2,-2]))\\n#print(compare([0,5,0,0,0,4],[4,1,1,0,0,-2]))\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 42,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(game[i] - guess[i]) for i in range(len(game))]\\n \\n# Python 2\"\n",- " },\n",- " {\n",- " \"finish_reason\": \"stop\",\n",- " \"index\": 43,\n",- " \"logprobs\": null,\n",- " \"text\": \" return [abs(score-guess) for score,guess in zip(game,guess)]\"\n",+ " \"text\": \" results = []\\n for i in range(len(game)):\\n if guess[i] == game[i]:\\n results.append(0)\\n else:\\n results.append(abs(guess[i] - game[i]))\\n return results\\n\"\n"," }\n"," ],\n",- " \"created\": 1675617672,\n",- " \"id\": \"cmpl-6gczQC8OUNTnXpaMqwsyOTZeiLgE6\",\n",+ " \"created\": 1675617146,\n",+ " \"id\": \"cmpl-6gcqwCz8JXC5eB62rsjxrcIgL3n4B\",\n"," \"model\": \"code-cushman-001\",\n"," \"object\": \"text_completion\",\n"," \"usage\": {\n",- " \"completion_tokens\": 2848,\n",- " \"prompt_tokens\": 242,\n",- " \"total_tokens\": 3090\n",+ " \"completion_tokens\": 3959,\n",+ " \"prompt_tokens\": 239,\n",+ " \"total_tokens\": 4198\n"," }\n","}\n"]@@ -1208,18 +919,18 @@"source": ["### Evaluate the success rate on the test data\n","\n",- "You can use flaml's `oai.Completion.eval` to evaluate the performance of an entire dataset with the tuned config. To do that you need to set `oai.Completion.data` to the data to evaluate. The following code will take a while to evaluate all the 144 test data instances. Compared to the baseline success rate (0.46) on the [HELM benchmark](https://crfm.stanford.edu/helm/latest/?group=code_humaneval), the tuned config has a success rate of 0.72. It can be further improved if the inference budget and optimization budget are further increased."+ "You can use flaml's `oai.Completion.eval` to evaluate the performance of an entire dataset with the tuned config. To do that you need to set `oai.Completion.data` to the data to evaluate. The following code will take a while to evaluate all the 144 test data instances. Compared to the baseline success rate (0.46) on the [HELM benchmark](https://crfm.stanford.edu/helm/latest/?group=code_humaneval), the tuned config has a success rate of 0.68. It can be further improved if the inference budget and optimization budget are further increased."]},{"cell_type": "code",- "execution_count": 13,+ "execution_count": 14,"metadata": {"execution": {- "iopub.execute_input": "2023-02-05T17:25:43.705161Z",- "iopub.status.busy": "2023-02-05T17:25:43.704845Z",- "iopub.status.idle": "2023-02-05T17:35:06.804923Z",- "shell.execute_reply": "2023-02-05T17:35:06.803893Z"+ "iopub.execute_input": "2023-02-13T23:41:56.042764Z",+ "iopub.status.busy": "2023-02-13T23:41:56.042086Z",+ "iopub.status.idle": "2023-02-13T23:53:05.597643Z",+ "shell.execute_reply": "2023-02-13T23:53:05.596603Z"}},"outputs": [@@ -1227,7 +938,7 @@"name": "stdout","output_type": "stream","text": [- "{'expected_success': 0.6661693627028851, 'success': 0.7152777777777778, 'total_cost': 2.919666000000001, 'cost': 0.9112759999999998, 'inference_cost': 0.006328305555555556}\n"+ "{'expected_success': 0.6364503360372493, 'success': 0.6805555555555556, 'total_cost': 12.227739999999997, 'cost': 8.181360000000003, 'inference_cost': 0.056815}\n"]}],@@ -1254,7 +965,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.9.15 (main, Oct 26 2022, 03:47:43) \n[GCC 10.2.1 20210110]"+ "version": "3.9.15"},"vscode": {"interpreter": {@@ -1264,51 +975,7 @@"widgets": {"application/vnd.jupyter.widget-state+json": {"state": {- "1e573b802f50427686c094419afde154": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "FloatProgressModel",- "state": {- "_dom_classes": [],- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "FloatProgressModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/controls",- "_view_module_version": "2.0.0",- "_view_name": "ProgressView",- "bar_style": "success",- "description": "",- "description_allow_html": false,- "layout": "IPY_MODEL_83c2cf7a5a6c4d199ec7a0af631714fa",- "max": 1,- "min": 0,- "orientation": "horizontal",- "style": "IPY_MODEL_b273a2f4abab4419a27333d07a390fe3",- "tabbable": null,- "tooltip": null,- "value": 1- }- },- "2272446ea4b441649ca2bb48f41d1211": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "HTMLStyleModel",- "state": {- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "HTMLStyleModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/base",- "_view_module_version": "2.0.0",- "_view_name": "StyleView",- "background": null,- "description_width": "",- "font_size": null,- "text_color": null- }- },- "83c2cf7a5a6c4d199ec7a0af631714fa": {+ "2d910cfd2d2a4fc49fc30fbbdc5576a7": {"model_module": "@jupyter-widgets/base","model_module_version": "2.0.0","model_name": "LayoutModel",@@ -1361,7 +1028,57 @@"width": null}},- "98a6cebd3c7f4e4da00fbe350fab7ece": {+ "454146d0f7224f038689031002906e6f": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "HBoxModel",+ "state": {+ "_dom_classes": [],+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "HBoxModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/controls",+ "_view_module_version": "2.0.0",+ "_view_name": "HBoxView",+ "box_style": "",+ "children": [+ "IPY_MODEL_e4ae2b6f5a974fd4bafb6abb9d12ff26",+ "IPY_MODEL_577e1e3cc4db4942b0883577b3b52755",+ "IPY_MODEL_b40bdfb1ac1d4cffb7cefcb870c64d45"+ ],+ "layout": "IPY_MODEL_dc83c7bff2f241309537a8119dfc7555",+ "tabbable": null,+ "tooltip": null+ }+ },+ "577e1e3cc4db4942b0883577b3b52755": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "FloatProgressModel",+ "state": {+ "_dom_classes": [],+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "FloatProgressModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/controls",+ "_view_module_version": "2.0.0",+ "_view_name": "ProgressView",+ "bar_style": "success",+ "description": "",+ "description_allow_html": false,+ "layout": "IPY_MODEL_2d910cfd2d2a4fc49fc30fbbdc5576a7",+ "max": 1,+ "min": 0,+ "orientation": "horizontal",+ "style": "IPY_MODEL_74a6ba0c3cbc4051be0a83e152fe1e62",+ "tabbable": null,+ "tooltip": null,+ "value": 1+ }+ },+ "6086462a12d54bafa59d3c4566f06cb2": {"model_module": "@jupyter-widgets/base","model_module_version": "2.0.0","model_name": "LayoutModel",@@ -1414,7 +1131,82 @@"width": null}},- "b154f9b976aa4f81999cd1d227a7ebde": {+ "74a6ba0c3cbc4051be0a83e152fe1e62": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "ProgressStyleModel",+ "state": {+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "ProgressStyleModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/base",+ "_view_module_version": "2.0.0",+ "_view_name": "StyleView",+ "bar_color": null,+ "description_width": ""+ }+ },+ "7d3f3d9e15894d05a4d188ff4f466554": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "HTMLStyleModel",+ "state": {+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "HTMLStyleModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/base",+ "_view_module_version": "2.0.0",+ "_view_name": "StyleView",+ "background": null,+ "description_width": "",+ "font_size": null,+ "text_color": null+ }+ },+ "b40bdfb1ac1d4cffb7cefcb870c64d45": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "HTMLModel",+ "state": {+ "_dom_classes": [],+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "HTMLModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/controls",+ "_view_module_version": "2.0.0",+ "_view_name": "HTMLView",+ "description": "",+ "description_allow_html": false,+ "layout": "IPY_MODEL_f1355871cc6f4dd4b50d9df5af20e5c8",+ "placeholder": "",+ "style": "IPY_MODEL_ca245376fd9f4354af6b2befe4af4466",+ "tabbable": null,+ "tooltip": null,+ "value": " 1/1 [00:00<00:00, 44.69it/s]"+ }+ },+ "ca245376fd9f4354af6b2befe4af4466": {+ "model_module": "@jupyter-widgets/controls",+ "model_module_version": "2.0.0",+ "model_name": "HTMLStyleModel",+ "state": {+ "_model_module": "@jupyter-widgets/controls",+ "_model_module_version": "2.0.0",+ "_model_name": "HTMLStyleModel",+ "_view_count": null,+ "_view_module": "@jupyter-widgets/base",+ "_view_module_version": "2.0.0",+ "_view_name": "StyleView",+ "background": null,+ "description_width": "",+ "font_size": null,+ "text_color": null+ }+ },+ "dc83c7bff2f241309537a8119dfc7555": {"model_module": "@jupyter-widgets/base","model_module_version": "2.0.0","model_name": "LayoutModel",@@ -1467,23 +1259,30 @@"width": null}},- "b273a2f4abab4419a27333d07a390fe3": {+ "e4ae2b6f5a974fd4bafb6abb9d12ff26": {"model_module": "@jupyter-widgets/controls","model_module_version": "2.0.0",- "model_name": "ProgressStyleModel",+ "model_name": "HTMLModel","state": {+ "_dom_classes": [],"_model_module": "@jupyter-widgets/controls","_model_module_version": "2.0.0",- "_model_name": "ProgressStyleModel",+ "_model_name": "HTMLModel","_view_count": null,- "_view_module": "@jupyter-widgets/base",+ "_view_module": "@jupyter-widgets/controls","_view_module_version": "2.0.0",- "_view_name": "StyleView",- "bar_color": null,- "description_width": ""+ "_view_name": "HTMLView",+ "description": "",+ "description_allow_html": false,+ "layout": "IPY_MODEL_6086462a12d54bafa59d3c4566f06cb2",+ "placeholder": "",+ "style": "IPY_MODEL_7d3f3d9e15894d05a4d188ff4f466554",+ "tabbable": null,+ "tooltip": null,+ "value": "100%"}},- "b506997e1496457b960f633e9fa4decf": {+ "f1355871cc6f4dd4b50d9df5af20e5c8": {"model_module": "@jupyter-widgets/base","model_module_version": "2.0.0","model_name": "LayoutModel",@@ -1535,94 +1334,6 @@"visibility": null,"width": null}- },- "bcceb81a497643a1a9bd2e5f34ebdf87": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "HTMLModel",- "state": {- "_dom_classes": [],- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "HTMLModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/controls",- "_view_module_version": "2.0.0",- "_view_name": "HTMLView",- "description": "",- "description_allow_html": false,- "layout": "IPY_MODEL_b154f9b976aa4f81999cd1d227a7ebde",- "placeholder": "",- "style": "IPY_MODEL_2272446ea4b441649ca2bb48f41d1211",- "tabbable": null,- "tooltip": null,- "value": " 1/1 [00:00<00:00, 26.28it/s]"- }- },- "c0f5bae3823f4acda0d8d97581c91028": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "HTMLModel",- "state": {- "_dom_classes": [],- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "HTMLModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/controls",- "_view_module_version": "2.0.0",- "_view_name": "HTMLView",- "description": "",- "description_allow_html": false,- "layout": "IPY_MODEL_b506997e1496457b960f633e9fa4decf",- "placeholder": "",- "style": "IPY_MODEL_ea73cf00ea304b83bb5ba6616ea9a1f7",- "tabbable": null,- "tooltip": null,- "value": "100%"- }- },- "ea73cf00ea304b83bb5ba6616ea9a1f7": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "HTMLStyleModel",- "state": {- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "HTMLStyleModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/base",- "_view_module_version": "2.0.0",- "_view_name": "StyleView",- "background": null,- "description_width": "",- "font_size": null,- "text_color": null- }- },- "f0cac133ee7d4d9b91352e1002d0ece0": {- "model_module": "@jupyter-widgets/controls",- "model_module_version": "2.0.0",- "model_name": "HBoxModel",- "state": {- "_dom_classes": [],- "_model_module": "@jupyter-widgets/controls",- "_model_module_version": "2.0.0",- "_model_name": "HBoxModel",- "_view_count": null,- "_view_module": "@jupyter-widgets/controls",- "_view_module_version": "2.0.0",- "_view_name": "HBoxView",- "box_style": "",- "children": [- "IPY_MODEL_c0f5bae3823f4acda0d8d97581c91028",- "IPY_MODEL_1e573b802f50427686c094419afde154",- "IPY_MODEL_bcceb81a497643a1a9bd2e5f34ebdf87"- ],- "layout": "IPY_MODEL_98a6cebd3c7f4e4da00fbe350fab7ece",- "tabbable": null,- "tooltip": null- }}},"version_major": 2,diff --git a/setup.py b/setup.pyindex d6027ffc4..d080b5fd3 100644--- a/setup.py+++ b/setup.py@@ -76,6 +76,7 @@ setuptools.setup("nbconvert","nbformat","ipykernel",+ "pytorch-lightning<1.9.1", # test_forecast_panel],"catboost": ["catboost>=0.26"],"blendsearch": ["optuna==2.8.0"],diff --git a/test/openai/test_notebook.py b/test/openai/test_notebook.pyindex 8b85d19e1..dc2fef32b 100644--- a/test/openai/test_notebook.py+++ b/test/openai/test_notebook.py@@ -2,7 +2,6 @@ import nbformatfrom nbconvert.preprocessors import ExecutePreprocessorfrom nbconvert.preprocessors import CellExecutionErrorimport os-import sysimport pytesttry: