deepduoduo commited on
Commit
9fa5716
Β·
0 Parent(s):

S-PLM-TM weights: backbone, TM head, EC head, alignment head

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ S-PLM-TM
2
+ ========
3
+
4
+ Copyright (c) 2026 Xudong Lab, University of South Florida. All rights reserved.
5
+
6
+ Required Notice: Copyright (c) 2026 Xudong Lab, University of South Florida - S-PLM-TM
7
+
8
+ Licensed under the PolyForm Noncommercial License 1.0.0 (full text below).
9
+ In short: you may use, copy, modify and redistribute this work for any
10
+ NONCOMMERCIAL purpose -- academic research, teaching, and work at non-profit,
11
+ educational, public-research or government institutions -- provided you keep
12
+ this notice. COMMERCIAL USE IS NOT GRANTED by this license; contact the authors
13
+ to discuss commercial terms.
14
+
15
+ WHAT THIS LICENSE COVERS
16
+ ------------------------
17
+ code/ this release's API and the model definition code
18
+ models/ the backbone checkpoint, TM head, EC head and align head weights
19
+ reproduce/ the reproduction scripts and their recorded results
20
+ README.md, models/MODEL_CARD.md and the other documentation in this tree
21
+
22
+ WHAT IT DOES NOT COVER (third-party material, under its own terms)
23
+ ------------------------------------------------------------------
24
+ reproduce/ec_deer_figure7/data/
25
+ DEER's Figure 7 benchmark data (Liu et al., Cell Host & Microbe 2026).
26
+ Licensed by its authors under the Apache License 2.0 -- a permissive
27
+ license that we cannot and do not restrict. Those files remain under
28
+ Apache-2.0 for everyone, including commercial users. See that directory's
29
+ LICENSE.DEER and README.md.
30
+
31
+ pfam_data/Pfam-A.clans.tsv
32
+ Pfam data (Pfam release 36.0), released by the Pfam consortium under
33
+ CC0 1.0 (public domain). Redistributed here unchanged; it is NOT covered
34
+ by the noncommercial terms above and remains CC0 for everyone, including
35
+ commercial users. Cite: Mistry, J. et al. Nucleic Acids Res. 49,
36
+ D412-D419 (2021).
37
+
38
+ PfamScan and the Pfam-A HMM library
39
+ Not bundled, on purpose. PfamScan (pfam_scan.pl) is GPL-2.0-or-later, so
40
+ bundling it would pull GPL code into this package; the HMM library is
41
+ 300 MB. code/scripts/setup_pfam.sh downloads both on demand into
42
+ pfam_data/, where they stay under their own licenses.
43
+
44
+ The ProtT5-XL encoder (Rostlab/prot_t5_xl_uniref50), which the backbone is
45
+ built on, is fetched at run time and is not redistributed here. The
46
+ ProtTrans project is MIT-licensed.
47
+
48
+ IF YOU USE THIS WORK, ACKNOWLEDGE IT
49
+ ------------------------------------
50
+ Cite the S-PLM-TM paper (see README.md) in any publication, preprint, poster or
51
+ report whose results depend on this software or these weights.
52
+
53
+ IF YOU MODIFY IT
54
+ ----------------
55
+ You may. Please mark your changes clearly and do not present a modified version
56
+ as the official S-PLM-TM, so that published numbers stay traceable to a known
57
+ version. Neither the name "S-PLM", the University of South Florida, nor the names
58
+ of the authors may be used to endorse or promote products derived from this
59
+ software without specific prior written permission.
60
+
61
+ --------------------------------------------------------------------------------
62
+
63
+ PolyForm Noncommercial License 1.0.0
64
+
65
+ https://polyformproject.org/licenses/noncommercial/1.0.0
66
+
67
+
68
+ Acceptance
69
+
70
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
71
+
72
+
73
+ Copyright License
74
+
75
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to Distribution License and make changes or new works based on the software according to Changes and New Works License.
76
+
77
+
78
+ Distribution License
79
+
80
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by Changes and New Works License.
81
+
82
+
83
+ Notices
84
+
85
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with Required Notice: that the licensor provided with the software. For example:
86
+
87
+ Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
88
+
89
+
90
+ Changes and New Works License
91
+
92
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
93
+
94
+
95
+ Patent License
96
+
97
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
98
+
99
+
100
+ Noncommercial Purposes
101
+
102
+ Any noncommercial purpose is a permitted purpose.
103
+
104
+
105
+ Personal Uses
106
+
107
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
108
+
109
+
110
+ Noncommercial Organizations
111
+
112
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
113
+
114
+
115
+ Fair Use
116
+
117
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
118
+
119
+
120
+ No Other Rights
121
+
122
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
123
+
124
+
125
+ Patent Defense
126
+
127
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
128
+
129
+
130
+ Violations
131
+
132
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
133
+
134
+
135
+ No Liability
136
+
137
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
138
+
139
+
140
+ Definitions
141
+
142
+ The licensor is the individual or entity offering these terms, and the software is the software the licensor makes available under these terms.
143
+
144
+ You refers to the individual or entity agreeing to these terms.
145
+
146
+ Your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. Control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
147
+
148
+ Your licenses are all the licenses granted to you for the software under these terms.
149
+
150
+ Use means anything you do with the software requiring one of your licenses.
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: polyform-noncommercial-1.0.0
4
+ license_link: https://polyformproject.org/licenses/noncommercial/1.0.0
5
+ library_name: pytorch
6
+ tags:
7
+ - protein-language-model
8
+ - protein
9
+ - biology
10
+ - remote-homology
11
+ - structure-aware
12
+ - retrieval
13
+ ---
14
+
15
+ # S-PLM-TM β€” model weights
16
+
17
+ Structure-aware protein sequence embeddings. One sequence in, a 1024-d vector out,
18
+ in three flavours β€” plus a residue-level head for alignment.
19
+
20
+ **These are the weights only.** The code, model cards and reproduction scripts live in
21
+ the GitHub repository: `https://github.com/duolinwang/S-PLM-TM`
22
+
23
+ > ⚠️ **Noncommercial license.** Academic, teaching and nonprofit/educational/
24
+ > public-research/government use is granted; **commercial use is not**.
25
+ > Full text: **`LICENSE` in this repository** (PolyForm Noncommercial 1.0.0).
26
+ > Cite the paper if you use this.
27
+ >
28
+ > The weights are public, but **the code repository is currently private** while the
29
+ > paper is under preparation β€” the GitHub links below will 404 unless you have access.
30
+ > Ask the authors if you need it before then.
31
+
32
+ ## What's here
33
+
34
+ | File | Size | What it is |
35
+ |---|---|---|
36
+ | `backbone/splm_tm_backbone.pth` | 2.2 GB | The encoder. **Slim archive** β€” the frozen ProtT5-XL trunk is *not* included; it is fetched by `from_pretrained` at run time |
37
+ | `tm_head/tm_calib_head.pt` | 12 MB | TM calibration head β†’ `emb_tm`, L2-normalised, inner product β‰ˆ predicted TM-score |
38
+ | `ec_head/ec_head.pt` | 8.4 MB | EC retrieval head β†’ `emb_ec`. ⚠️ It consumes `emb_h` (TM head output), **not** `emb_raw` |
39
+ | `align_head/align_head.pt` | 17 MB | Residue-level alignment head. Consumes per-residue features, **not** a pooled vector |
40
+
41
+ The architecture YAML is **not** here β€” it is text, so it lives in git (`models/backbone/` in the GitHub repo) where it has a history and a visible diff. Keeping a second copy here would let the two drift apart silently.
42
+
43
+ Every head is **paired with this exact backbone checkpoint**. Swapping the checkpoint
44
+ without swapping the heads produces silently meaningless vectors.
45
+
46
+ ## Quick start
47
+
48
+ ```bash
49
+ git clone https://github.com/duolinwang/S-PLM-TM.git && cd S-PLM-TM
50
+ pip install -r requirements.txt
51
+ hf download deepduoduo/S-PLM-TM --local-dir models/
52
+
53
+ python code/scripts/embed.py --fasta my.fasta --modes raw tm ec --out out.npz
54
+ ```
55
+
56
+ ```python
57
+ d = np.load("out.npz", allow_pickle=True)
58
+ d["emb_raw"] # [N,1024] pre-projector, unnormalised β€” use this to train downstream models
59
+ d["emb_tm"] # [N,1024] L2-normalised β€” structure / remote-homology retrieval
60
+ d["emb_ec"] # [N,1024] L2-normalised β€” EC / functional retrieval
61
+ ```
62
+
63
+ The three are **chained, not parallel**:
64
+
65
+ ```
66
+ sequence --backbone--> emb_raw --TM head--> emb_tm (= emb_h) --EC head--> emb_ec
67
+ ```
68
+
69
+ so `--modes ec` pulls `tm` in automatically, and one forward pass gives you all three.
70
+
71
+ ## Things that will bite you
72
+
73
+ 1. **Output is 1024-d, not 1280.** A 1280-d vector means the backbone was built as
74
+ ESM-2 by mistake.
75
+ 2. **Embedding defaults to full sequences.** Set `--max-length N` to truncate;
76
+ `0` also disables truncation. Some published numbers (the EC head's DEER
77
+ Figure-7 results) were measured with **`--max-length 1024`**. Match that setting
78
+ before comparing.
79
+ 3. **"Skipped 196 frozen trunk tensors" on load is normal** β€” that is the slim archive
80
+ working as intended; those tensors come from `from_pretrained`.
81
+ 4. **`emb_ec` is not an EC-number prediction.** The EC head is a *retrieval* head
82
+ trained with a triplet loss; there are no class logits and no probabilities.
83
+ 5. ProtT5-XL (~11 GB) is downloaded on first use. Set `HF_HOME` to somewhere with
84
+ space before running on a cluster.
85
+
86
+ ## Verify your download
87
+
88
+ md5 checksums for every file are in `models/DOWNLOAD.md` in the GitHub repo.
89
+ The numbers reported in `models/MODEL_CARD.md` were measured with exactly these files.
90
+
91
+ ## Reproducibility
92
+
93
+ `reproduce/ec_deer_figure7/` in the GitHub repo reproduces the EC head's published
94
+ DEER Figure-7 numbers end to end (re-encoding all 4,303 sequences from FASTA, not
95
+ reusing cached embeddings). Verified bit-for-bit: hit counts 222/323/378 and all 90
96
+ per-family recall values identical to the reference.
97
+
98
+ ## Citation
99
+
100
+ See the GitHub repository's README for the paper citation.
align_head/align_head.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:537ae5ed34c914323d35ce06bcd9ade46c5196d71c07192ece48921f9b3b949c
3
+ size 16792312
align_head/alternatives/align_head_published_table.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec9fb93ea1b7f7fee67a3fdb383f171406dce8a5869c37c55c02a1c60dcf24aa
3
+ size 8399616
backbone/splm_tm_backbone.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56468bd77610a05e8541869ef5bedc5f706b4ae9796b017397b7f4269e4af50e
3
+ size 2343711180
ec_head/ec_head.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fa9e7bdead2c8baa53ad2361f2e61b6ddd7e224a7e06601d00950644f356a80
3
+ size 8407402
tm_head/tm_calib_head.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3351228f36ea3d920c9d9ac409470116e99976a660873999d8c06ff93d5641fb
3
+ size 12597452