Skip to content

Commit 44a6ebc

Browse files
committed
update pip in readme
1 parent fb978fc commit 44a6ebc

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ For details please refer to: [https://arxiv.org/abs/2105.14995](https://arxiv.or
3434
```
3535

3636

37-
# Requirements
37+
# Install
38+
39+
## Requirements
3840
(Updated Jun 17 2021) `PyTorch` requirement updated to `1.9.0` as the introduction of the [`batch_first` argument](https://github.com/pytorch/pytorch/pull/55285) will conform with our pipeline.
3941

40-
To install requirements:
42+
This package can be cloned locally and used with the following requirements:
4143

42-
```setup
44+
```bash
45+
git clone https://github.com/scaomath/fourier_transformer.git
46+
cd fourier_transformer
4347
pip install -r requirements.txt
4448
```
4549

@@ -62,6 +66,37 @@ jupyterthemes==0.20.0
6266
ipython==7.23.1
6367
```
6468

69+
## Installing using pip
70+
71+
This package can be installed using pip.
72+
73+
```bash
74+
python3 -m pip install galerkin-transformer
75+
```
76+
77+
Example usage of the Simple Fourier/Galerkin Transformer encoder layers:
78+
79+
```python
80+
from galerkin_transformer.model import *
81+
82+
encoder_layer = FourierTransformerEncoderLayer(
83+
d_model=128,
84+
pos_dim=1,
85+
n_head=4,
86+
dim_feedforward=512,
87+
attention_type='galerkin',
88+
layer_norm=False,
89+
attn_norm=True,
90+
norm_type='layer',
91+
dropout=0.05)
92+
encoder_layers = nn.ModuleList([copy.deepcopy(encoder_layer) for _ in range(6)])
93+
x = torch.randn(8, 8192, 128) # embedding
94+
pos = torch.arange(0, 8192).unsqueeze(-1) # Euclidean coordinates
95+
pos = pos.repeat(8, 1, 1)
96+
for layer in encoder_layers:
97+
x = layer(x, pos)
98+
```
99+
65100
# Data
66101
The data is courtesy of [Zongyi Li (Caltech)](https://github.com/zongyi-li/fourier_neural_operator) under the MIT license. Download the following data from [here](https://drive.google.com/drive/folders/1UnbQh2WWc6knEHbLn-ZaXrKUZhp7pjt-?usp=sharing):
67102
>`burgers_data_R10.mat`

0 commit comments

Comments
 (0)