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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs and Hpu media work around #41

Merged
merged 6 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Habana dataloader hang with Lightning 2.0.x ([#29](https://github.com/Lightning-AI/lightning-Habana/pull/29))
- Make #29 applicable only for gaudi devices ([#39](https://github.com/Lightning-AI/lightning-Habana/pull/39))
- Fixed environment initialization for hpus and fixed docs ([#40](https://github.com/Lightning-AI/lightning-Habana/pull/40))
- Fixed docs and added work around to make use hpu media packages without signature issues ([#41](https://github.com/Lightning-AI/lightning-Habana/pull/41))

### Removed

Expand Down
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ To install Lightning Habana, run the following command:
pip install -U lightning lightning-habana
```

______________________________________________________________________

**NOTE**

Ensure either of lightning or pytorch-lightning is used when working with the plugin.
Mixing strategies, plugins etc from both packages is not yet validated.

______________________________________________________________________

## Using PyTorch Lighting with HPU

To enable PyTorch Lightning with HPU accelerator, provide `accelerator=HPUAccelerator()` parameter to the Trainer class.
Expand All @@ -40,11 +49,6 @@ To enable PyTorch Lightning with HPU accelerator, provide `accelerator=HPUAccele
from lightning import Trainer
from lightning_habana.pytorch.accelerator import HPUAccelerator

# Run on as many HPUs as available by default.
trainer = Trainer(accelerator="auto", devices="auto", strategy="auto")
# Equivalent to
trainer = Trainer()

# Run on one HPU.
trainer = Trainer(accelerator=HPUAccelerator(), devices=1)
# Run on multiple HPUs.
Expand All @@ -59,25 +63,11 @@ The `devices>1` parameter with HPUs enables the Habana accelerator for distribut

# Support Matrix

```
+------------------------+----------------------------------------------------------+
| **SynapseAI** | 1.10.0 |
+========================+==========================================================+
| **PyTorch** | 2.0.1 |
| | |
+------------------------+----------------------------------------------------------+
| **PyTorch Lightning** | 2.0.0 |
| or | |
| **Lightning** | 2.0.0 |
| | |
+------------------------+----------------------------------------------------------+
| **Lightning Habana** | 1.0.0 |
| | |
+------------------------+----------------------------------------------------------+
| **DeepSpeed** | Forked from v0.7.7 of the official |
| | DeepSpeed. |
| | |
+------------------------+----------------------------------------------------------+
```
| **SynapseAI** | **1.10.0** |
| ---------------------------------------- | -------------------------------------------------- |
| PyTorch | 2.0.1 |
| PyTorch Lightning<br> or<br>Lightning | 2.0.x<br><br>2.0.x |
| **Lightning Habana** | **1.0.0** |
| DeepSpeed | Forked from v0.7.7 of the official DeepSpeed repo. |

For more information, check out [HPU Support Matrix](https://docs.habana.ai/en/latest/Support_Matrix/Support_Matrix.html)
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ class RandomFlipFunction(media_function):
seed: seed to be used
"""

def __init__(self, params: Any) -> None:
def __init__(self, params): # type: ignore[no-untyped-def]
self.np_shape = params["shape"][::-1]
self.np_dtype = params["dtype"]
self.seed = params["seed"]
self.rng = np.random.default_rng(self.seed)

def __call__(self) -> Any:
def __call__(self): # type: ignore[no-untyped-def]
""":returns : randomly generated binary output per image."""
probabilities = [1.0 - FLIP_PROBABILITY, FLIP_PROBABILITY]
random_flips = self.rng.choice([0, 1], p=probabilities, size=self.np_shape)
Expand Down