--- license: other library_name: pytorch tags: - pytorch - safetensors - language-model - tensionlm --- # TensionLM-Phase2-TSNative Public route: [TS-Start-Here](https://github.com/BoggersTheFish/TS-Start-Here) -> [TS-Reasoner-v0](https://github.com/BoggersTheFish/TS-Reasoner-v0) -> [TensionLM](https://github.com/BoggersTheFish/TensionLM). `BoggersTheFish/TensionLM-Phase2-TSNative` is a PyTorch language-model checkpoint from the TensionLM series by BoggersTheFish. This repository has been updated so the model weights are available in the `safetensors` format as `model.safetensors`. ## What changed in this migration The original repository stored its model weights in `pytorch_model.pt`, a PyTorch pickle-backed checkpoint. That file has been converted to `model.safetensors` using `safetensors.torch.save_file` after loading the checkpoint on CPU with PyTorch. The conversion preserves tensor names, tensor shapes, dtypes, and values from the model state dictionary. Safetensors is preferred for distribution because it is a data-only tensor container. Unlike pickle-backed PyTorch checkpoints, loading a safetensors file does not execute arbitrary Python code. It is also friendly to memory mapping and fast metadata inspection. ## Files - `model.safetensors` - converted model state dictionary in safetensors format. - `pytorch_model.pt` - original PyTorch checkpoint retained for compatibility with older local loading code. - `config.json` - architecture and training/configuration metadata supplied with the original repository. - `tokenizer.json` - tokenizer supplied with the original repository. ## Conversion details - Conversion date: 2026-04-29 - Source checkpoint: `pytorch_model.pt` - Safetensors output: `model.safetensors` - Tensor count: 76 - Total parameters: 21,962,502 - Source SHA256: `47cf3802b0266dbe637784630c482b6d8a10a864019a6c9df621fe6291ef8704` - Safetensors SHA256: `4c7d2196921fa29d8632fa6017a85e6d287fe47df4e6a0471e1a8a342ac746a5` The converted file was validated locally by reloading `model.safetensors` and checking every tensor against the original PyTorch state dictionary with exact tensor equality. If the original PyTorch checkpoint used shared tensor storage for tied weights, those state-dictionary entries are materialized as separate tensors in the safetensors file because raw safetensors state dictionaries do not encode Python storage aliasing. The matching model implementation should still apply its normal weight tying after `load_state_dict`. ## Tension heatmap The image below is an average causal tension-field heatmap rendered from this safetensors checkpoint with the prompt: `If all mammals are warm blooded and all whales are mammals then` Rows are target tokens whose hidden states are being constrained. Columns are earlier source tokens contributing those constraints. Brighter cells indicate larger mean τ values averaged across layers and heads. This is not a softmax attention map: source positions do not compete for one probability mass, so multiple prior tokens can remain bright for the same target token. ![Average causal tension heatmap](docs/tension_heatmap.png) ## Public runner Use the canonical TensionLM repo for a public loading smoke test: ```bash python3 scripts/run_public_tensionlm.py \ --repo-id BoggersTheFish/TensionLM-Curriculum-13M \ --prompt "If all mammals are animals and all whales are mammals then" ``` This checkpoint is raw research infrastructure, not an instruction-tuned assistant. Output quality is limited; the public claim is that the checkpoint can be loaded and inspected. ## Loading the weights This repository contains a raw PyTorch state dictionary rather than a fully packaged Transformers model class. Load the safetensors file into the matching TensionLM model implementation used to train the checkpoint. ```python from safetensors.torch import load_file state_dict = load_file("model.safetensors") model.load_state_dict(state_dict) model.eval() ``` If your existing code expects `pytorch_model.pt`, keep using it until your loader is updated. For new code, prefer `model.safetensors`. ## Tokenizer The repository includes `tokenizer.json`. Use the same tokenizer that was used during training to avoid token/id mismatches at inference time. ## Security note The safetensors file is the recommended artifact for downstream users. PyTorch `.pt`, `.pth`, and `.bin` checkpoints are pickle-backed and should only be loaded from trusted sources. ## Intended use This checkpoint is intended for experimentation, research, and continuation of the TensionLM project. Users should evaluate behavior carefully before using generated text in production or user-facing systems. ## Limitations The repository does not include a complete model implementation in a standard Transformers package layout. Consumers need the compatible TensionLM model code and the included tokenizer/config files to run inference correctly.