Skip to content

Commit

Permalink
Fix old links and references to comet.ml domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothiraldan committed Jul 9, 2024
1 parent 2cda82e commit dd0d430
Show file tree
Hide file tree
Showing 30 changed files with 2,003 additions and 1,771 deletions.
94 changes: 57 additions & 37 deletions SageMaker/Linear_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"metadata": {},
"outputs": [],
"source": [
"bucket = 'NAME_YOUR_BUCKET'\n",
"prefix = 'sagemaker/DEMO-linear-mnist'\n",
" \n",
"bucket = \"NAME_YOUR_BUCKET\"\n",
"prefix = \"sagemaker/DEMO-linear-mnist\"\n",
"\n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
Expand All @@ -64,9 +64,11 @@
"import pickle, gzip, numpy, urllib.request, json\n",
"\n",
"# Load the dataset\n",
"urllib.request.urlretrieve(\"http://deeplearning.net/data/mnist/mnist.pkl.gz\", \"mnist.pkl.gz\")\n",
"with gzip.open('mnist.pkl.gz', 'rb') as f:\n",
" train_set, valid_set, test_set = pickle.load(f, encoding='latin1')"
"urllib.request.urlretrieve(\n",
" \"http://deeplearning.net/data/mnist/mnist.pkl.gz\", \"mnist.pkl.gz\"\n",
")\n",
"with gzip.open(\"mnist.pkl.gz\", \"rb\") as f:\n",
" train_set, valid_set, test_set = pickle.load(f, encoding=\"latin1\")"
]
},
{
Expand All @@ -84,18 +86,20 @@
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"plt.rcParams[\"figure.figsize\"] = (2,10)\n",
"\n",
"plt.rcParams[\"figure.figsize\"] = (2, 10)\n",
"\n",
"\n",
"def show_digit(img, caption='', subplot=None):\n",
" if subplot==None:\n",
" _,(subplot)=plt.subplots(1,1)\n",
" imgr=img.reshape((28,28))\n",
" subplot.axis('off')\n",
" subplot.imshow(imgr, cmap='gray')\n",
"def show_digit(img, caption=\"\", subplot=None):\n",
" if subplot == None:\n",
" _, (subplot) = plt.subplots(1, 1)\n",
" imgr = img.reshape((28, 28))\n",
" subplot.axis(\"off\")\n",
" subplot.imshow(imgr, cmap=\"gray\")\n",
" plt.title(caption)\n",
"\n",
"show_digit(train_set[0][30], 'This is a {}'.format(train_set[1][30]))"
"\n",
"show_digit(train_set[0][30], \"This is a {}\".format(train_set[1][30]))"
]
},
{
Expand All @@ -115,8 +119,10 @@
"import numpy as np\n",
"import sagemaker.amazon.common as smac\n",
"\n",
"vectors = np.array([t.tolist() for t in train_set[0]]).astype('float32')\n",
"labels = np.where(np.array([t.tolist() for t in train_set[1]]) == 0, 1, 0).astype('float32')\n",
"vectors = np.array([t.tolist() for t in train_set[0]]).astype(\"float32\")\n",
"labels = np.where(np.array([t.tolist() for t in train_set[1]]) == 0, 1, 0).astype(\n",
" \"float32\"\n",
")\n",
"\n",
"buf = io.BytesIO()\n",
"smac.write_numpy_to_dense_tensor(buf, vectors, labels)\n",
Expand All @@ -139,10 +145,12 @@
"import boto3\n",
"import os\n",
"\n",
"key = 'recordio-pb-data'\n",
"boto3.resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'train', key)).upload_fileobj(buf)\n",
"s3_train_data = 's3://{}/{}/train/{}'.format(bucket, prefix, key)\n",
"print('uploaded training data location: {}'.format(s3_train_data))"
"key = \"recordio-pb-data\"\n",
"boto3.resource(\"s3\").Bucket(bucket).Object(\n",
" os.path.join(prefix, \"train\", key)\n",
").upload_fileobj(buf)\n",
"s3_train_data = \"s3://{}/{}/train/{}\".format(bucket, prefix, key)\n",
"print(\"uploaded training data location: {}\".format(s3_train_data))"
]
},
{
Expand All @@ -158,8 +166,8 @@
"metadata": {},
"outputs": [],
"source": [
"output_location = 's3://{}/{}/output'.format(bucket, prefix)\n",
"print('training artifacts will be uploaded to: {}'.format(output_location))"
"output_location = \"s3://{}/{}/output\".format(bucket, prefix)\n",
"print(\"training artifacts will be uploaded to: {}\".format(output_location))"
]
},
{
Expand All @@ -176,7 +184,8 @@
"outputs": [],
"source": [
"from sagemaker.amazon.amazon_estimator import get_image_uri\n",
"container = get_image_uri(boto3.Session().region_name, 'linear-learner')"
"\n",
"container = get_image_uri(boto3.Session().region_name, \"linear-learner\")"
]
},
{
Expand All @@ -190,17 +199,19 @@
"\n",
"sess = sagemaker.Session()\n",
"\n",
"linear = sagemaker.estimator.Estimator(container,\n",
" role, \n",
" train_instance_count=1, \n",
" train_instance_type='ml.c4.xlarge',\n",
" output_path=output_location,\n",
" sagemaker_session=sess)\n",
"linear.set_hyperparameters(feature_dim=784,\n",
" predictor_type='binary_classifier',\n",
" mini_batch_size=200)\n",
"linear = sagemaker.estimator.Estimator(\n",
" container,\n",
" role,\n",
" train_instance_count=1,\n",
" train_instance_type=\"ml.c4.xlarge\",\n",
" output_path=output_location,\n",
" sagemaker_session=sess,\n",
")\n",
"linear.set_hyperparameters(\n",
" feature_dim=784, predictor_type=\"binary_classifier\", mini_batch_size=200\n",
")\n",
"\n",
"linear.fit({'train': s3_train_data})"
"linear.fit({\"train\": s3_train_data})"
]
},
{
Expand All @@ -214,7 +225,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Define your Comet [REST API](https://www.comet.ml/docs/rest-api/getting-started/) and your [workspace](https://www.comet.ml/docs/user-interface/#workspaces). See the [configuration documentation](http://docs.comet.ml/python-sdk/advanced/#python-configuration) for info on both specifications."
"Define your Comet [REST API](https://www.comet.com/docs/rest-api/getting-started/) and your [workspace](https://www.comet.com/docs/user-interface/#workspaces). See the [configuration documentation](http://docs.comet.ml/python-sdk/advanced/#python-configuration) for info on both specifications."
]
},
{
Expand Down Expand Up @@ -264,7 +275,9 @@
"source": [
"# .log_sagemaker_job(regressor/estimator object from Sagemaker SDK, Comet Rest API key (optional, can be taken from usual config source), workspace (comet), project (comet))\n",
"# I have used the Sagemaker SDK to train a model. I have the estimator/regressor object. I want to log whatever I just trained\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job(linear, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job(\n",
" linear, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\"\n",
")\n",
"print(experiment.url)"
]
},
Expand All @@ -290,7 +303,12 @@
"# I have the name of a completed training job I want to lob\n",
"# Same as .log_sagemaker_job, except instead of passing the regressor/estimator object, you pass the job name\n",
"SAGEMAKER_TRAINING_JOB_NAME = \"SAGEMAKER_TRAINING_JOB_NAME\"\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job_by_name(SAGEMAKER_TRAINING_JOB_NAME, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job_by_name(\n",
" SAGEMAKER_TRAINING_JOB_NAME,\n",
" api_key=COMET_REST_API,\n",
" workspace=COMET_WORKSPACE,\n",
" project_name=\"sagemaker\",\n",
")\n",
"print(experiment.url)"
]
},
Expand All @@ -313,7 +331,9 @@
"outputs": [],
"source": [
"# Logs the last job for your current Amazon Region / S3\n",
"experiment = comet_ml_sagemaker.log_last_sagemaker_job(api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_last_sagemaker_job(\n",
" api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\"\n",
")\n",
"print(experiment.url)"
]
},
Expand Down
59 changes: 36 additions & 23 deletions SageMaker/random_forest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,28 @@
"import sys\n",
"\n",
"\n",
"bucket = 'NAME_YOUR_BUCKET' # <--- specify a bucket you have access to\n",
"prefix = 'sagemaker/rcf-benchmarks'\n",
"bucket = \"NAME_YOUR_BUCKET\" # <--- specify a bucket you have access to\n",
"prefix = \"sagemaker/rcf-benchmarks\"\n",
"execution_role = sagemaker.get_execution_role()\n",
"\n",
"\n",
"# check if the bucket exists\n",
"try:\n",
" boto3.Session().client('s3').head_bucket(Bucket=bucket)\n",
" boto3.Session().client(\"s3\").head_bucket(Bucket=bucket)\n",
"except botocore.exceptions.ParamValidationError as e:\n",
" print('Hey! You either forgot to specify your S3 bucket'\n",
" ' or you gave your bucket an invalid name!')\n",
" print(\n",
" \"Hey! You either forgot to specify your S3 bucket\"\n",
" \" or you gave your bucket an invalid name!\"\n",
" )\n",
"except botocore.exceptions.ClientError as e:\n",
" if e.response['Error']['Code'] == '403':\n",
" if e.response[\"Error\"][\"Code\"] == \"403\":\n",
" print(\"Hey! You don't have permission to access the bucket, {}.\".format(bucket))\n",
" elif e.response['Error']['Code'] == '404':\n",
" elif e.response[\"Error\"][\"Code\"] == \"404\":\n",
" print(\"Hey! Your bucket, {}, doesn't exist!\".format(bucket))\n",
" else:\n",
" raise\n",
"else:\n",
" print('Training input/output will be stored in: s3://{}/{}'.format(bucket, prefix))"
" print(\"Training input/output will be stored in: s3://{}/{}\".format(bucket, prefix))"
]
},
{
Expand All @@ -81,11 +83,11 @@
"import pandas as pd\n",
"import urllib.request\n",
"\n",
"data_filename = 'nyc_taxi.csv'\n",
"data_source = 'https://raw.githubusercontent.com/numenta/NAB/master/data/realKnownCause/nyc_taxi.csv'\n",
"data_filename = \"nyc_taxi.csv\"\n",
"data_source = \"https://raw.githubusercontent.com/numenta/NAB/master/data/realKnownCause/nyc_taxi.csv\"\n",
"\n",
"urllib.request.urlretrieve(data_source, data_filename)\n",
"taxi_data = pd.read_csv(data_filename, delimiter=',')"
"taxi_data = pd.read_csv(data_filename, delimiter=\",\")"
]
},
{
Expand All @@ -108,16 +110,18 @@
"session = sagemaker.Session()\n",
"\n",
"# specify general training job information\n",
"rcf = RandomCutForest(role=execution_role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" data_location='s3://{}/{}/'.format(bucket, prefix),\n",
" output_path='s3://{}/{}/output'.format(bucket, prefix),\n",
" num_samples_per_tree=512,\n",
" num_trees=50)\n",
"rcf = RandomCutForest(\n",
" role=execution_role,\n",
" train_instance_count=1,\n",
" train_instance_type=\"ml.m4.xlarge\",\n",
" data_location=\"s3://{}/{}/\".format(bucket, prefix),\n",
" output_path=\"s3://{}/{}/output\".format(bucket, prefix),\n",
" num_samples_per_tree=512,\n",
" num_trees=50,\n",
")\n",
"\n",
"# automatically upload the training data to S3 and run the training job\n",
"rcf.fit(rcf.record_set(taxi_data.value.as_matrix().reshape(-1,1)))"
"rcf.fit(rcf.record_set(taxi_data.value.as_matrix().reshape(-1, 1)))"
]
},
{
Expand All @@ -131,7 +135,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Define your Comet [REST API](https://www.comet.ml/docs/rest-api/getting-started/) and your [workspace](https://www.comet.ml/docs/user-interface/#workspaces). See the [configuration documentation](http://docs.comet.ml/python-sdk/advanced/#python-configuration) for info on both specifications."
"Define your Comet [REST API](https://www.comet.com/docs/rest-api/getting-started/) and your [workspace](https://www.comet.com/docs/user-interface/#workspaces). See the [configuration documentation](http://docs.comet.ml/python-sdk/advanced/#python-configuration) for info on both specifications."
]
},
{
Expand Down Expand Up @@ -181,7 +185,9 @@
"source": [
"# .log_sagemaker_job(regressor/estimator object from Sagemaker SDK, Comet Rest API key (optional, can be taken from usual config source), workspace (comet), project (comet))\n",
"# I have used the Sagemaker SDK to train a model. I have the estimator/regressor object. I want to log whatever I just trained\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job(rcf, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job(\n",
" rcf, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\"\n",
")\n",
"print(experiment.url)\n",
"experiment.add_tags([\"random_forest\"])"
]
Expand All @@ -208,7 +214,12 @@
"# I have the name of a completed training job I want to lob\n",
"# Same as .log_sagemaker_job, except instead of passing the regressor/estimator object, you pass the job name\n",
"SAGEMAKER_TRAINING_JOB_NAME = \"SAGEMAKER_TRAINING_JOB_NAME\"\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job_by_name(SAGEMAKER_TRAINING_JOB_NAME, api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_sagemaker_job_by_name(\n",
" SAGEMAKER_TRAINING_JOB_NAME,\n",
" api_key=COMET_REST_API,\n",
" workspace=COMET_WORKSPACE,\n",
" project_name=\"sagemaker\",\n",
")\n",
"print(experiment.url)"
]
},
Expand All @@ -231,7 +242,9 @@
"outputs": [],
"source": [
"# Logs the last job for your current Amazon Region / S3\n",
"experiment = comet_ml_sagemaker.log_last_sagemaker_job(api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\")\n",
"experiment = comet_ml_sagemaker.log_last_sagemaker_job(\n",
" api_key=COMET_REST_API, workspace=COMET_WORKSPACE, project_name=\"sagemaker\"\n",
")\n",
"print(experiment.url)\n",
"experiment.add_tags([\"random_forest\"])"
]
Expand Down
2 changes: 1 addition & 1 deletion guides/manage_data/Introduction_to_Artifacts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
"\n",
"We hope you enjoyed this introductory guide to Artifacts, a simple, light weight way to version your datasets and models, while providing information about the lineage of your data through your experiments. \n",
"\n",
"Interested in learning more about Artifacts? Check out the [docs](https://www.comet.ml/docs/user-interface/artifacts/?utm_campaign-artifacts-launch&utm_source=colab-example&utm_medium=additional-resources)"
"Interested in learning more about Artifacts? Check out the [docs](https://www.comet.com/docs/v2/guides/artifacts/using-artifacts/?utm_campaign-artifacts-launch&utm_source=colab-example&utm_medium=additional-resources)"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"[Gradio](https://www.gradio.app/) allows you to quickly create customizable UI components around your TensorFlow or PyTorch models, or even arbitrary Python functions. Mix and match components to support any combination of inputs and outputs. Our core library is free and open-source!\n",
"\n",
"[Comet](https://www.comet.ml/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"[Comet](https://www.comet.com/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"\n",
"In this notebook, we will go over a few of the User Interfaces you can create for your models with Gradio and how to log them to Comet and view them with the Gradio Panel. "
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"\n",
"[Gradio](https://www.gradio.app/) allows you to quickly create customizable UI components around your TensorFlow or PyTorch models, or even arbitrary Python functions. Mix and match components to support any combination of inputs and outputs. Our core library is free and open-source!\n",
"\n",
"[Comet](https://www.comet.ml/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"[Comet](https://www.comet.com/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"\n",
"In this notebook, we will teach you how to build a model evaluation application that lets you log SHAP inferences from a Text Generation model to Comet. "
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Please enter your Comet API key from https://www.comet.ml/api/my/settings/\n",
"Please enter your Comet API key from https://www.comet.com/api/my/settings/\n",
"(api key may not show as you type)\n",
"Comet API key: ··········\n"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"[Ray](https://www.ray.io/) is an open source project that makes it simple to scale any compute-intensive Python workload — from deep learning to production model serving. With a rich set of libraries and integrations built on a flexible distributed execution framework, Ray makes distributed computing easy and accessible to every engineer.\n",
"\n",
"\n",
"[Comet](https://www.comet.ml/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"[Comet](https://www.comet.com/site/data-scientists/?utm_campaign=gradio-integration&utm_medium=colab) is an MLOps Platform that is designed to help Data Scientists and Teams build better models faster! Comet provides tooling to track, Explain, Manage, and Monitor your models in a single place! It works with Jupyter Notebooks and Scripts and most importantly it's 100% free!\n",
"\n",
"To learn more about this integration, please visit\n",
"the [Comet Documentation](https://www.comet.ml/docs/v2/integrations/ml-frameworks/ray/)"
"the [Comet Documentation](https://www.comet.com/docs/v2/integrations/ml-frameworks/ray/)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"\n",
"Instrument Accelerate with Comet to start managing experiments, create dataset versions and track hyperparameters for faster and easier reproducibility and collaboration.\n",
"\n",
"[Find more information about our integration with Accelerate](https://www.comet.ml/docs/v2/integrations/ml-frameworks/transformers/?utm_source=accelerate&utm_medium=colab&utm_campaign=comet_examples)\n",
"[Find more information about our integration with Accelerate](https://www.comet.com/docs/v2/integrations/ml-frameworks/transformers/?utm_source=accelerate&utm_medium=colab&utm_campaign=comet_examples)\n",
"\n",
"Curious about how Comet can help you build better models, faster? Find out more about [Comet](https://www.comet.com/site/products/ml-experiment-tracking/?utm_source=accelerate&utm_medium=colab&utm_campaign=comet_examples) and our [other integrations](https://www.comet.com/docs/v2/integrations/overview/?utm_source=accelerate&utm_medium=colab&utm_campaign=comet_examples)\n",
"\n",
Expand Down
Loading

0 comments on commit dd0d430

Please sign in to comment.