Spaces:
Running
Running
Converted content to more of a quick start guide for Hugging Face models on AMD devices using ROCm.
Browse files8 unmodified lines910111213141516171819202122232425268 unmodified lines# together we advance_AIAI 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.# Useful Links and Blogs- Check out our blog titled [Run a Chatgpt-like Chatbot on a Single GPU with ROCm](https://huggingface.co/blog/chatbot-amd-gpu)- Is my [hardware supported](https://rocm.docs.amd.com/en/latest/release/gpu_os_support.html#gpu-support-table) with ROCm?- ROCm [Documentation](https://rocm.docs.amd.com/en/latest/) for installation and usage- Extended training content and connect with the development community at the [Developer Hub](https://www.amd.com/en/developer/rocm-hub.html)# Run These HuggingFace Models with PyTorch on AMD GPUs- [BERT](https://huggingface.co/bert-base-uncased)-8 unmodified lines9101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596978 unmodified lines# together we advance_AIAI 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.# Getting Started with Hugging Face TransformersThis section describes how to use the most common transformers on Hugging Facefor 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.## 1. Confirm you have a supported AMD hardware platformIs my [hardware supported](https://rocm.docs.amd.com/en/latest/release/gpu_os_support.html#gpu-support-table) with ROCm?## 2. Install ROCm driver, libraries and toolsFollow the detailed [installation instructions](https://rocm.docs.amd.com/en/latest/deploy/linux/index.html) for your Linux based platform.## 3. Install Machine Learning FrameworksPip installation is an easy way to acquire all the required packages and is described in more detail below.>If you prefer to use a container strategy, check out the pre-built images at[ROCm Docker Hub](https://hub.docker.com/u/rocm/)and [AMD Infinity Hub](https://www.amd.com/en/technologies/infinity-hub)after installing the required [dependancies](https://rocm.docs.amd.com/en/latest/deploy/docker.html).### PyTorchAMD 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](https://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`### TensorFlowAMD ROCm is upstreamed into the TensorFlow github repository.Pre-built wheels are hosted on [pipy.org](https://pypi.org/project/tensorflow-rocm/)The latest version can be installed with this command:> `pip install tensorflow-rocm`## 4. Use a Hugging Face ModelNow 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](https://huggingface.co/gpt2) in PyTorch:```pythonfrom transformers import GPT2Tokenizer, GPT2Modeltokenizer = 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](https://github.com/RadeonOpenCompute/ROCm/discussions)Here are a few of the more popular ones to get you started:- [BERT](https://huggingface.co/bert-base-uncased)- [BLOOM](https://huggingface.co/bigscience/bloom)- [LLaMA](https://huggingface.co/huggyllama/llama-7b)- [OPT](https://huggingface.co/facebook/opt-66b)- [T5](https://huggingface.co/t5-base)Click on the 'Use in Transformers' button to see the exact code to import a specific model into your Python application.# Useful Links and Blogs- Check out our blog titled [Run a Chatgpt-like Chatbot on a Single GPU with ROCm](https://huggingface.co/blog/chatbot-amd-gpu)- Complete ROCm [Documentation](https://rocm.docs.amd.com/en/latest/) for installation and usage- Extended training content and connect with the development community at the [Developer Hub](https://www.amd.com/en/developer/rocm-hub.html)
README.md+78-7