-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,42 +1,46 @@ | ||
# Advanced LSTM Implementation with Burn | ||
A sophisticated implementation of Long Short-Term Memory (LSTM) networks in Burn, featuring state-of-the-art architectural enhancements and optimizations. This implementation includes bidirectional processing capabilities and advanced regularization techniques. More details can be found at the [PyTorch implementation](https://github.com/shiv08/Advanced-LSTM-Implementation-with-PyTorch). | ||
|
||
`LstmNetwork` is the top-level module with bidirectional support and output projection. It can support multiple LSTM variants by setting appropriate `bidirectional` and `num_layers`: | ||
* LSTM: `num_layers = 1` and `bidirectional = false` | ||
* Stacked LSTM: `num_layers > 1` and `bidirectional = false` | ||
* Bidirectional LSTM: `num_layers = 1` and `bidirectional = true` | ||
* Bidirectional Stacked LSTM: `num_layers > 1` and `bidirectional = true` | ||
A more advanced implementation of Long Short-Term Memory (LSTM) networks in Burn with combined | ||
weight matrices for the input and hidden states, based on the | ||
[PyTorch implementation](https://github.com/shiv08/Advanced-LSTM-Implementation-with-PyTorch). | ||
|
||
This implementation is complementary to Burn's official LSTM, users can choose either one depends on the project's specific needs. | ||
`LstmNetwork` is the top-level module with bidirectional and regularization support. The LSTM | ||
variants differ by `bidirectional` and `num_layers` settings: | ||
|
||
## Usage | ||
- LSTM: `num_layers = 1` and `bidirectional = false` | ||
- Stacked LSTM: `num_layers > 1` and `bidirectional = false` | ||
- Bidirectional LSTM: `num_layers = 1` and `bidirectional = true` | ||
- Bidirectional Stacked LSTM: `num_layers > 1` and `bidirectional = true` | ||
|
||
This implementation is complementary to Burn's official LSTM, users can choose either one depends on | ||
the project's specific needs. | ||
|
||
## Usage | ||
|
||
## Training | ||
|
||
```sh | ||
# Cuda backend | ||
cargo run --example train --release --features cuda-jit | ||
cargo run --example lstm-train --release --features cuda-jit | ||
|
||
# Wgpu backend | ||
cargo run --example train --release --features wgpu | ||
cargo run --example lstm-train --release --features wgpu | ||
|
||
# Tch GPU backend | ||
export TORCH_CUDA_VERSION=cu121 # Set the cuda version | ||
cargo run --example train --release --features tch-gpu | ||
cargo run --example lstm-train --release --features tch-gpu | ||
|
||
# Tch CPU backend | ||
cargo run --example train --release --features tch-cpu | ||
cargo run --example lstm-train --release --features tch-cpu | ||
|
||
# NdArray backend (CPU) | ||
cargo run --example train --release --features ndarray | ||
cargo run --example train --release --features ndarray-blas-openblas | ||
cargo run --example train --release --features ndarray-blas-netlib | ||
cargo run --example lstm-train --release --features ndarray | ||
cargo run --example lstm-train --release --features ndarray-blas-openblas | ||
cargo run --example lstm-train --release --features ndarray-blas-netlib | ||
``` | ||
|
||
|
||
### Inference | ||
|
||
```sh | ||
cargo run --example infer --release --features cuda-jit | ||
cargo run --example lstm-infer --release --features cuda-jit | ||
``` |
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