Skip to content

Add ROCm (AMD) support for Studio finetuning - #4708

Closed
edamamez wants to merge 6 commits into
unslothai:mainfrom
edamamez:ez-amd-finetune-studio-support
Closed

edamamez wants to merge 6 commits into
unslothai:mainfrom
edamamez:ez-amd-finetune-studio-support

Conversation

@edamamez

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces ROCm (AMD GPU) detection to the installation script, allowing for the correct PyTorch index URL to be used when CUDA is not detected. Additionally, it updates the PyTorch version range and ensures unsloth installation includes the torch index as an extra index URL. A portability issue was found in the ROCm version parsing logic, where the use of Bash-specific herestrings in a POSIX shell script could cause failures on certain Linux distributions.

I am having trouble creating individual review comments. Click here to see my feedback.

install.sh (748-749)

high

The herestring operator (<<<) is a Bash-specific extension and is not supported by POSIX-compliant shells like dash, which is the default /bin/sh on many Linux distributions (including Ubuntu and Debian). Using it in a script with a #!/bin/sh shebang will cause a syntax error. To maintain portability, use printf and a pipe instead.

            { command -v dpkg-query >/dev/null 2>&1 && ver="$(dpkg-query -W -f="\${Version}\n" rocm-core 2>/dev/null)" && [ -n "$ver" ] && printf '%s\n' "$ver" | awk -F'[.-]' '{print "rocm"$1"."$2; exit}'; } || \
            { command -v rpm >/dev/null 2>&1 && ver="$(rpm -q --qf '%{VERSION}\n' rocm-core 2>/dev/null)" && [ -n "$ver" ] && printf '%s\n' "$ver" | awk -F'[.-]' '{print "rocm"$1"."$2; exit}'; })

@Datta0

Datta0 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Hey @edamamez thanks for the contribution.
There are a few more things to consider wrt AMD.
Do you think we can do something similar to #4602
Another thing is about support for libraries like causal-conv1d and mamba-ssm where we try to install from wheel when available (we have a pypi fallback). I'm not 100% sure if the same are supported on ROCm?

@Datta0

Datta0 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Actually nvm, we can take that up separately :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants