Skip to content

Fix import for XCCl availability check#1028

Open
D4idalos wants to merge 1 commit into
meta-llama:mainfrom
D4idalos:patch-1
Open

Fix import for XCCl availability check#1028
D4idalos wants to merge 1 commit into
meta-llama:mainfrom
D4idalos:patch-1

Conversation

@D4idalos
Copy link
Copy Markdown

fix: correct ImportError in train_utils by updating accelerate.utils imports

This PR fixes a blocking ImportError in llama_cookbook/utils/train_utils.py that occurs when attempting to initialize training (specifically tested with QLoRA). The script tries to import is_ccl_available from accelerate.utils, but in current environments/versions of accelerate, this attribute is named is_xccl_available.

Motivation and Context:
While running fine-tuning on XPU-equipped clusters (like EuroHPC), the training process crashes immediately during the import phase. Correcting this import allows the train_utils.py to correctly identify the availability of the Collective Communications Library (CCL) for XPU backends.

Error Log:

File ".../llama_cookbook/utils/train_utils.py", line 26, in <module>
    from accelerate.utils import is_xpu_available, is_ccl_available
ImportError: cannot import name 'is_ccl_available' from 'accelerate.utils'
```

Feature/Issue validation/testing
I have verified the fix by running a QLoRA fine-tuning session.

[x] Test A: QLoRA Fine-tuning Initialization

Model: `meta-llama/CodeLlama-7b-Instruct-hf`

Environment: Python 3.11, requirements  installed.

Result: Before the fix, the script failed with ImportError. After changing the import to is_xccl_available, the training pipeline initializes correctly and the model starts training as expected.

Before submitting
[x] This PR fixes a typo or improves the docs.

[] Did you read the [contributor guideline](https://github.com/meta-llama/llama-cookbook/blob/main/CONTRIBUTING.md), Pull Request section?

[ ] Was this discussed/approved via a Github issue? Please add a link to it if that's the case.

[ ] Did you make sure to update the documentation with your changes?

[ ] Did you write any new necessary tests?

@meta-cla meta-cla Bot added the cla signed label Mar 16, 2026
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.

1 participant