Release original SeisLM encoder with MIT license and verified portable weights
Browse files- LICENSE +21 -0
- README.md +100 -0
- config.json +70 -0
- manifest.json +12 -0
- model.safetensors +3 -0
- preprocessing.json +10 -0
- seislm-0.2.0-py3-none-any.whl +0 -0
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 Tianlin Liu
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: seislm
|
| 4 |
+
pipeline_tag: feature-extraction
|
| 5 |
+
tags:
|
| 6 |
+
- seismology
|
| 7 |
+
- seismic-waveforms
|
| 8 |
+
- self-supervised-learning
|
| 9 |
+
- arxiv:2410.15765
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# SeisLM base
|
| 13 |
+
|
| 14 |
+
Pretrained seismic waveform encoder from [SeisLM: a Foundation Model for
|
| 15 |
+
Seismic Waveforms](https://arxiv.org/abs/2410.15765).
|
| 16 |
+
Code and installation: https://github.com/liutianlin0121/seisLM
|
| 17 |
+
|
| 18 |
+
This is an encoder with the original self-supervised pretraining heads. It
|
| 19 |
+
does **not** include a trained phase-picking or earthquake-detection head.
|
| 20 |
+
Downstream adaptation is needed for those tasks. It is not a Transformers
|
| 21 |
+
AutoModel artifact or a hosted inference endpoint.
|
| 22 |
+
|
| 23 |
+
## Architecture and provenance
|
| 24 |
+
|
| 25 |
+
- Parameters (including pretraining heads): 11,359,568
|
| 26 |
+
- Transformer layers: 6
|
| 27 |
+
- Contextual feature dimension: 240
|
| 28 |
+
- Original checkpoint SHA-256: `6e97c53c562e9ba6bc96df85d8d208b89ff84e80a25468825f29bb5bace5eacb`
|
| 29 |
+
- Export: unchanged state tensors in safetensors plus the architecture
|
| 30 |
+
configuration embedded in the original checkpoint. Optimizer state omitted.
|
| 31 |
+
- Training sources recorded in the original checkpoint: ETHZ, GEOFON, STEAD,
|
| 32 |
+
MLAAPDE, InstanceCounts, Iquique, PNW, OBST2024.
|
| 33 |
+
|
| 34 |
+
## Input and output
|
| 35 |
+
|
| 36 |
+
Inputs: float32 tensors `[batch, 3, samples]`, components **ZNE**, **100 Hz**.
|
| 37 |
+
Reference window: 3001 samples. Demean each component, then divide by its
|
| 38 |
+
population standard deviation plus `1e-10` (replace zero standard deviation
|
| 39 |
+
by 1). No automatic resampling, filtering, or component filling is performed.
|
| 40 |
+
See `preprocessing.json` for the contract and missing-component caveat.
|
| 41 |
+
|
| 42 |
+
Contextual features have shape `[batch, reduced_time, 240]`.
|
| 43 |
+
For 3001 input samples, reduced_time is 749. These are features, not P/S picks.
|
| 44 |
+
|
| 45 |
+
## Loading
|
| 46 |
+
|
| 47 |
+
A compatible Python wheel is included so this release can be used before
|
| 48 |
+
the source changes are merged or published to PyPI. Install with Python 3.11/3.12:
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
python -m pip install "https://huggingface.co/ltlltl2006/seislm-base/resolve/main/seislm-0.2.0-py3-none-any.whl"
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
For reproducible installation, replace `main` in the wheel URL with the reviewed
|
| 55 |
+
model-repository commit. For GPU-specific PyTorch installation, use the
|
| 56 |
+
[PyTorch selector](https://pytorch.org/get-started/locally/).
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
import torch
|
| 60 |
+
from seisLM import load_pretrained, encode
|
| 61 |
+
|
| 62 |
+
model = load_pretrained("ltlltl2006/seislm-base")
|
| 63 |
+
# Synthetic installation smoke example, not a scientific evaluation:
|
| 64 |
+
x = torch.randn(1, 3, 3001, generator=torch.Generator().manual_seed(2024))
|
| 65 |
+
x = x - x.mean(dim=-1, keepdim=True)
|
| 66 |
+
std = x.std(dim=-1, correction=0, keepdim=True)
|
| 67 |
+
x = x / (torch.where(std == 0, torch.ones_like(std), std) + 1e-10)
|
| 68 |
+
features = encode(model, x)
|
| 69 |
+
print(features.shape)
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Set `revision` to a published model-repository commit for repeatable downloads.
|
| 73 |
+
A local bundle directory also works offline.
|
| 74 |
+
|
| 75 |
+
## Refactoring regression check
|
| 76 |
+
|
| 77 |
+
The exported weights were compared with the original Lightning-loaded checkpoint
|
| 78 |
+
on fixed complete/noise/zero-channel inputs using CPU and NVIDIA GB10 CUDA,
|
| 79 |
+
PyTorch 2.14.1+cu130, Python 3.12.3. All eight checked fields (encoder features,
|
| 80 |
+
convolutional features, projected/quantized features, codebook perplexity, and
|
| 81 |
+
three masked-loss values) matched exactly, with maximum absolute error 0.
|
| 82 |
+
This is numerical parity on a regression fixture, not a downstream benchmark.
|
| 83 |
+
See the source repository's regression documentation for the protocol.
|
| 84 |
+
|
| 85 |
+
## Evaluation and limitations
|
| 86 |
+
|
| 87 |
+
The original paper evaluates fine-tuned task models, not this bare encoder.
|
| 88 |
+
The paper's downstream scores cannot be inferred from successful loading or
|
| 89 |
+
numerical parity of this artifact. Local adaptation and held-out evaluation
|
| 90 |
+
are needed before relying on predictions for a new region or instrument.
|
| 91 |
+
|
| 92 |
+
## License
|
| 93 |
+
|
| 94 |
+
These pretrained weights are released under the MIT license, as confirmed by
|
| 95 |
+
the author. See LICENSE. The code is also distributed under MIT.
|
| 96 |
+
|
| 97 |
+
## Citation
|
| 98 |
+
|
| 99 |
+
Tianlin Liu et al. (2024). SeisLM: a Foundation Model for Seismic Waveforms.
|
| 100 |
+
arXiv:2410.15765. https://doi.org/10.48550/arXiv.2410.15765
|
config.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format_version": 1,
|
| 3 |
+
"architecture": "MultiDimWav2Vec2ForPreTraining",
|
| 4 |
+
"model_config": {
|
| 5 |
+
"activation_dropout": 0.0,
|
| 6 |
+
"apply_spec_augment": true,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"codevector_dim": 256,
|
| 9 |
+
"contrastive_logits_temperature": 0.1,
|
| 10 |
+
"conv_bias": true,
|
| 11 |
+
"conv_dim": [
|
| 12 |
+
256,
|
| 13 |
+
256
|
| 14 |
+
],
|
| 15 |
+
"conv_embed": true,
|
| 16 |
+
"conv_kernel": [
|
| 17 |
+
3,
|
| 18 |
+
3
|
| 19 |
+
],
|
| 20 |
+
"conv_stride": [
|
| 21 |
+
2,
|
| 22 |
+
2
|
| 23 |
+
],
|
| 24 |
+
"diversity_loss_weight": 0.1,
|
| 25 |
+
"do_stable_layer_norm": true,
|
| 26 |
+
"feat_extract_norm": "layer",
|
| 27 |
+
"feat_proj_dropout": 0.0,
|
| 28 |
+
"feat_quantizer_dropout": 0.0,
|
| 29 |
+
"hidden_dropout": 0.0,
|
| 30 |
+
"hidden_size": 240,
|
| 31 |
+
"initializer_range": 0.02,
|
| 32 |
+
"input_dim": 3,
|
| 33 |
+
"intermediate_size": 3072,
|
| 34 |
+
"layer_norm_eps": 1e-05,
|
| 35 |
+
"layerdrop": 0.0,
|
| 36 |
+
"mask_feature_length": 10,
|
| 37 |
+
"mask_feature_min_masks": 0,
|
| 38 |
+
"mask_feature_prob": 0.0,
|
| 39 |
+
"mask_time_length": 10,
|
| 40 |
+
"mask_time_min_masks": 2,
|
| 41 |
+
"mask_time_prob": 0.65,
|
| 42 |
+
"num_attention_heads": 12,
|
| 43 |
+
"num_codevector_groups": 2,
|
| 44 |
+
"num_codevectors_per_group": 320,
|
| 45 |
+
"num_conv_pos_embedding_groups": 16,
|
| 46 |
+
"num_conv_pos_embeddings": 128,
|
| 47 |
+
"num_feat_extract_layers": 2,
|
| 48 |
+
"num_hidden_layers": 6,
|
| 49 |
+
"num_negatives": 100,
|
| 50 |
+
"output_attentions": false,
|
| 51 |
+
"output_hidden_size": 768,
|
| 52 |
+
"output_hidden_states": false,
|
| 53 |
+
"pad_token_id": 0,
|
| 54 |
+
"proj_codevector_dim": 256,
|
| 55 |
+
"rotary_pos_embed": false,
|
| 56 |
+
"scale_logits_in_quantization": true,
|
| 57 |
+
"use_rms_norm": false
|
| 58 |
+
},
|
| 59 |
+
"preprocessing": {
|
| 60 |
+
"sampling_rate_hz": 100,
|
| 61 |
+
"component_order": "ZNE",
|
| 62 |
+
"tensor_layout": "batch, component, sample",
|
| 63 |
+
"dtype": "float32",
|
| 64 |
+
"reference_window_samples": 3001,
|
| 65 |
+
"normalization": "per-component demean, divide by population std + 1e-10",
|
| 66 |
+
"zero_std": "replace zero std by 1 before division",
|
| 67 |
+
"missing_components": "Legacy training randomly copies a present component into missing channels. Supply complete components for deterministic inference; no filling is performed by the loader or encode()."
|
| 68 |
+
},
|
| 69 |
+
"source_checkpoint_sha256": "6e97c53c562e9ba6bc96df85d8d208b89ff84e80a25468825f29bb5bace5eacb"
|
| 70 |
+
}
|
manifest.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "base",
|
| 3 |
+
"repo_id": "ltlltl2006/seislm-base",
|
| 4 |
+
"files": {
|
| 5 |
+
"LICENSE": "bbb6bbefbbd4b4fe7d56e7cf9fa3a591e22b35a064eb4a8342fecc64fc02ed11",
|
| 6 |
+
"README.md": "4d1f4568254ffc9e6130dbcfc5080ab913b9f14ec9058ba69032d3b344f41f58",
|
| 7 |
+
"config.json": "ddebdc2bdc5483b4c3f927fece90ed5b9984c8754a90c0d5aff181a37ac4820a",
|
| 8 |
+
"model.safetensors": "327b726ed779bab9284dc6a9023d36fa1822a07c6a0a33ed6b25953f17599ce6",
|
| 9 |
+
"preprocessing.json": "571abfda3ae0734b0b561d70c4a613ae432291b890b45019881c452c4a06689d",
|
| 10 |
+
"seislm-0.2.0-py3-none-any.whl": "c04f262c1bddd26a5b1628a62614042a6492f862697e0c4f1546d7c17c242681"
|
| 11 |
+
}
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:327b726ed779bab9284dc6a9023d36fa1822a07c6a0a33ed6b25953f17599ce6
|
| 3 |
+
size 45452496
|
preprocessing.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"sampling_rate_hz": 100,
|
| 3 |
+
"component_order": "ZNE",
|
| 4 |
+
"tensor_layout": "batch, component, sample",
|
| 5 |
+
"dtype": "float32",
|
| 6 |
+
"reference_window_samples": 3001,
|
| 7 |
+
"normalization": "per-component demean, divide by population std + 1e-10",
|
| 8 |
+
"zero_std": "replace zero std by 1 before division",
|
| 9 |
+
"missing_components": "Legacy training randomly copies a present component into missing channels. Supply complete components for deterministic inference; no filling is performed by the loader or encode()."
|
| 10 |
+
}
|
seislm-0.2.0-py3-none-any.whl
ADDED
|
Binary file (85 kB). View file
|
|
|