{"id":13520233,"url":"https://github.com/huggingface/optimum-graphcore","last_synced_at":"2025-10-14T15:32:19.978Z","repository":{"id":37409538,"uuid":"415957187","full_name":"huggingface/optimum-graphcore","owner":"huggingface","description":"Blazing fast training of 🤗 Transformers on Graphcore IPUs","archived":false,"fork":false,"pushed_at":"2024-03-11T15:32:59.000Z","size":11279,"stargazers_count":86,"open_issues_count":16,"forks_count":35,"subscribers_count":41,"default_branch":"main","last_synced_at":"2025-09-30T18:02:30.360Z","etag":null,"topics":["fine-tuning","graphcore","machine-learning","pytorch","training","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huggingface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-11T14:16:24.000Z","updated_at":"2025-08-04T08:28:55.000Z","dependencies_parsed_at":"2023-02-19T06:31:18.227Z","dependency_job_id":"81de44eb-a67c-4d98-b4ec-717f20df0f59","html_url":"https://github.com/huggingface/optimum-graphcore","commit_stats":{"total_commits":390,"total_committers":41,"mean_commits":9.512195121951219,"dds":0.7025641025641025,"last_synced_commit":"d27ae619d286b540c1b5485df8d523c9bbdf2d20"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/huggingface/optimum-graphcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Foptimum-graphcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Foptimum-graphcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Foptimum-graphcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Foptimum-graphcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huggingface","download_url":"https://codeload.github.com/huggingface/optimum-graphcore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Foptimum-graphcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019322,"owners_count":26086711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fine-tuning","graphcore","machine-learning","pytorch","training","transformers"],"created_at":"2024-08-01T05:02:14.903Z","updated_at":"2025-10-14T15:32:19.960Z","avatar_url":"https://github.com/huggingface.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![examples](https://github.com/huggingface/optimum-graphcore/actions/workflows/test-examples.yml/badge.svg)](https://github.com/huggingface/optimum-graphcore/actions/workflows/test-examples.yml) [![pipelines](https://github.com/huggingface/optimum-graphcore/actions/workflows/test-pipelines.yml/badge.svg)](https://github.com/huggingface/optimum-graphcore/actions/workflows/test-pipelines.yml)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"readme_logo.png\" /\u003e\n\u003c/p\u003e\n\n# Optimum Graphcore\n\n🤗 Optimum Graphcore is the interface between the 🤗 Transformers library and [Graphcore IPUs](https://www.graphcore.ai/products/ipu).\nIt provides a set of tools enabling model parallelization and loading on IPUs, training, fine-tuning and inference on all the tasks already supported by 🤗 Transformers while being compatible with the 🤗 Hub and every model available on it out of the box.\n\n## What is an Intelligence Processing Unit (IPU)?\nQuote from the Hugging Face [blog post](https://huggingface.co/blog/graphcore#what-is-an-intelligence-processing-unit):\n\u003eIPUs are the processors that power Graphcore’s IPU-POD datacenter compute systems. This new type of processor is designed to support the very specific computational requirements of AI and machine learning. Characteristics such as fine-grained parallelism, low precision arithmetic, and the ability to handle sparsity have been built into our silicon.\n\n\u003e Instead of adopting a SIMD/SIMT architecture like GPUs, Graphcore’s IPU uses a massively parallel, MIMD architecture, with ultra-high bandwidth memory placed adjacent to the processor cores, right on the silicon die.\n\n\u003e This design delivers high performance and new levels of efficiency, whether running today’s most popular models, such as BERT and EfficientNet, or exploring next-generation AI applications.\n\n## Poplar SDK setup\nA Poplar SDK environment needs to be enabled to use this library. Please refer to Graphcore's [Getting Started](https://docs.graphcore.ai/en/latest/getting-started.html) guides.\n\n## Install\nTo install the latest release of this package:\n\n`pip install optimum-graphcore`\n\nOptimum Graphcore is a fast-moving project, and you may want to install from source.\n\n`pip install git+https://github.com/huggingface/optimum-graphcore.git`\n\n### Installing in developer mode\n\nIf you are working on the `optimum-graphcore` code then you should use an editable install\nby cloning and installing `optimum` and `optimum-graphcore`:\n\n```\ngit clone https://github.com/huggingface/optimum --branch v1.6.1-release\ngit clone https://github.com/huggingface/optimum-graphcore\npip install -e optimum -e optimum-graphcore\n```\n\nNow whenever you change the code, you'll be able to run with those changes instantly.\n\n\n## Running the examples\n\nThere are a number of examples provided in the `examples` directory. Each of these contains a README with command lines for running them on IPUs with Optimum Graphcore.\n\nPlease install the requirements for every example:\n\n```\ncd \u003cexample-folder\u003e\npip install -r requirements.txt\n```\n\n## How to use Optimum Graphcore\n🤗 Optimum Graphcore was designed with one goal in mind: **make training and evaluation straightforward for any 🤗 Transformers user while leveraging the complete power of IPUs.**\nIt requires minimal changes if you are already using 🤗 Transformers.\n\nTo immediately use a model on a given input (text, image, audio, ...), we support the `pipeline` API:\n\n```diff\n-\u003e\u003e\u003e from transformers import pipeline\n+\u003e\u003e\u003e from optimum.graphcore import pipeline\n\n# Allocate a pipeline for sentiment-analysis\n-\u003e\u003e\u003e classifier = pipeline('sentiment-analysis', model=\"distilbert-base-uncased-finetuned-sst-2-english\")\n+\u003e\u003e\u003e classifier = pipeline('sentiment-analysis', model=\"distilbert-base-uncased-finetuned-sst-2-english\", ipu_config = \"Graphcore/distilbert-base-ipu\")\n\u003e\u003e\u003e classifier('We are very happy to introduce pipeline to the transformers repository.')\n[{'label': 'POSITIVE', 'score': 0.9996947050094604}]\n```\n\nIt is also super easy to use the `Trainer` API:\n\n```diff\n-from transformers import Trainer, TrainingArguments\n+from optimum.graphcore import IPUConfig, IPUTrainer, IPUTrainingArguments\n\n-training_args = TrainingArguments(\n+training_args = IPUTrainingArguments(\n     per_device_train_batch_size=4,\n     learning_rate=1e-4,\n+    # Any IPUConfig on the Hub or stored locally\n+    ipu_config_name=\"Graphcore/bert-base-ipu\",\n+)\n+\n+# Loading the IPUConfig needed by the IPUTrainer to compile and train the model on IPUs\n+ipu_config = IPUConfig.from_pretrained(\n+    training_args.ipu_config_name,\n )\n\n # Initialize our Trainer\n-trainer = Trainer(\n+trainer = IPUTrainer(\n     model=model,\n+    ipu_config=ipu_config,\n     args=training_args,\n     train_dataset=train_dataset if training_args.do_train else None,\n     ...  # Other arguments\n```\n\nFor more information, refer to the full [🤗 Optimum Graphcore documentation](https://huggingface.co/docs/optimum/graphcore_index).\n\n## Supported models\nThe following model architectures and tasks are currently supported by 🤗 Optimum Graphcore:\n|            | Pre-Training | Masked LM | Causal LM | Seq2Seq LM (Summarization, Translation, etc) | Sequence Classification | Token Classification | Question Answering | Multiple Choice | Image Classification | CTC |\n|------------|--------------|-----------|-----------|----------------------------------------------|-------------------------|----------------------|--------------------|-----------------|----------------------| ------------ |\n| BART       | ✅            |           | ❌         | ✅                                            | ✅                       |                      | ❌                  |                 |                      |             |\n| BERT       | ✅            | ✅         | ❌         |                                              | ✅                       | ✅                    | ✅                  | ✅               |                      |             |\n| ConvNeXt   | ✅            |           |           |                                              |                         |                      |                    |                 | ✅                    |             |\n| DeBERTa    | ✅            | ✅         |           |                                              | ✅                       | ✅                    | ✅                  |                 |                      |             |\n| DistilBERT | ❌            | ✅         |           |                                              | ✅                       | ✅                    | ✅                  | ✅               |                      |             |\n| GPT-2      | ✅            |           | ✅         |                                              | ✅                       | ✅                    |                    |                 |                      |             |\n| [GroupBERT](https://arxiv.org/abs/2106.05822)   | ✅            | ✅         | ❌         |                                              | ✅                       | ✅                    | ✅                  | ✅               |                      |             |\n| HuBERT     | ❌            |           |           |                                              | ✅                       |                      |                    |                 |                      |       ✅      |\n| LXMERT     | ❌            |           |           |                                              |                         |                      | ✅                  |                 |                      |             |\n| RoBERTa    | ✅            | ✅         | ❌         |                                              | ✅                       | ✅                    | ✅                  | ✅               |                      |             |\n| T5         | ✅            |           |           | ✅                                            |                         |                      |                    |                 |                      |             |\n| ViT        | ❌            |           |           |                                              |                         |                      |                    |                 | ✅                    |             |\n| Wav2Vec2   | ✅            |           |           |                                              |                         |                      |                    |                 |                      |      ✅        |\n| Whisper   |    ❌          |           |           |                    ✅                           |                          |                      |                    |                 |                      |              |\n\n\nIf you find any issue while using those, please open an issue or a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Foptimum-graphcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuggingface%2Foptimum-graphcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Foptimum-graphcore/lists"}