AI & ML interests
None defined yet.
AI is increasingly pervasive across the modern world. It’s driving our smart technology in retail, cities, factories and healthcare, and transforming our digital homes. AMD offers advanced AI acceleration from data center to edge, enabling high performance and high efficiency to make the world smarter.
This section describes how to use the most common transformers on Hugging Face for inference workloads on AMD accelerators using the AMD ROCm software ecosystem. This base knowledge can be leveraged to start fine-tuning from a base model or even start developing your own model. General Linux and ML experience is a required pre-requisite.
Is my hardware supported with ROCm?
Follow the detailed installation instructions for your Linux based platform.
Pip installation is an easy way to acquire all the required packages and is described in more detail below.
AMD ROCm is fully integrated into the mainline PyTorch ecosystem. Pip wheels are built and tested as part of the stable and nightly releases. Go to pytorch.org and use the 'Install PyTorch' widget. Select 'Stable + Linux + Pip + Python + ROCm' to get the specific pip installation command.
An example command line (note the versioning of the whl file):
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
AMD ROCm is upstreamed into the TensorFlow github repository. Pre-built wheels are hosted on pipy.org
The latest version can be installed with this command:
pip install tensorflow-rocm
Now that you have the base requirements installed, get the latest transformer models.
pip install transformers
This allows you to easily import any of the base models into your python application. Here is an example using GPT2 in PyTorch:
from transformers import GPT2Tokenizer, GPT2Model tokenizer = GPT2Tokenizer.from_pretrained('gpt2') model = GPT2Model.from_pretrained('gpt2') text = "Replace me by any text you'd like." encoded_input = tokenizer(text, return_tensors='pt') output = model(**encoded_input)
All of the 200+ standard transformer models are regularly tested with our supported hardware platforms. Note that this also implies that all derivatives of those core models should also function correctly. Let us know if you run into issues at our ROCm Community page
Here are a few of the more popular ones to get you started:
Click on the 'Use in Transformers' button to see the exact code to import a specific model into your Python application.
- Check out our blog titled Run a Chatgpt-like Chatbot on a Single GPU with ROCm
- Complete ROCm Documentation for installation and usage
- Extended training content and connect with the development community at the Developer Hub