Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
stke9 committed Feb 2, 2022
2 parents e298638 + 058218e commit 53f40c2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 6 deletions.
82 changes: 77 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,83 @@
# GAN-boilerplate

A boilerplate repo for GAN projects
A boilerplate repo for GAN projects.

TODO
This repo is geared towards GANs for material microstructure projects, where the generator learned to output a homogeneous image. However, it can be easily adapted to any GAN project.

explain .env file
## Folder structure

Explain whole thing
```
GAN-boilerplate
┣ src
┃ ┣ __init__.py
┃ ┣ networks.py
┃ ┣ postprocessing.py
┃ ┣ preprocessing.py
┃ ┣ test.py
┃ ┣ train.py
┃ ┗ util.py
┣ data
┃ ┗ example.png
┣ .gitignore
┣ config.py
┣ main.py
┣ README.md
┗ requirements.txt
```

Finish dosctrings
## Quickstart

Prerequisites:

- conda
- python3

Create a new conda environment, activate and install pytorch

_Note: cudatoolkit version and pytorch install depends on system, see [PyTorch install](https://pytorch.org/get-started/locally/) for more info._

```
conda create --name gan-boilerplate
conda activate gan-boilerplate
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
conda install -r requirements.txt
```

Create a .env file to hold secrets, the .env file must include

```
WANDB_API_KEY=
WANDB_ENTITY=
WANDB_PROJECT=
```

You are now ready to run the repo. To start training

```
python main.py train -t test-run
```

This will track your run online with Weights and Biases and name your training run `test-run`. To run in offline mode

```
python main.py train -t test-run -o
```

To generate samples from a trained generator

```
python main.py generate -t test-run
```

To run unit tests

```
python main.py test
```

## TODO

- [x] Quickstart
- [ ] Saving and loading models
- [ ] Training outputs
- [ ] Network architectures
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main(mode, offline, tag):

elif mode == 'test':
print('Performing unit tests')
pt = pytest.main(["-x", "crystalgan/test.py"])
pt = pytest.main(["-x", "src/test.py"])

else:
raise ValueError("Mode not recognised")
Expand Down

0 comments on commit 53f40c2

Please sign in to comment.