-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mock Fabric os.environ variables to be sure to have a SingleDeviceStr…
…ategy Fabric object (#250)
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from lightning import Fabric | ||
from lightning.fabric.strategies import SingleDeviceStrategy | ||
|
||
from sheeprl.utils.fabric import get_single_device_fabric | ||
|
||
|
||
def test_get_single_device_fabric(): | ||
fabric = Fabric(devices=2, accelerator="cpu", precision=16) | ||
single_device_fabric = get_single_device_fabric(fabric) | ||
assert single_device_fabric.device == fabric.device | ||
assert single_device_fabric._precision == fabric._precision | ||
assert single_device_fabric.accelerator == fabric.accelerator | ||
assert isinstance(single_device_fabric.strategy, SingleDeviceStrategy) |