Skip to content

Commit

Permalink
Remove Run on Gradient links
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesRandom committed Mar 11, 2024
1 parent 8c4a1dd commit 08f030f
Show file tree
Hide file tree
Showing 24 changed files with 362 additions and 458 deletions.
10 changes: 3 additions & 7 deletions notebooks/external_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3xwTmHM)\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."
"To run the demo using 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 Down Expand Up @@ -170,7 +166,7 @@
"outputs": [],
"source": [
"from transformers import AutoTokenizer\n",
" \n",
"\n",
"tokenizer_checkpoint = \"gpt2\"\n",
"tokenizer = AutoTokenizer.from_pretrained(tokenizer_checkpoint)"
]
Expand Down Expand Up @@ -503,7 +499,7 @@
" \"optimizer_state_offchip\": True,\n",
" \"replicated_tensor_sharding\": True,\n",
" \"enable_half_partials\": True,\n",
" \"device_iterations\": 1, \n",
" \"device_iterations\": 1,\n",
" \"inference_device_iterations\": 5,\n",
" \"gradient_accumulation_steps\": 512,\n",
" \"executable_cache_dir\": executable_cache_dir,\n",
Expand Down
6 changes: 1 addition & 5 deletions notebooks/flan_t5_inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/AWzcPN)\n",
"\n",
"To run the demo using other IPU hardware, you need to have the Poplar SDK enabled and a PopTorch wheel installed. Refer to the [Getting Started guide for your system](https://docs.graphcore.ai/en/latest/getting-started.html) for details on how to do this. Also refer to the Jupyter Quick Start guide for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
"To run the demo using IPU hardware, you need to have the Poplar SDK enabled and a PopTorch wheel installed. Refer to the [Getting Started guide for your system](https://docs.graphcore.ai/en/latest/getting-started.html) for details on how to do this. Also refer to the Jupyter Quick Start guide for how to set up Jupyter to be able to run this notebook on a remote IPU machine."
]
},
{
Expand Down
10 changes: 3 additions & 7 deletions notebooks/image_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3QxTCyU)\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."
"To run the demo using 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 Down Expand Up @@ -339,7 +335,7 @@
},
"outputs": [],
"source": [
"from datasets import load_dataset \n",
"from datasets import load_dataset\n",
"from pathlib import Path\n",
"\n",
"# load a custom dataset from local/remote files or folders using the ImageFolder feature\n",
Expand Down Expand Up @@ -866,7 +862,7 @@
"from optimum.graphcore import IPUTrainingArguments, IPUTrainer, IPUConfig\n",
"\n",
"model = AutoModelForImageClassification.from_pretrained(\n",
" model_checkpoint, \n",
" model_checkpoint,\n",
" label2id=label2id,\n",
" id2label=id2label,\n",
" ignore_mismatched_sizes = True, # provide this in case you're planning to fine-tune an already fine-tuned checkpoint\n",
Expand Down
14 changes: 5 additions & 9 deletions notebooks/introduction_to_optimum_graphcore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3CExwVy)\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."
"To run the demo using 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 Down Expand Up @@ -609,7 +605,7 @@
"source": [
"trainer = IPUTrainer(model=model,\n",
" ipu_config=ipu_config,\n",
" args=training_args, \n",
" args=training_args,\n",
" train_dataset=train_dataset,\n",
" eval_dataset=validation_features,\n",
" )"
Expand Down Expand Up @@ -820,7 +816,7 @@
"input_tensor = torch.tensor(input_encoding[\"input_ids\"]).unsqueeze(0)\n",
"attention_tensor= torch.tensor(input_encoding[\"attention_mask\"]).unsqueeze(0)\n",
"token_types=torch.tensor(input_encoding[\"token_type_ids\"]).unsqueeze(0)\n",
" \n",
"\n",
"# Get model and load the fine-tuned weights\n",
"model = transformers.BertForQuestionAnswering.from_pretrained(\"/tmp/outputs\")"
]
Expand Down Expand Up @@ -900,8 +896,8 @@
"outputs": [],
"source": [
"# Make sure you have git-lfs and huggingface-hub\n",
"!apt-get update && apt-get upgrade -y && apt-get install -y git git-lfs \n",
"# !pip install -y huggingface-hub "
"!apt-get update && apt-get upgrade -y && apt-get install -y git git-lfs\n",
"# !pip install -y huggingface-hub"
]
},
{
Expand Down
10 changes: 3 additions & 7 deletions notebooks/language_modelling_from_scratch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/414XiNp)\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."
"To run the demo using 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 Down Expand Up @@ -287,7 +283,7 @@
" while pick in picks:\n",
" pick = random.randint(0, len(dataset)-1)\n",
" picks.append(pick)\n",
" \n",
"\n",
" df = pd.DataFrame(dataset[picks])\n",
" for column, typ in dataset.features.items():\n",
" if isinstance(typ, ClassLabel):\n",
Expand Down Expand Up @@ -391,7 +387,7 @@
"outputs": [],
"source": [
"from transformers import AutoTokenizer\n",
" \n",
"\n",
"tokenizer = AutoTokenizer.from_pretrained(tokenizer_checkpoint)"
]
},
Expand Down
14 changes: 5 additions & 9 deletions notebooks/mt5_translation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)]()\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."
"To run the demo using 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 Down Expand Up @@ -243,7 +239,7 @@
" while pick in picks:\n",
" pick = random.randint(0, len(dataset)-1)\n",
" picks.append(pick)\n",
" \n",
"\n",
" df = pd.DataFrame(dataset[picks])\n",
" for column, typ in dataset.features.items():\n",
" if isinstance(typ, datasets.ClassLabel):\n",
Expand Down Expand Up @@ -299,7 +295,7 @@
"source": [
"from transformers import AutoTokenizer\n",
"from dataclasses import dataclass\n",
" \n",
"\n",
"tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)\n",
"\n",
"@dataclass\n",
Expand Down Expand Up @@ -361,7 +357,7 @@
" # Setup the tokenizer for targets\n",
" with tokenizer.as_target_tokenizer():\n",
" labels = tokenizer(targets, max_length=tokenizer_config.max_length, padding=tokenizer_config.padding, truncation=tokenizer_config.truncation)\n",
" \n",
"\n",
" # Since we are padding here, replace all tokenizer.pad_token_id in the labels by -100 when we want to ignore\n",
" # padding in the loss.\n",
" labels[\"input_ids\"] = [\n",
Expand Down Expand Up @@ -510,7 +506,7 @@
"\n",
"# Gradient accumulation steps = 128 for 1 replica.\n",
"# Increase replicas if we have additional ipus available and\n",
"# adjust gradient accumulation steps. The trainer will automatically \n",
"# adjust gradient accumulation steps. The trainer will automatically\n",
"# use data parallel training by using the `n_ipu` argument\n",
"replication_factor = n_ipu // ipu_config.ipus_per_replica\n",
"gradient_accumulation_steps = 128 // replication_factor\n",
Expand Down
6 changes: 1 addition & 5 deletions notebooks/mt5_xnli.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)]()\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."
"To run the demo using 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 Down
18 changes: 7 additions & 11 deletions notebooks/multiple_choice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3lI3fzQ)\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."
"To run the demo using 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 Down Expand Up @@ -377,7 +373,7 @@
" while pick in picks:\n",
" pick = random.randint(0, len(dataset)-1)\n",
" picks.append(pick)\n",
" \n",
"\n",
" df = pd.DataFrame(dataset[picks])\n",
" for column, typ in dataset.features.items():\n",
" if isinstance(typ, ClassLabel):\n",
Expand Down Expand Up @@ -474,7 +470,7 @@
"outputs": [],
"source": [
"from transformers import AutoTokenizer\n",
" \n",
"\n",
"tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, use_fast=True)"
]
},
Expand Down Expand Up @@ -551,15 +547,15 @@
" # Grab all second sentences possible for each context.\n",
" question_headers = examples[\"sent2\"]\n",
" second_sentences = [[f\"{header} {examples[end][i]}\" for end in ending_names] for i, header in enumerate(question_headers)]\n",
" \n",
"\n",
" # Flatten everything\n",
" first_sentences = sum(first_sentences, [])\n",
" second_sentences = sum(second_sentences, [])\n",
" \n",
"\n",
" # Tokenize\n",
" tokenized_examples = tokenizer(\n",
" first_sentences, \n",
" second_sentences, \n",
" first_sentences,\n",
" second_sentences,\n",
" truncation=True,\n",
" max_length=max_seq_length,\n",
" padding=\"max_length\",\n",
Expand Down
20 changes: 8 additions & 12 deletions notebooks/name-entity-extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@
"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](https://assets.paperspace.io/img/gradient-badge.svg)](https://ipu.dev/3XgZ7V2)\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."
"To run the demo using 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 Down Expand Up @@ -144,9 +140,9 @@
"metadata": {},
"outputs": [],
"source": [
"ner_pipeline = pipelines.pipeline(\"ner\", \n",
" ipu_config=inference_config, \n",
" padding='max_length', \n",
"ner_pipeline = pipelines.pipeline(\"ner\",\n",
" ipu_config=inference_config,\n",
" padding='max_length',\n",
" max_length=256)"
]
},
Expand Down Expand Up @@ -212,7 +208,7 @@
"out = ner_pipeline(prompt)\n",
"\n",
"def app_for_pipeline(pipeline, examples=[], description=\"\", label_description=\"\"):\n",
" demo = gr.Blocks( \n",
" demo = gr.Blocks(\n",
" title=description,\n",
" )\n",
" with demo:\n",
Expand Down Expand Up @@ -398,9 +394,9 @@
"source": [
"medical_model = \"d4data/biomedical-ner-all\"\n",
"ner_pipeline_medical = pipelines.pipeline(\n",
" \"ner\", model= medical_model, \n",
" \"ner\", model= medical_model,\n",
" ipu_config=inference_config,\n",
" padding='max_length', \n",
" padding='max_length',\n",
" max_length=256\n",
")\n",
"medical_output = ner_pipeline_medical(prompt)"
Expand Down Expand Up @@ -441,7 +437,7 @@
"outputs": [],
"source": [
"app_for_pipeline(\n",
" ner_pipeline_medical, \n",
" ner_pipeline_medical,\n",
" examples=medical_examples,\n",
" description=\"Try prompting me with some medical anecdotes!\"\n",
").launch(share=share_gradio)"
Expand Down
Loading

0 comments on commit 08f030f

Please sign in to comment.