Add conda environment and installation

This commit is contained in:
Hubert Siejkowski 2023-09-08 09:51:52 +02:00
parent ca7506bd1d
commit 5443706232
2 changed files with 59 additions and 11 deletions

View File

@ -15,17 +15,47 @@ 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: 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) [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 run following commands:
```
git clone ssh://git@git.plgrid.pl:7999/eai/platform-demo-scripts.git
cd platform-demo-scripts
mambaforge env create -f environment.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. 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. 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 ### Usage
1. Install all dependencies with poetry, run: 1. Prepare .env file with content:
`poetry install`
2. Prepare .env file with content:
``` ```
WANDB_HOST="https://epos-ai.grid.cyfronet.pl/" WANDB_HOST="https://epos-ai.grid.cyfronet.pl/"
WANDB_API_KEY="your key" WANDB_API_KEY="your key"
@ -33,15 +63,11 @@ Then we will use only Poetry for creating Python environment and installing depe
WANDB_PROJECT="training_seisbench_models_on_igf_data" WANDB_PROJECT="training_seisbench_models_on_igf_data"
BENCHMARK_DEFAULT_WORKER=2 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) * 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` * Run the notebook: `utils/Transforming mseeds to SeisBench dataset.ipynb`
4. Initialize poetry environment: 3. Run the pipeline script:
`poetry shell`
5. Run the pipeline script:
`python pipeline.py` `python pipeline.py`

22
environment.yml Normal file
View File

@ -0,0 +1,22 @@
name: platform-demo-scripts
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