News for hackers. Stuff that matters.
Re:We fine-tuned Llama 405B on AMD GPUs by felarof on Monday September 23, 2024 @08:39PM (#41632003)
Ahh, interesting, will take a look!

Curious what are the steps to run PyTorch on AMD (does it work out-of-box with PyTorch+rocm docker image)? Does torch.compile work smoothly?

Re:We fine-tuned Llama 405B on AMD GPUs by anthonix1 on Monday September 23, 2024 @08:52PM (#41632072)
Yeah I would suggest taking a look at PyTorch on AMD before saying stuff like "scaled_dot_product_attention is an NVIDIA CUDA kernel exposed as a PyTorch function", because that is demonstrably false.

Also, FWIW, I would suggest getting a small Llama 3.1 model training fast before trying to do a big 405B model -- faster to iterate and almost everything you'll learn on the small models will scale to the 405B.

Re:We fine-tuned Llama 405B on AMD GPUs by felarof on Monday September 23, 2024 @09:23PM (#41632252)
Thanks for the feedback! I appreciate you pointing that out. My understanding was based on the PyTorch documentation for scaled_dot_product_attention (https://pytorch.org/docs/stable/generated/torch.nn.functiona...). - "The function may call optimized kernels for improved performance when using the CUDA backend. For all other backends, the PyTorch implementation will be used."

And was trying to make a broader point about the lack of transparency (in performance, lower-level impl) in PyTorch when running on NVIDIA vs. non-NVIDIA hardware.

Re:We fine-tuned Llama 405B on AMD GPUs by anthonix1 on Monday September 23, 2024 @10:37PM (#41632620)
I just asked an instance of Hermes 3 Llama 3.1 405B running on AMD GPUs: "does pytorch scaled dot product attention run on AMD GPUs?":

"Yes, PyTorch's scaled dot product attention can run on AMD GPUs. PyTorch supports AMD GPUs through the ROCm (Radeon Open Compute) platform. To use PyTorch with an AMD GPU, you need to install the ROCm version of PyTorch, which is specifically built for AMD GPUs [...]"

And it proceeded to give the steps to follow to install and run, with example Python code to demonstrate it. One slight nitpick is that it referred to an older URL with the --index-url to install torch with pip, but otherwise it was correct.

Re:We fine-tuned Llama 405B on AMD GPUs by unlikelymordant on Tuesday September 24, 2024 @02:17AM (#41633572)
are you at all confident that this isn't hallucinated? I'd never trust an answer like this from an LLM
Re:We fine-tuned Llama 405B on AMD GPUs by WithinReason on Tuesday September 24, 2024 @02:42AM (#41633690)
Did you verify everything else it said is true?
Re:We fine-tuned Llama 405B on AMD GPUs by chillee on Tuesday September 24, 2024 @04:27AM (#41634396)
> And was trying to make a broader point about the lack of transparency (in performance, lower-level impl) in PyTorch when running on NVIDIA vs. non-NVIDIA hardware.

I don't quite understand this argument. Lack of transparency from running PyTorch so instead we're gonna leave it all to XLA? How does this solve the "transparency" issue?

Re:We fine-tuned Llama 405B on AMD GPUs by orf on Tuesday September 24, 2024 @03:24PM (#41639992)
Having a common library function that is either lighting fast or dog slow depending on the hardware, is not a great position to be in.

Moreover, this will get worse as more CUDA specific features are added to PyTorch with ad-hoc fallback functions.

I guess OP is saying that XLA is more transparent in this regard, because it wouldn’t use functions like these and the generated comparable code would be on-pare performance wise?

Re:We fine-tuned Llama 405B on AMD GPUs by chillee on Tuesday September 24, 2024 @05:01PM (#41640856)
> it wouldn’t use functions like these and the generated comparable code would be on-pare performance wise

Perhaps if XLA generated all functions from scratch, this would be more compelling. But XLA relies very heavily on pattern-matching to common library functions (e.g. CuDNN), and these patterns will certainly work better on Nvidia GPUs than AMD GPUs.

In this way, I actually think explicitly calling the common library functions is actually much more transparent.

Re:We fine-tuned Llama 405B on AMD GPUs by lhl on Tuesday September 24, 2024 @03:04AM (#41633839)
While your project is neat and I'd like to see how the performance compares, for LLM training, PyTorch, including torch.compile works completely OOTB on AMD.

All you have to do is pip install the ROCm version of PyTorch (or run the docker image) and it's seamless (the ROCm version just treats torch.cuda as calling ROCm).

I've used axolotl (trl/accelerate based), torchtune, and LLaMA-Factory, which are all PyTorch-based without any issues for training.