Skip to content

Commit

Permalink
fix(getting-started.ipynb): fix the notebook to work with newer versi…
Browse files Browse the repository at this point in the history
…on 🫣
  • Loading branch information
AlmogBaku committed Apr 21, 2024
1 parent 2f97891 commit 16a8180
Showing 1 changed file with 58 additions and 43 deletions.
101 changes: 58 additions & 43 deletions docs/docs/getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,38 @@
"from typing_extensions import TypedDict"
],
"metadata": {
"id": "a5eW89kWTdL5"
"id": "a5eW89kWTdL5",
"outputId": "f9cd22e0-8adf-46d6-e550-4e85fd5352b0",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 15,
"outputs": []
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.1/51.1 kB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.8/40.8 MB\u001b[0m \u001b[31m15.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m985.1/985.1 kB\u001b[0m \u001b[31m17.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.5/57.5 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m200.6/200.6 kB\u001b[0m \u001b[31m8.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m135.3/135.3 kB\u001b[0m \u001b[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.3/57.3 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m100.0/100.0 kB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.1/53.1 kB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m68.9/68.9 kB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.8/60.8 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m19.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.6/45.6 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"ibis-framework 8.0.0 requires pyarrow<16,>=2, but you have pyarrow 16.0.0 which is incompatible.\u001b[0m\u001b[31m\n",
"\u001b[0m"
]
}
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -131,7 +159,7 @@
"metadata": {
"id": "25sRcwoMwtR_"
},
"execution_count": 16,
"execution_count": 2,
"outputs": []
},
{
Expand All @@ -146,7 +174,7 @@
"metadata": {
"id": "aUqlADgYbcmr"
},
"execution_count": 17,
"execution_count": 3,
"outputs": []
},
{
Expand All @@ -161,14 +189,14 @@
"metadata": {
"id": "xcHrGi2Nbmh4"
},
"execution_count": 18,
"execution_count": 4,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"---\n",
"> ## 😎 *Cool tip* \n",
"> ## 😎 *Cool tip*\n",
">\n",
"> You can use the `@runtime` decorator to specify packages you want to install and use.\n",
">\n",
Expand Down Expand Up @@ -197,14 +225,14 @@
")\n",
"class Deal(TypedDict):\n",
" id: int\n",
" event_at: pd.Timestamp\n",
" event_at: datetime\n",
" account_id: str\n",
" amount: float"
],
"metadata": {
"id": "L0oPJvDgdKSY"
},
"execution_count": 19,
"execution_count": 5,
"outputs": []
},
{
Expand All @@ -223,7 +251,7 @@
"metadata": {
"id": "1xuZOPyayKHT"
},
"execution_count": 20,
"execution_count": 6,
"outputs": []
},
{
Expand Down Expand Up @@ -253,7 +281,7 @@
"metadata": {
"id": "WOmMn2bxynMp"
},
"execution_count": 21,
"execution_count": 7,
"outputs": []
},
{
Expand All @@ -277,7 +305,7 @@
"metadata": {
"id": "7XEUpCv_d1iS"
},
"execution_count": 22,
"execution_count": 8,
"outputs": []
},
{
Expand All @@ -294,7 +322,7 @@
"metadata": {
"id": "Dp1PzC9Xd27X"
},
"execution_count": 23,
"execution_count": 9,
"outputs": []
},
{
Expand Down Expand Up @@ -331,45 +359,32 @@
" # Split the data into training and testing sets\n",
" X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)\n",
"\n",
" # Transform y_train to a 1D array\n",
" y_train = y_train.values.ravel()\n",
"\n",
" # Initialize an XGBoost model\n",
" xgb_model = XGBClassifier()\n",
"\n",
" # Fit the model to the training data\n",
" from sklearn.preprocessing import LabelEncoder\n",
" le = LabelEncoder()\n",
" y_train = le.fit_transform(y_train)\n",
" xgb_model.fit(X_train, y_train)\n",
"\n",
" # Initialize the LabelEncoder\n",
" le = LabelEncoder()\n",
" y_train_encoded = le.fit_transform(y_train)\n",
"\n",
" # Fit the model with the encoded labels\n",
" xgb_model.fit(X_train, y_train_encoded)\n",
"\n",
" return xgb_model\n",
"\n",
"deal_prediction.export()"
],
"metadata": {
"id": "tNeaKZGMErJ4",
"outputId": "a8de2b44-caf3-4020-c4bb-4cfd6b7376d4",
"colab": {
"base_uri": "https://localhost:8080/"
}
"id": "tNeaKZGMErJ4"
},
"execution_count": 25,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.9/dist-packages/sklearn/preprocessing/_label.py:116: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n",
"ERROR:bentoml._internal.bento.build_config:Failed to lock PyPI packages: Command '['/usr/bin/python3', '-m', 'piptools', 'compile', '/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.txt', '--quiet', '--allow-unsafe', '--no-header', '--output-file=/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.lock.txt', '--resolver=backtracking']' returned non-zero exit status 2.\n",
"Traceback (most recent call last):\n",
" File \"/usr/local/lib/python3.9/dist-packages/bentoml/_internal/bento/build_config.py\", line 662, in write_to_bento\n",
" subprocess.check_call(cmd)\n",
" File \"/usr/lib/python3.9/subprocess.py\", line 373, in check_call\n",
" raise CalledProcessError(retcode, cmd)\n",
"subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'piptools', 'compile', '/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.txt', '--quiet', '--allow-unsafe', '--no-header', '--output-file=/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.lock.txt', '--resolver=backtracking']' returned non-zero exit status 2.\n",
"ERROR:bentoml._internal.bento.build_config:Falling back to using the user-provided package requirement specifiers, which is equivalent to 'lock_packages=false'.\n"
]
}
]
"execution_count": 10,
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -393,17 +408,17 @@
"base_uri": "https://localhost:8080/"
},
"id": "8ESVUlESq3QC",
"outputId": "7e83d9ac-4421-40e2-d68f-502f281239fb"
"outputId": "667c80f4-391f-4f87-8784-841136e02062"
},
"execution_count": 26,
"execution_count": 11,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"make: Entering directory '/content/out'\n",
"make: aws: Command not found\n",
"make: aws: Command not found\n",
"make: aws: No such file or directory\n",
"make: aws: No such file or directory\n",
"\u001b[38;5;97m █▀\n",
"\u001b[38;5;97m █▀ █▀\n",
"\u001b[38;5;97m▄ ██▀ ▄█▀ ▄\n",
Expand Down

0 comments on commit 16a8180

Please sign in to comment.