Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Fix Windows permission error on merge test #1952

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Jul 24, 2024

For some BS reason, Windows CI suddenly started throwing permission errors on test_merge_layers. These errors occur when using the TempDirectory() context manager, which raises a PermissionError on Windows when it tries to clean up after itself. Therefore, this context manager is now avoided in favor of manual clean up.

More context:

I investigated this issue first in #1947. My suspicion that this could be caused by a new pytest version was not confirmed. Maybe the reason is that GH rolled out a new Windows worker, not sure.

Also note that this is not the first time that this workaround is required, e.g. also here:

# note: not using the context manager here because it fails on Windows CI for some reason
tmp_dirname = tempfile.mkdtemp()
try:
model.save_pretrained(tmp_dirname)
model = ModelEmbConv1D(emb_size=105)
# first check that this raises
with pytest.raises(RuntimeError) as exc:
PeftModel.from_pretrained(model, tmp_dirname)
msg = exc.value.args[0]
assert "size mismatch" in msg and "100" in msg and "105" in msg
# does not raise
PeftModel.from_pretrained(model, tmp_dirname, ignore_mismatched_sizes=True)
finally:
try:
shutil.rmtree(tmp_dirname)
except PermissionError:
# windows error
pass

For some **** reason, Windows CI suddenly started throwing permission
errors on test_merge_layers. These errors occur when using the
TempDirectory() context manager, which raises a PermissionError on
Windows when it tries to clean up after itself. Therefore, this context
manager is now avoided in favor of manual clean up.

More context:

I investigated this issue first in huggingface#1947. My suspicion that this could
be caused by a new pytest version was not confirmed. Maybe the reason is
that GH rolled out a new Windows worker, not sure.

Also note that this is not the first time that this workaround is
required, e.g. also here:

https://github.com/huggingface/peft/blob/e6cd24c907565040ee1766a5735afe3d13a71164/tests/test_custom_models.py#L1465
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Windows :(

@BenjaminBossan BenjaminBossan merged commit f2b6d13 into huggingface:main Jul 25, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the ci-fix-windows-permission-error-again branch July 25, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants