Pull request #2: Add conda environment and installation

Merge in EAI/platform-demo-scripts from mambaforge-installation-method to switching_to_pytorch_lightning_and_pick_benchmark

* commit '4b169cab5b9f8b277a44d905b52fdfb1f3d76550':
  Add installation method for OSX
  Add conda environment and installation
This commit is contained in:
Hubert Siejkowski 2023-09-25 08:09:20 +02:00
commit 78ac51478c
3 changed files with 88 additions and 11 deletions

View File

@ -15,17 +15,55 @@ This repo contains notebooks and scripts demonstrating how to:
This code is based on the [pick-benchmark](https://github.com/seisbench/pick-benchmark), the repository accompanying the paper:
[Which picker fits my data? A quantitative evaluation of deep learning based seismic pickers](https://doi.org/10.1029/2021JB023499)
### Before running
### Installation method 1
Please download and install [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge) following the [official guide](https://github.com/conda-forge/miniforge#install).
After successful installation and within the Mambaforge environment please clone this repository:
```
git clone ssh://git@git.plgrid.pl:7999/eai/platform-demo-scripts.git
```
and please run for Linux or Windows platforms:
```
cd platform-demo-scripts
mambaforge env create -f epos-ai-train.yml
```
or for OSX:
```
cd platform-demo-scripts
mambaforge env create -f epos-ai-train-osx.yml
```
This will create a conda environment named `platform-demo-scripts` with all required packages installed.
To run the notebooks and scripts from this repository it is necessary to activate the `platform-demo-scripts` environment by running:
```
conda activate platform-demo-scripts
```
### Installation method 2
Please [install Poetry](https://python-poetry.org/docs/#installation), a tool for dependency management and packaging in Python.
Then we will use only Poetry for creating Python environment and installing dependencies.
Install all dependencies with poetry, run:
```
poetry install
```
To run the notebooks and scripts from this repository it is necessary to activate the poetry environment by running:
```
poetry shell
```
### Usage
1. Install all dependencies with poetry, run:
`poetry install`
2. Prepare .env file with content:
1. Prepare .env file with content:
```
WANDB_HOST="https://epos-ai.grid.cyfronet.pl/"
WANDB_API_KEY="your key"
@ -33,15 +71,11 @@ Then we will use only Poetry for creating Python environment and installing depe
WANDB_PROJECT="training_seisbench_models_on_igf_data"
BENCHMARK_DEFAULT_WORKER=2
3. Transform data into seisbench format. (unofficial)
2. Transform data into seisbench format. (unofficial)
* Download original data from the [drive](https://drive.google.com/drive/folders/1InVI9DLaD7gdzraM2jMzeIrtiBSu-UIK?usp=drive_link)
* Run the notebook: `utils/Transforming mseeds to SeisBench dataset.ipynb`
4. Initialize poetry environment:
`poetry shell`
5. Run the pipeline script:
3. Run the pipeline script:
`python pipeline.py`

21
epos-ai-train-osx.yml Normal file
View File

@ -0,0 +1,21 @@
name: epos-ai-train
channels:
- pytorch
- nvidia
dependencies:
- python=3.10
- pytorch=2.0.1
- PyYAML=6.0
- python-dotenv=1.0.0
- pandas=2.0.3
- obspy=1.4.0
- wandb=0.15.4
- torchmetrics=0.11.4
- pytorch-lightning
- scikit-learn
- openpyxl
- jupyterlab
- notebook
- pip
- pip:
- seisbench==0.4.1

22
epos-ai-train.yml Normal file
View File

@ -0,0 +1,22 @@
name: epos-ai-train
channels:
- pytorch
- nvidia
dependencies:
- python=3.10
- pytorch=2.0.1
- pytorch-cuda
- PyYAML=6.0
- python-dotenv=1.0.0
- pandas=2.0.3
- obspy=1.4.0
- wandb=0.15.4
- torchmetrics=0.11.4
- pytorch-lightning
- scikit-learn
- openpyxl
- jupyterlab
- notebook
- pip
- pip:
- seisbench==0.4.1