Issue Description
SFTTrainer experiments with fms_hf_tuning_version=3.1.0 do not reliably install flash-attn, mamba_ssm, and causal_conv1d. This leads to the ray tasks that ado-sfttrainer creates to exit with an exception:
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/ado_actuators/sfttrainer/wrapper_fms_hf_tuning/scripts/wrapper_sfttrainer.py", line 686, in <module>
main()
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/ado_actuators/sfttrainer/wrapper_fms_hf_tuning/scripts/wrapper_sfttrainer.py", line 643, in main
module.parse_arguments_and_execute_wrapper(
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/ado_actuators/sfttrainer/wrapper_fms_hf_tuning/tuning_versions/at_least_3_0_0_1.py", line 49, in parse_arguments_and_execute_wrapper
return tuning.sft_trainer.train(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/tuning/sft_trainer.py", line 351, in train
raise e
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/tuning/sft_trainer.py", line 331, in train
model = model_loader(
^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 600, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 317, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4999, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/models/granite/modeling_granite.py", line 480, in __init__
super().__init__(config)
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2228, in __init__
self.config._attn_implementation_internal = self._check_and_adjust_attn_implementation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2765, in _check_and_adjust_attn_implementation
attn_implementation = self.get_correct_attn_implementation(applicable_attn_implementation, is_init_check)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2797, in get_correct_attn_implementation
self._flash_attn_2_can_dispatch(is_init_check)
File "/tmp/ray/session_2026-07-20_03-06-53_055727_1/runtime_resources/ordered_pip/pip/4fc74475993723d02715a276975b4d6221536f41/virtualenv/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2494, in _flash_attn_2_can_dispatch
raise ImportError(f"{preface} the package flash_attn seems to be not installed. {install_message}")
(launch_finetune_947410ce pid=3542, ip=10.48.27.185) ImportError: FlashAttention2 has been toggled on, but it cannot be used due to the following error: the package flash_attn seems to be not installed. Please refer to the documentation of https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2 to install Flash Attention 2.
However, using a wheelhouse does result in successful measurements.
To utilize a python wheelhouse:
- populate a directory that is accessible by your GPU workers with the .whl files for torch, flash_attn, mamba_ssm, causal_conv1d and their dependencies for example
/data/wheelhouse
- set the env-var
PIP_FIND_LINKS: "file:///data/wheelhouse/" in your ray_runtime.yaml file
In my test, I re-activated the venv that ado-sfttrainer created for one of my failed ray tasks and then I ran:
pip wheel --no-build-isolation -w /data/wheelhouse torch==2.8.0 flash_attn==2.8.3 causal_conv1d==1.5.3.post1 mamba_ssm==2.2.6.post3
Following this wheelhouse workaround, my operation was successful.
The packages flash_attn, mamba_ssm, and causal_conv1d have a build-time dependency to torch. In vanila ray there's only one way to install these packages. You must install torch in the same virtual environment of ray prior to starting your raycluster.
As a workaround, I have implemented the ordered_pip RayRuntimeEnv plugin in ado-core (docs and code) and I use it with ado-sfttrainer. However, I found that ordered_pip does not work unless also coupled with a python wheelhouse. I don't know exactly what's wrong; I suspect that it has to do with the time it takes for pip to build the above 3 wheels prior to installing them.
How to reproduce
Steps to reproduce the behavior:
- deploy a RayCluster with the image
quay.io/ado/ado:2.0.0-ofed-py311-cu121-ofed2410v1140
- create a space for ado-sfttrainer that uses flash_attn (default is on)
- start an operation
- observe that the operation fails to measure properties due to the exception
ImportError: FlashAttention2 has been toggled on, but it cannot be used due to the following error: the package flash_attn seems to be not installed. Please refer to the documentation of https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2 to install Flash Attention 2.
Expected behaviour
The operation is expected to work without having to use a wheelhouse.
Screenshots/Logs
Python/ado/system info
Please include the output of:
python --version
ado version
Your OS
- Python = 3.11.20
- ado = 2.0.1.dev32+ge1f8bf03.d20260715134322.dirty
- OS linux
Note: If you installed ado in editable mode (e.g., pip install -e .) or
ran uv sync, the version metadata may not be up to date. Please reinstall to
get an accurate version number:
# If you used uv sync:
uv sync --reinstall
# If you used pip install -e:
pip install -e . --force-reinstall --no-deps
Additional information
TBD
Issue Description
SFTTrainer experiments with fms_hf_tuning_version=3.1.0 do not reliably install flash-attn, mamba_ssm, and causal_conv1d. This leads to the ray tasks that ado-sfttrainer creates to exit with an exception:
However, using a wheelhouse does result in successful measurements.
To utilize a python wheelhouse:
/data/wheelhousePIP_FIND_LINKS: "file:///data/wheelhouse/"in your ray_runtime.yaml fileIn my test, I re-activated the venv that ado-sfttrainer created for one of my failed ray tasks and then I ran:
pip wheel --no-build-isolation -w /data/wheelhouse torch==2.8.0 flash_attn==2.8.3 causal_conv1d==1.5.3.post1 mamba_ssm==2.2.6.post3Following this wheelhouse workaround, my operation was successful.
The packages flash_attn, mamba_ssm, and causal_conv1d have a build-time dependency to torch. In vanila ray there's only one way to install these packages. You must install
torchin the same virtual environment of ray prior to starting your raycluster.As a workaround, I have implemented the
ordered_pipRayRuntimeEnv plugin in ado-core (docs and code) and I use it with ado-sfttrainer. However, I found thatordered_pipdoes not work unless also coupled with a python wheelhouse. I don't know exactly what's wrong; I suspect that it has to do with the time it takes for pip to build the above 3 wheels prior to installing them.How to reproduce
Steps to reproduce the behavior:
quay.io/ado/ado:2.0.0-ofed-py311-cu121-ofed2410v1140ImportError: FlashAttention2 has been toggled on, but it cannot be used due to the following error: the package flash_attn seems to be not installed. Please refer to the documentation of https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2 to install Flash Attention 2.Expected behaviour
The operation is expected to work without having to use a wheelhouse.
Screenshots/Logs
Python/ado/system info
Please include the output of:
Note: If you installed ado in editable mode (e.g.,
pip install -e .) orran
uv sync, the version metadata may not be up to date. Please reinstall toget an accurate version number:
Additional information
TBD