--- license: mit library_name: glucofm tags: - cgm - glucose - foundation-model - jepa - onnx - safetensors - gguf - rlxp - healthcare pipeline_tag: feature-extraction --- # GlucoFM encoder weights Frozen **encoder-only** checkpoints for [GlucoFM](https://arxiv.org/abs/2605.30865) (dual-stream CGM foundation model), converted for the Rust [`glucofm`](https://crates.io/crates/glucofm) / RLX stack. > **Not medical advice.** Research reimplementation. Official Google GlucoFM > weights are not public. This package redistributes / converts a community > OpenCGM reconstruction. ## Files | File | Format | Notes | |------|--------|-------| | `glucofm_encoder.safetensors` | F32 safetensors | **Preferred** for `glucofm` load / train warm-start | | `glucofm_encoder.f16.safetensors` | F16 safetensors | ~2× smaller disk | | `glucofm_encoder.rlxp` | RLX package F32 | Flat mmap weight-only pack (`rlxp` / `infer` feature) | | `glucofm_encoder.f16.rlxp` | RLX package F16 | ~2× smaller RLXP | | `glucofm_encoder.f32.gguf` | GGUF F32 | Lossless GGUF dump | | `glucofm_encoder.f16.gguf` | GGUF F16 | Smaller disk; dequantized at load | | `glucofm_encoder.q8.gguf` | GGUF Q8_0 | ~4× smaller than F32; dequantized at load | | `glucofm_encoder.bin` | Native `GLFM` v1 | Compact glucofm-native dump | | `glucofm_encoder.onnx` | ONNX opset 17 | Upstream OpenCGM export (raw grid → 128-d embedding) | | `glucofm_encoder.onnx.meta.json` | JSON | Upstream export metadata | | `config.json` | JSON | Geometry + param counts for this package | | `SHA256SUMS` | text | Integrity checks | **Encoder params in weight files:** 435,505 (OpenCGM ONNX tensors). `online/mask_token` (128) is omitted upstream; `glucofm` inference defaults it to zeros. Full encoder including `mask_token` + `online/gaussian.rho`: **435,633**. Paper full trainable target (encoder + JEPA heads): **732,593**. ## Geometry | Symbol | Value | |--------|------:| | Grid `L` | 288 (5 min) | | Patches `P` | 24 | | Patch len `K` | 12 | | Hidden `D` | 128 | | Stream `S` | 64 | ## Provenance - Upstream community encoder: [`sfourdrinier/opencgm-stateevent`](https://huggingface.co/sfourdrinier/opencgm-stateevent) - OpenCGM project: [sfourdrinier/opencgm](https://github.com/sfourdrinier/opencgm) - Paper: [arXiv:2605.30865](https://arxiv.org/abs/2605.30865) - Conversion via `glucofm` `convert_weights --all` (ONNX → safetensors / GGUF / RLXP / `.bin`) Upstream ONNX meta (epoch 40 seed 17, raw stats, circadian, learnable σ) is kept in `glucofm_encoder.onnx.meta.json`. ## Use with `glucofm` ```bash cargo run --release --features infer --example infer -- \ --weights /path/to/glucofm_encoder.safetensors # RLXP (same feature set) cargo run --release --features infer --example infer -- \ --weights /path/to/glucofm_encoder.rlxp cargo run --release --features hub --example train_from_hub -- \ --weights /path/to/glucofm_encoder.safetensors --steps 50 ``` ```rust,ignore use glucofm::prelude::*; let mut model = GlucoFm::for_inference(GlucoFmConfig::default(), InferOptions::default(), &mut rng)?; model.load_weights_path("glucofm_encoder.rlxp")?; // or .safetensors / .gguf / .bin let emb = model.encode_embedding_day(&day, &mut rng)?; // [128] ``` ## Formats - Prefer **safetensors** or **RLXP F32** for numeric fidelity with RLX `Param` graphs. - **GGUF** / **RLXP F16** are for disk savings; runtime still uses dense F32/F16 params after load (no in-graph Q8 matmul). ## License Weights and packaging in this repository: **MIT** (see `LICENSE`). Upstream OpenCGM / paper licenses may impose additional terms on the original checkpoints — review those projects before commercial use.