Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Tests fail on Windows #636

@ftesser

Description

@ftesser

Describe the bug
After installing farm and its dependencies on Windows, running the tests produce the error below.
This does not happen on Linux OS.

Error message

ImportError while loading conftest 'C:\builds\fairmat\dev\FARM\test\conftest.py'.
conftest.py:7: in <module>
    from farm.modeling.adaptive_model import AdaptiveModel
..\venv\lib\site-packages\farm\modeling\adaptive_model.py:17: in <module>
    from farm.modeling.prediction_head import PredictionHead, pick_single_fn
..\venv\lib\site-packages\farm\modeling\prediction_head.py:14: in <module>
    from torch.distributed import all_gather
E   ImportError: cannot import name 'all_gather' from 'torch.distributed' (c:\builds\fairmat\dev\farm\venv\lib\site-packages\torch\distributed\__init__.py)

Expected behavior
Successfully run the tests also on Windows.

Additional context

  • pytorch version: 1.6.0

Looking to torch.distributed.__init__ I have noticed that all_gather probably is imported only for Linux and MacOS:

def is_available():
    """
    Returns ``True`` if the distributed package is available. Otherwise,
    ``torch.distributed`` does not expose any other APIs. Currently,
    ``torch.distributed`` is available on Linux and MacOS. Set
    ``USE_DISTRIBUTED=1`` to enable it when building PyTorch from source.
    Currently, the default value is ``USE_DISTRIBUTED=1`` for Linux and
    ``USE_DISTRIBUTED=0`` for MacOS.
    """
    return hasattr(torch._C, "_c10d_init")

To Reproduce

cd test && pytest

System:

  • OS: Windows
  • GPU/CPU: CPU
  • FARM version: 0.5.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions