Skip to content

Commit 9dca6a1

Browse files
jessepiselJesse Pisel
andauthored
Update readme (#6)
* add tutorial notebook and images * organize repo, update readme, add requirements * words are hard, update readme * update tutorial and requirements * Update README.md * Update README.md * pyarrow addition * update tutorial --------- Co-authored-by: Jesse Pisel <jesse.pisel@x.studio>
1 parent 6ceadf0 commit 9dca6a1

File tree

7 files changed

+370
-83
lines changed

7 files changed

+370
-83
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,4 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
#.idea/
163+
.DS_Store
File renamed without changes.

GFM/__init__.py

Whitespace-only changes.

README.md

Lines changed: 134 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,139 @@
1-
---
2-
license: apache-2.0
3-
tags:
4-
- vision
5-
- MAE
6-
- model_hub_mixin
7-
- pytorch_model_hub_mixin
8-
datasets:
9-
- patch-the-planet
10-
---
1+
![ThinkOnward Logo](Tutorial/assets/ThinkOnward.png)
2+
# Geophysical Foundation Model
113

12-
# Model Card for ThinkOnward's Geophysical Foundation Model
4+
Welcome to the Geophysical Foundation Model (GFM) repository! This repository is designed to help you explore, understand, and use the Geophysical Foundation Model.
135

14-
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
6+
## Table of Contents
7+
1. [How to Fork and Clone the Repository](#how-to-fork-and-clone-the-repository)
8+
2. [Getting Started](#getting-started)
9+
3. [Running the Model](#running-the-model)
10+
4. [Contributing](#contributing)
11+
5. [Model Details](#model-details)
12+
6. [Uses](#uses)
13+
7. [Training Details](#training-details)
14+
8. [Evaluation](#evaluation)
15+
9. [Citations](#citations)
16+
10. [Contact](#model-card-contact)
17+
18+
## How to Fork and Clone the Repository
19+
20+
If you want to work on this repository or make changes follow the instructions provided below.
21+
22+
### Step 1: Fork the Repository
23+
To fork the repository to your GitHub account:
24+
25+
1. Go to the [Geophysical Foundation Model repository page](https://github.com/thinkonward/geophysical-foundation-model).
26+
2. Click the "Fork" button located at the top right corner of the repository.
27+
28+
### Step 2: Clone the Forked Repository
29+
Once you have forked the repository, you can clone it to your local machine.
30+
31+
1. Open a terminal or command prompt.
32+
2. Navigate to the directory where you want to store the cloned repository.
33+
3. Run the following command to clone the forked repository (remember to change yourusername to your actual GitHub username):
34+
35+
```bash
36+
git clone git@github.com:yourusername/geophysical-foundation-model.git
37+
```
38+
39+
### Step 3: Change into the newly cloned directory:
40+
41+
```bash
42+
cd geophysical-foundation-model
43+
```
44+
45+
### Step 4: Create a new branch
46+
47+
Before making changes to the repository, it’s a good practice to create a new branch for your work. This keeps your main codebase clean and organized.
48+
49+
1. Create a new branch using the following command. Replace `feature-my-feature` with your desired branch name:
50+
51+
```bash
52+
git checkout -b feature-my-feature
53+
```
54+
55+
2. Now you are working on a separate branch and can make changes without affecting the main codebase.
56+
57+
## Getting Started
58+
59+
Now that you have forked and cloned the repository to your local machine and have created a new branch, you can start exploring the contents.
60+
61+
### Directory Structure
62+
The project is organized as follows:
63+
- `GFM/`: Contains model architecture.
64+
- `src_imgs/`: images used in the repository.
65+
- `Tutorial/`: A Jupyter notebook to get you started with the model.
66+
- `README.md`: This file.
67+
- `LICENSE`: The open source license file.
68+
- `requirements.txt`: Dependencies for the model.
69+
70+
## Running the Model
71+
72+
1. Ensure you have Python (>3.10) installed on your system.
73+
2. Start from the `geophysical-foundation-model` directory in the terminal.
74+
3. Create a new virtual environment
75+
```bash
76+
conda create -n geophysics python=3.10
77+
```
78+
3. After creation, activate the newly created environment:
79+
80+
```bash
81+
conda activate geophysics
82+
```
83+
4. Install the required dependencies by running:
84+
85+
```bash
86+
pip install -r requirements.txt
87+
```
88+
5. Start up a Jupyterlab notebook and get started with the tutorial in the `Tutorial` directory. To start a notebook server from the terminal run
89+
90+
```bash
91+
jupyter lab
92+
```
93+
94+
And open `Tutorial/GFM_webinar.ipynb` to learn more about data processing.
95+
96+
97+
6. For advanced users, you can download the model weights from HuggingFace and load them into an instance of the model in Python after you have requested access on HuggingFace.
98+
99+
```python
100+
from huggingface_hub import snapshot_download
101+
MODEL_REPO_ID = "thinkonward/geophysical-foundation-model"
102+
snapshot_download(repo_id=MODEL_REPO_ID, repo_type="model", local_dir="./gfm-weights")
103+
# assuming you are in the `geophysical-foundation-model` directory
104+
from GFM import ElasticViTMAE
105+
model = ElasticViTMAE.ElasticViTMAE()
106+
107+
```
108+
109+
## Contributing
110+
111+
We welcome contributions from anyone interested in improving this project! To contribute to the model use the following steps:
112+
113+
1. Fork the repository.
114+
2. Create a new branch for your changes:
115+
116+
```bash
117+
git checkout -b feature/my-feature
118+
```
119+
120+
3. Make your changes and commit them:
121+
122+
```bash
123+
git add .
124+
git commit -m "Add my feature"
125+
```
126+
127+
4. Push your changes to your forked repository:
128+
129+
```bash
130+
git push origin feature/my-feature
131+
```
132+
133+
5. Create a pull request from your forked repository back to the original repository.
134+
135+
Thank you for contributing to the Geophysical Foundation Model
15136

16-
This is a model based on [Meta's ViTMAE model](https://huggingface.co/facebook/vit-mae-base), with some modifications to the masking technique. The Geophyiscal Foundation Model, or GFM for short, uses the ViT architecture with masking on traces in 2D seismic images, rather than patches.
17137

18138
## Model Details
19139

@@ -23,7 +143,7 @@ ThinkOnward's Geophysical Foundation Model is a pre-trained a Vision Transformer
23143
of seismic interpolation. We use 50 3D seismic volumes from the Patch the Planet Challenge, hosted by ThinkOnward as our benchmark hold-out dataset. **Using a Structural Similarity Index Metric (SSIM) to
24144
compare results we document the Geophysical Foundation Model is 2-3 times better than Shang et al. (2023), and similar to Lasscock et al. (2024).**
25145

26-
- **Developed by:** Ognjen Tanovic and Mike McIntire of ThinkOnward (Shell Portfolio Company)
146+
- **Developed by:** Ognjen Tanovic and Mike McIntire of ThinkOnward
27147
- **Model type:** MAE
28148
- **License:** Apache 2.0
29149
- **Based on:** facebook/vit-mae-base
@@ -58,26 +178,6 @@ Downstream tasks include:
58178

59179
The backbone of this model was trained using 3D seismic data from the Patch the Planet Challenge hosted by ThinkOnward. Use of this model on anything outside of seismic data, or similar technologies would be out-of-scope and likely have poor performance.
60180

61-
## How to Get Started with the Model
62-
63-
You can load the model using:
64-
65-
```python
66-
import torch
67-
from huggingface_hub import hf_hub_download
68-
69-
# For root directory
70-
model_path = hf_hub_download("thinkonward/geophysical-foundation-model", "elasticvitmae.bin")
71-
72-
ElasticVitMAE = torch.load(model_path)
73-
```
74-
75-
Once the mode architecture has been defined, you can use `.from_pretrained()` to extract weights!
76-
77-
```python
78-
model = ElasticViTMAE.from_pretrained("thinkonward/geophysical-foundation-model")
79-
```
80-
81181
## Training Details
82182

83183
### Training Data

Tutorial/GFM_webinar.ipynb

Lines changed: 211 additions & 49 deletions
Large diffs are not rendered by default.

requirements.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
huggingface_hub==0.26.2
2+
matplotlib==3.9.2
3+
numpy==2.1.3
4+
pandas==2.2.3
5+
scikit-image
6+
timm==1.0.11
7+
torch==2.5.1
8+
jupyterlab==4.2.5
9+
ipykernel==6.29.5
10+
ipython==8.29.0
11+
ipywidgets==8.1.5
12+
jupyter==1.1.1
13+
jupyter-console==6.6.3
14+
jupyter-events==0.10.0
15+
jupyter-lsp==2.2.5
16+
jupyter_client==8.6.3
17+
jupyter_core==5.7.2
18+
jupyter_server==2.14.2
19+
jupyter_server_terminals==0.5.3
20+
jupyterlab==4.2.5
21+
jupyterlab_pygments==0.3.0
22+
jupyterlab_server==2.27.3
23+
jupyterlab_widgets==3.0.13
24+
pyarrow==17.0.0

src_imgs/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)