Instructions to use guan-wang/ESM-FineWeb-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use guan-wang/ESM-FineWeb-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="guan-wang/ESM-FineWeb-1B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("guan-wang/ESM-FineWeb-1B", trust_remote_code=True) model = AutoModelForMaskedLM.from_pretrained("guan-wang/ESM-FineWeb-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add standard Transformers model export
Browse files
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- esm
|
| 5 |
+
- energy-based-language-model
|
| 6 |
+
- custom-architecture
|
| 7 |
+
pipeline_tag: fill-mask
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# ESM-FineWeb-1B
|
| 11 |
+
|
| 12 |
+
OpenESM 1B model (variant d26) trained on
|
| 13 |
+
FineWeb. This repository contains a Hugging Face Transformers-compatible
|
| 14 |
+
export for the pretraining checkpoint. It uses OpenESM's custom architecture
|
| 15 |
+
and remote model code; it is not the built-in `transformers.EsmModel`
|
| 16 |
+
architecture.
|
| 17 |
+
|
| 18 |
+
## How to Use
|
| 19 |
+
|
| 20 |
+
Install the runtime dependencies:
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
pip install torch transformers
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Load the tokenizer and model with the custom OpenESM code enabled:
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import torch
|
| 30 |
+
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
| 31 |
+
|
| 32 |
+
repo_id = "guan-wang/ESM-FineWeb-1B"
|
| 33 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 34 |
+
model = AutoModelForMaskedLM.from_pretrained(
|
| 35 |
+
repo_id,
|
| 36 |
+
trust_remote_code=True,
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 40 |
+
model.to(device)
|
| 41 |
+
inputs = tokenizer("Hello world", return_tensors="pt").to(device)
|
| 42 |
+
with torch.inference_mode():
|
| 43 |
+
outputs = model(**inputs)
|
| 44 |
+
|
| 45 |
+
print(outputs.logits.shape)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
The first load may prompt you to review and allow the repository's custom model
|
| 49 |
+
code. Loading remote Python code requires `trust_remote_code=True`.
|
| 50 |
+
|
| 51 |
+
## Model Details
|
| 52 |
+
|
| 53 |
+
| Detail | Value |
|
| 54 |
+
| --- | --- |
|
| 55 |
+
| Model family | OpenESM energy-based language model |
|
| 56 |
+
| Architecture | Custom OpenESM implementation (d26) |
|
| 57 |
+
| Parameter scale | 1B |
|
| 58 |
+
| Training dataset | FineWeb |
|
| 59 |
+
| Training stage | pretraining |
|
| 60 |
+
| Transformer blocks | 26 |
|
| 61 |
+
| Embedding dimension | 1664 |
|
| 62 |
+
| Attention heads | 13 |
|
| 63 |
+
| Context length | 2048 |
|
| 64 |
+
| Vocabulary size | 32768 |
|
| 65 |
+
|
| 66 |
+
The parameter scale is the label used for this model in the OpenESM model
|
| 67 |
+
configuration. The architecture and sequence settings above are read from the
|
| 68 |
+
exported checkpoint configuration.
|
| 69 |
+
|
| 70 |
+
## Files
|
| 71 |
+
|
| 72 |
+
- `config.json`: model configuration.
|
| 73 |
+
- `model*.safetensors`: model weights in the standard Transformers format.
|
| 74 |
+
- `modeling_esm.py`: remote model and tokenizer implementation.
|
| 75 |
+
- `configuration_esm.py`: remote configuration implementation.
|
| 76 |
+
- `tokenizer.pkl`: serialized ESM tokenizer.
|
| 77 |
+
- `tokenizer_config.json`: tokenizer auto-loading configuration.
|
| 78 |
+
- `token_bytes.pt`: token byte table used by OpenESM metrics.
|
| 79 |
+
|
| 80 |
+
The original Lightning `.ckpt` is converted before upload and is not needed to
|
| 81 |
+
load this repository. Training token counts are intentionally omitted from the
|
| 82 |
+
repository name and file names.
|
| 83 |
+
|
| 84 |
+
## Checkpoint Metadata
|
| 85 |
+
|
| 86 |
+
# ebm-fineweb-d26-7b
|
| 87 |
+
|
| 88 |
+
EBM pretrained on FineWeb; d26, 7B.
|
| 89 |
+
|
| 90 |
+
This repository contains the following PyTorch checkpoint:
|
| 91 |
+
|
| 92 |
+
- Archive filename: `final-s=step=6999-d26-ctx2048.ckpt`
|
| 93 |
+
- Original filename: `periodic-s=step=6999-d26-ctx2048.ckpt`
|
| 94 |
+
- Original relative path: `pretrain/ebm/fineweb/d26/7B/periodic-s=step=6999-d26-ctx2048.ckpt`
|
| 95 |
+
|
| 96 |
+
The checkpoint is uploaded as-is from the local training output. See the filename and training project for the exact architecture and loading code.
|
| 97 |
+
|
| 98 |
+
## License
|
| 99 |
+
|
| 100 |
+
Please add the applicable model/data license before publishing this repo.
|
| 101 |
+
|
| 102 |
+
The code is maintained in the [OpenESM repository](https://github.com/datamllab/openesm).
|