Skip to content

Commit

Permalink
Addtional edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
katjacksonWB committed May 31, 2024
1 parent 14d2db4 commit 69d71d1
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions colabs/artifact_basics/Artifact_Basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"source": [
"\n",
"Use [Weights & Biases](https://wandb.com) for machine learning experiment tracking, dataset versioning, and project collaboration.\n",
"Use [Weights & Biases](https://wandb.com) for machine learning experiment tracking, dataset and model versioning and management, collaboration and more.\n",
"\n",
"<div><img /></div>\n",
"\n",
Expand All @@ -45,7 +45,7 @@
},
"source": [
"\n",
"Use W&B Artifacts to track and version data as the inputs and outputs of your W&B Runs. For example, a model training run might take in a dataset as input and trained model as output. In addition to logging hyperparameters and metadata to a run, you can use an artifact to log the dataset used to train the model as input and the resulting model checkpoints as outputs."
"Use W&B Artifacts to track and version data as the inputs and outputs of your W&B Runs. For example, a model training run might take in a dataset as input and produce a trained model as output. In addition to logging hyperparameters, metadata, and metrics to a run, you can use an artifact to log the dataset used to train the model as input and the resulting model checkpoints as outputs."
]
},
{
Expand All @@ -63,7 +63,7 @@
"id": "q2EeMdcpC7Dl"
},
"source": [
"In order to log data to our web service, you need to log in and import `wandb`. If this is your first time using W&B, you'll need to sign up for a free account at the link that appears."
"In order to log to W&B, you will need the `wandb` package installed and imported into your script or notebook. If you are not already authenticated or signed up, a link will appear which you can use to do so."
]
},
{
Expand Down Expand Up @@ -99,10 +99,10 @@
"\n",
"1. Intialize a run.\n",
"2. Create an Artifact.\n",
"3. Add a dataset, a model, or another Artifact as an input.\n",
"3. Add a dataset, model, another Artifact or any files or directories to the new Artifact that you want to track and version.\n",
"4. Log the artifact in the W&B platform.\n",
"\n",
"This can by accomplished in two lines of code:"
"This can by accomplished with a few lines of code:"
]
},
{
Expand All @@ -126,10 +126,10 @@
"source": [
"First, initalize the run with [`wandb.init()`](https://docs.wandb.ai/ref/python/init). In this demo, the code adds the run to the `artifact-basic` project, but you can change the name to anyting you'd like.\n",
"\n",
"Next, log the artifact with [`run.log_artifact()`](https://docs.wandb.ai/ref/python/public-api/run#log_artifact). In this demo, the artifact is a `dataset` using data from `mnist_test.csv`. You can customize your artifact with a `name` and other metadata- see the Artifacts Reference guide for more information.\n",
"Next, log the Artifact with [`run.log_artifact()`](https://docs.wandb.ai/ref/python/public-api/run#log_artifact). In this demo, the Artifact is a `dataset` using data from `mnist_test.csv`. You can customize your Artifact with a `name` and other metadata- see the Artifacts Reference guide for more information.\n",
"\n",
"\n",
"If you change or add any parameters names, be sure to replicate those changes in the following code samples as well."
"If you change or add any argument names, be sure to replicate those changes in the following code samples as well."
]
},
{
Expand All @@ -147,7 +147,7 @@
"id": "jZC69sSMdX4j"
},
"source": [
"When you want to use a specific version of an artifact in a downstream task, you can specify the specific version you would like to use via either `v0`, `v1`, `v2` and so on, or via specific aliases you may have added. The `latest` alias always refers to the most recent version of the artifact logged.\n",
"When you want to use a specific version of an Artifact in a downstream task, you can specify the specific version you would like to use via either `v0`, `v1`, `v2` and so on, or via specific aliases you may have added. The `latest` alias always refers to the most recent version of the Artifact logged.\n",
"\n",
"The proceeding code snippet specifies an artifact called `my_first_artifact` with the alias `latest`:\n"
]
Expand All @@ -160,7 +160,7 @@
},
"outputs": [],
"source": [
"run = wandb.init(project=\"artifact-basics\")\n",
"run = wandb.init(project=\"artifact-basic\")\n",
"artifact = run.use_artifact(artifact_or_name=\"my_first_artifact:latest\")\n",
"run.finish()"
]
Expand Down Expand Up @@ -217,19 +217,24 @@
"run = wandb.init(project=\"artifact-basics\")\n",
"artifact = run.use_artifact(\"my_first_artifact:latest\") # selects the artifact you're adding the file to, and makes a new artifact version\n",
"artifact.add_dir(local_path=\"/content/sample_data\", name=\"new_directory\")\n",
"run.log_artifact(artifact, aliases= [\"directory_version\"])\n",
"run.log_artifact(artifact, aliases= [\"sorted\",\"cleaned\"])\n",
"run.finish()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This adds a new version of `my_first_artifact` with an entire folder with several .csv files. To save your changes, you'll need to [`log`](https://docs.wandb.ai/ref/python/log) or [`save`](https://docs.wandb.ai/ref/python/artifact#save) them. The directory will overwrite the contents of the previous version of the Artifact.\n",
"This adds a new version of `my_first_artifact` with an entire folder with several .csv files. To save your changes, you'll need to [`log`](https://docs.wandb.ai/ref/python/log) or [`save`](https://docs.wandb.ai/ref/python/artifact#save) them. The new version will overwrite the contents of the previous version of the Artifact.\n",
"\n",
"The Artifact has also been given a custom `aliases`, a label for this Artifact version. While the `alias` is currently `directory_version`, the default aliases are `v1` and `latest `."
"The Artifact has also been given a custom `aliases`, a label for this Artifact version. While the `alias` is currently `staging`, the default aliases is `vN`, where `N` is the number of versions the Artifact has. This increments automatically."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -297,7 +302,7 @@
"# This will download the specified artifact to where your code is running\n",
"datadir = artifact.download()\n",
"run.finish()\n",
"# Prints the path of the current artifact directory\n",
"# prints the path of the current artifact directory\n",
"print(u'\\u2500' * 10)\n",
"print(\"Data directory located at:\" + datadir)"
]
Expand Down

0 comments on commit 69d71d1

Please sign in to comment.