Skip to content

Commit

Permalink
backport PS wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rahult-graphcore committed Aug 2, 2023
1 parent 586219f commit fa7d780
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 53 deletions.
28 changes: 22 additions & 6 deletions notebooks/stable_diffusion/image_to_image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,26 @@
"\n",
"The best way to run this demo is on Paperspace Gradient's cloud IPUs because everything is already set up for you. \n",
"\n",
"[![Run on Gradient](../images/gradient-badge.svg)](https://ipu.dev/3k8znM2)\n",
"[![Run on Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3k8znM2)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled. Refer to the [Getting Started guide](https://docs.graphcore.ai/en/latest/getting-started.html#getting-started) for your system for details on how to enable the Poplar SDK. Also refer to the [Jupyter Quick Start guide](https://docs.graphcore.ai/projects/jupyter-notebook-quick-start/en/latest/index.html) for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to improve usability and support for future users, Graphcore would like to collect information about the\n",
"applications and code being run in this notebook. The following information will be anonymised before being sent to Graphcore:\n",
"\n",
"- User progression through the notebook\n",
"- Notebook details: number of cells, code being run and the output of the cells\n",
"- Environment details\n",
"\n",
"You can disable logging at any time by running `%unload_ext graphcore_cloud_tools.notebook_logging.gc_logger` from any cell."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -63,7 +78,8 @@
"outputs": [],
"source": [
"!pip install -r requirements.txt\n",
"!pip install \"ipywidgets>=7,<8\""
"!pip install \"ipywidgets>=7,<8\"\n",
"%load_ext graphcore_cloud_tools.notebook_logging.gc_logger"
]
},
{
Expand Down Expand Up @@ -289,7 +305,7 @@
"source": [
"## Release IPUs in use\n",
"\n",
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on [managing IPU resources](https://github.com/gradient-ai/Graphcore-HuggingFace/blob/main/useful-tips/managing_ipu_resources.ipynb)."
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on \"managing IPU resources\" - `useful-tips/managing_ipu_resources.ipynb`."
]
},
{
Expand All @@ -309,9 +325,9 @@
"## Next steps\n",
"\n",
"You can try out our other Stable Diffusion notebooks:\n",
"* [Text to image generation (Stable Diffusion version 1.5)](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image.ipynb)\n",
"* [Text to image generation (Stable Diffusion version 2.0](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image2.ipynb)\n",
"* [Inpainting](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/inpainting.ipynb)\n",
"* Text to image generation (Stable Diffusion version 1.5) `text_to_image.ipynb`\n",
"* Text to image generation (Stable Diffusion version 2.0) - `text_to_image2.ipynb`\n",
"* Inpainting - `inpainting.ipynb`\n",
"\n",
"Try out the other [IPU-powered Jupyter Notebooks](https://www.graphcore.ai/ipu-jupyter-notebooks) to see how how IPUs perform on other tasks.\n"
]
Expand Down
28 changes: 22 additions & 6 deletions notebooks/stable_diffusion/inpainting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,26 @@
"\n",
"The best way to run this demo is on Paperspace Gradient's cloud IPUs because everything is already set up for you.\n",
"\n",
"[![Run on Gradient](../images/gradient-badge.svg)](https://ipu.dev/3W56b5R)\n",
"[![Run on Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3W56b5R)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled. Refer to the [Getting Started guide](https://docs.graphcore.ai/en/latest/getting-started.html#getting-started) for your system for details on how to enable the Poplar SDK. Also refer to the [Jupyter Quick Start guide](https://docs.graphcore.ai/projects/jupyter-notebook-quick-start/en/latest/index.html) for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to improve usability and support for future users, Graphcore would like to collect information about the\n",
"applications and code being run in this notebook. The following information will be anonymised before being sent to Graphcore:\n",
"\n",
"- User progression through the notebook\n",
"- Notebook details: number of cells, code being run and the output of the cells\n",
"- Environment details\n",
"\n",
"You can disable logging at any time by running `%unload_ext graphcore_cloud_tools.notebook_logging.gc_logger` from any cell."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -62,7 +77,8 @@
"outputs": [],
"source": [
"!pip install -r requirements.txt\n",
"!pip install \"ipywidgets>=7,<8\""
"!pip install \"ipywidgets>=7,<8\"\n",
"%load_ext graphcore_cloud_tools.notebook_logging.gc_logger"
]
},
{
Expand Down Expand Up @@ -303,7 +319,7 @@
"source": [
"## Release IPUs in use\n",
"\n",
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after working your way through this one, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` option in the notebook. More information can be found in the notebook on [managing IPU resources](https://github.com/gradient-ai/Graphcore-HuggingFace/blob/main/useful-tips/managing_ipu_resources.ipynb)."
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on \"managing IPU resources\" - `useful-tips/managing_ipu_resources.ipynb`."
]
},
{
Expand All @@ -324,9 +340,9 @@
"\n",
"Try out our other Stable Diffusion notebooks:\n",
"\n",
"* [Text to image generation (Stable Diffusion version 1.5)](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image.ipynb)\n",
"* [Text to image generation (Stable Diffusion version 2.0](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image2.ipynb)\n",
"* [Image to image generation](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/stable_diffusion/image_to_image.ipynb)\n",
"* Text to image generation (Stable Diffusion version 1.5) - `text_to_image.ipynb`\n",
"* Text to image generation (Stable Diffusion version 2.0) - `text_to_image2.ipynb`\n",
"* Image to image generation - `image_to_image.ipynb`\n",
"\n",
"Also, Try out the other [IPU-powered Jupyter Notebooks](https://www.graphcore.ai/ipu-jupyter-notebooks) to see how how IPUs perform on other tasks.\n"
]
Expand Down
5 changes: 3 additions & 2 deletions notebooks/stable_diffusion/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
optimum-graphcore
matplotlib
optimum-graphcore==0.7
matplotlib
graphcore-cloud-tools[logger] @ git+https://github.com/graphcore/graphcore-cloud-tools
29 changes: 22 additions & 7 deletions notebooks/stable_diffusion/text_to_image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,30 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"## Environment setup\n",
"\n",
"The best way to run this demo is on Paperspace Gradient's cloud IPUs because everything is already set up for you. \n",
"\n",
"[![Run on Gradient](../images/gradient-badge.svg)](https://ipu.dev/3iyhJkk)\n",
"[![Run on Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3iyhJkk)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled. Refer to the [Getting Started guide](https://docs.graphcore.ai/en/latest/getting-started.html#getting-started) for your system for details on how to enable the Poplar SDK. Also refer to the [Jupyter Quick Start guide](https://docs.graphcore.ai/projects/jupyter-notebook-quick-start/en/latest/index.html) for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to improve usability and support for future users, Graphcore would like to collect information about the\n",
"applications and code being run in this notebook. The following information will be anonymised before being sent to Graphcore:\n",
"\n",
"- User progression through the notebook\n",
"- Notebook details: number of cells, code being run and the output of the cells\n",
"- Environment details\n",
"\n",
"You can disable logging at any time by running `%unload_ext graphcore_cloud_tools.notebook_logging.gc_logger` from any cell."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -65,7 +79,8 @@
"outputs": [],
"source": [
"!pip install -r requirements.txt\n",
"!pip install \"ipywidgets>=7,<8\""
"!pip install \"ipywidgets>=7,<8\"\n",
"%load_ext graphcore_cloud_tools.notebook_logging.gc_logger"
]
},
{
Expand Down Expand Up @@ -260,7 +275,7 @@
"source": [
"## Release IPUs in use\n",
"\n",
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on [managing IPU resources](https://github.com/gradient-ai/Graphcore-HuggingFace/blob/main/useful-tips/managing_ipu_resources.ipynb)."
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on \"managing IPU resources\" - `useful-tips/managing_ipu_resources.ipynb`."
]
},
{
Expand All @@ -281,9 +296,9 @@
"\n",
"You can try out our other Stable Diffusion notebooks:\n",
"\n",
"* [Text to image generation (Stable Diffusion version 2.0](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image2.ipynb)\n",
"* [Image to image generation](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/stable_diffusion/image_to_image.ipynb)\n",
"* [Inpainting](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/inpainting.ipynb)\n",
"* Text to image generation (Stable Diffusion version 2.0) - `text_to_image_sd2.ipynb`\n",
"* Image to image generation - `image_to_image.ipynb`\n",
"* Inpainting - `inpainting.ipynb`\n",
"\n",
"Try out the other [IPU-powered Jupyter Notebooks](https://www.graphcore.ai/ipu-jupyter-notebooks) to see how how IPUs perform on other tasks."
]
Expand Down
28 changes: 22 additions & 6 deletions notebooks/stable_diffusion/text_to_image_sd2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,26 @@
"\n",
"The best way to run this demo is on Paperspace Gradient's cloud IPUs because everything is already set up for you.\n",
"\n",
"[![Run on Gradient](../images/gradient-badge.svg)](https://ipu.dev/3X3IMDh)\n",
"[![Run on Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3X3IMDh)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled. Refer to the [Getting Started guide](https://docs.graphcore.ai/en/latest/getting-started.html#getting-started) for your system for details on how to enable the Poplar SDK. Also refer to the [Jupyter Quick Start guide](https://docs.graphcore.ai/projects/jupyter-notebook-quick-start/en/latest/index.html) for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to improve usability and support for future users, Graphcore would like to collect information about the\n",
"applications and code being run in this notebook. The following information will be anonymised before being sent to Graphcore:\n",
"\n",
"- User progression through the notebook\n",
"- Notebook details: number of cells, code being run and the output of the cells\n",
"- Environment details\n",
"\n",
"You can disable logging at any time by running `%unload_ext graphcore_cloud_tools.notebook_logging.gc_logger` from any cell."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -62,7 +77,8 @@
"outputs": [],
"source": [
"!pip install -r requirements.txt\n",
"!pip install \"ipywidgets>=7,<8\""
"!pip install \"ipywidgets>=7,<8\"\n",
"%load_ext graphcore_cloud_tools.notebook_logging.gc_logger"
]
},
{
Expand Down Expand Up @@ -261,7 +277,7 @@
"source": [
"## Release IPUs in use\n",
"\n",
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on [managing IPU resources](https://github.com/gradient-ai/Graphcore-HuggingFace/blob/main/useful-tips/managing_ipu_resources.ipynb)."
"The IPython kernel has a lock on the IPUs used in running the model, preventing other users from using them. For example, if you wish to use other notebooks after running this notebook, it may be necessary to manually run the cell below to release the IPUs you have been using. This will happen by default if you use the `Run All` notebook option. More information can be found in the notebook on \"managing IPU resources\" - `useful-tips/managing_ipu_resources.ipynb`."
]
},
{
Expand All @@ -282,9 +298,9 @@
"\n",
"You can try out the other notebooks using the Stable Diffusion version 1.5 model:\n",
"\n",
"* [Text to image generation](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/text_to_image.ipynb)\n",
"* [Image to image generation](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/stable_diffusion/image_to_image.ipynb)\n",
"* [Inpainting](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/stable_diffusion/inpainting.ipynb)\n",
"* Text to image generation - `text_to_image.ipynb`\n",
"* Image to image generation - `image_to_image.ipynb`\n",
"* Inpainting - `inpainting.ipynb`\n",
"\n",
"Also, Try out the other [IPU-powered Jupyter Notebooks](https://www.graphcore.ai/ipu-jupyter-notebooks) to see how how IPUs perform on other tasks."
]
Expand Down
5 changes: 3 additions & 2 deletions notebooks/wav2vec2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
optimum-graphcore>0.4, <0.5
optimum-graphcore==0.7
--find-links https://download.pytorch.org/whl/torch_stable.html
torchaudio == 0.13.0+cpu
torchaudio == 2.0.2+cpu
librosa
jiwer
soundfile
graphcore-cloud-tools[logger] @ git+https://github.com/graphcore/graphcore-cloud-tools
43 changes: 27 additions & 16 deletions notebooks/wav2vec2/wav2vec2-fine-tuning-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
{
"attachments": {},
"cell_type": "markdown",
"id": "865f8948",
"id": "dc70faef",
"metadata": {},
"source": [
"## Environment setup\n",
"\n",
"The best way to run this demo is on Paperspace Gradient's cloud IPUs because everything is already set up for you.\n",
"\n",
"[![Run on Gradient](../images/gradient-badge.svg)](https://ipu.dev/3CGkbMq)\n",
"[![Run on Gradient](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3CGkbMq)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled. Refer to the [Getting Started guide](https://docs.graphcore.ai/en/latest/getting-started.html#getting-started) for your system for details on how to enable the Poplar SDK. Also refer to the [Jupyter Quick Start guide](https://docs.graphcore.ai/projects/jupyter-notebook-quick-start/en/latest/index.html) for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
Expand All @@ -75,6 +75,23 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "23ba46a1",
"metadata": {},
"source": [
"In order to improve usability and support for future users, Graphcore would like to collect information about the\n",
"applications and code being run in this notebook. The following information will be anonymised before being sent to Graphcore:\n",
"\n",
"- User progression through the notebook\n",
"- Notebook details: number of cells, code being run and the output of the cells\n",
"- Environment details\n",
"\n",
"You can disable logging at any time by running `%unload_ext graphcore_cloud_tools.notebook_logging.gc_logger` from any cell."
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4625673f",
"metadata": {},
Expand All @@ -101,7 +118,8 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt"
"%pip install -r requirements.txt\n",
"%load_ext graphcore_cloud_tools.notebook_logging.gc_logger"
]
},
{
Expand Down Expand Up @@ -164,6 +182,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c8313f3a",
"metadata": {},
Expand Down Expand Up @@ -379,6 +398,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d94d06af",
"metadata": {},
Expand Down Expand Up @@ -608,20 +628,11 @@
"\n",
"model = AutoModelForCTC.from_pretrained(\"facebook/wav2vec2-base\", config=config)\n",
"\n",
"ipu_config = IPUConfig.from_pretrained(\"Graphcore/wav2vec2-base-ipu\", executable_cache_dir=executable_cache_dir)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e79f613e",
"metadata": {},
"outputs": [],
"source": [
"ipu_config.layers_per_ipu = [5, 5, 5, 6]"
"ipu_config = IPUConfig.from_pretrained(\"Graphcore/wav2vec2-ctc-base-ipu\", executable_cache_dir=executable_cache_dir)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "61c69b73",
"metadata": {},
Expand Down Expand Up @@ -757,15 +768,15 @@
"source": [
"## Next steps\n",
"\n",
"You can try out the notebook on [Automatic Speech Recognition (ASR) on IPU using wav2vec - Inference](https://github.com/huggingface/optimum-graphcore/blob/main/notebooks/wav2vec2/wav2vec2-inference-checkpoint.ipynb) to use the outputs of this notebook.\n",
"You can try out the notebook on Automatic Speech Recognition (ASR) on IPU using wav2vec - Inference `wav2vec2-inference-checkpoint.ipynb` to use the outputs of this notebook.\n",
"\n",
"Also, Try out the other [IPU-powered Jupyter Notebooks](https://www.graphcore.ai/ipu-jupyter-notebooks) to see how how IPUs perform on other tasks."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
Loading

0 comments on commit fa7d780

Please sign in to comment.