Repository navigation
Fix zero-worker prediction on MPS-capable machines - #279
Open
leeshengis wants to merge 1 commit into
Open
leeshengis wants to merge 1 commit into
leeshengis wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
COMET prediction with
gpus=0defaults tonum_workers=0. On MPS-capable machines, predict still passesmultiprocessing_context="fork"to PyTorch DataLoader. DataLoader rejects that combination before inference startsThis matches the existing M1 report and M4 confirmation in huggingface/evaluate#673. Evaluate forwards its CPU configuration to COMET, so this fixes the underlying COMET path. This PR does not claim to close the issue in the separate evaluate repository
Change
Only supply the fork context when MPS is available and the resolved worker count is positive. Preserve the current positive-worker MPS behavior and the non-MPS default
Add a unittest exercising the real CometModel.predict and real DataLoader construction, without downloading a model
Validation
Command:
Tested on Linux x86_64, Python 3.12.14, CPU torch 2.14.1+cpu, COMET 2.2.7. The tested baseline source matches master da61b81
MPS availability is simulated; the model instance and Lightning Trainer are mocked. The real DataLoader constructor validates the parameters, but this is not a native Mac, GPU, worker-iteration or model-inference test. The full model-dependent suite was not run. The test skips Windows. Current upstream CI runs a CLI smoke check, not unit tests
AI assistance was used to prepare the patch and tests and to review and run this focused regression. No claim of human review or native Apple Silicon validation is made