Downloads · 30 days
0
johnamcruz/futures-foundation-model
futures-foundation-model is a machine learning model from johnamcruz. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A pretrained transformer backbone for futures market structure and regime classification. Trained on ~2.3M bars across 6 instruments (Oct 2020 – Apr 2026).
Downloads · 30 days
0
Access
Public
Updated Apr 30, 2026
Repo size
26.9 MB
Likes
0
Public
Click a slice to open those files.
.pt26.9 MB · 100%
From the Hugging Face model README
A pretrained transformer backbone for futures market structure and regime classification. Trained on ~2.3M bars across 6 instruments (Oct 2020 – Apr 2026).
| File | Description |
|---|---|
best_backbone.pt | Backbone weights only (no pretraining heads) — use for fine-tuning |
best_pretrained.pt | Backbone + 4 frozen context heads (regime/vol/structure/range) — recommended for fine-tuning with context heads |
pip install git+https://github.com/johnamcruz/Futures-Foundation-Model.git
from huggingface_hub import hf_hub_download
from futures_foundation import FFMConfig, FFMBackbone
# Download weights
path = hf_hub_download(repo_id="johnamcruz/futures-foundation-model", filename="best_pretrained.pt")
config = FFMConfig()
backbone = FFMBackbone(config)
backbone.load_pretrained(path)
embeddings = backbone(features_tensor) # (batch, 256)
from futures_foundation.finetune import StrategyLabeler, TrainingConfig, run_walk_forward
class MyStrategyLabeler(StrategyLabeler):
@property
def name(self): return 'my_strategy'
@property
def feature_cols(self): return ['zone_height', 'entry_depth', 'risk_norm']
def run(self, df_raw, ffm_df, ticker):
features_df, labels_df = my_signal_logic(df_raw, ffm_df)
return features_df, labels_df
See the full documentation for the complete fine-tuning framework.
The pretrained checkpoint includes 4 frozen context heads that expose explicit market state at inference:
| Head | Classes | Output |
|---|---|---|
| Regime | Trending Up / Trending Down / Rotational / Volatile | 4-dim softmax |
| Volatility | Low / Normal / Elevated / Extreme | 4-dim softmax |
| Structure | Bullish / Bearish | 2-dim softmax |
| Range Position | 5 quintiles | 5-dim softmax |
These 15 dimensions are concatenated into the fusion layer during fine-tuning, giving the signal head named handles on market state without relying on implicit encoding.
Apache 2.0