GrimSqueaker commited on
Commit
ca9a8ca
·
verified ·
1 Parent(s): 66d7591

ProtSent-V2.5 150M: V2 + GOR + DMS CoSENT

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 640,
3
+ "pooling_mode": "mean",
4
+ "include_prompt": true
5
+ }
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_pooling_layer": false,
3
+ "architectures": [
4
+ "EsmModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "attn_backend": "sdpa",
8
+ "bos_token_id": 0,
9
+ "classifier_dropout": null,
10
+ "dtype": "float32",
11
+ "emb_layer_norm_before": false,
12
+ "eos_token_id": 2,
13
+ "esmfold_config": null,
14
+ "fastplms_checkpoint_hash": "c1d1ed6ec8cad4600e8b89bc023343fb9a67aa6b574cfbf6f46189c15478c159",
15
+ "fastplms_checkpoint_repo_id": "Synthyra/ESM2-150M",
16
+ "fastplms_checkpoint_revision": "979e0880dfc9e0c0080839b83d9d2dc05b92786a",
17
+ "fastplms_model_id": "esm2_150m",
18
+ "fastplms_release_tool_revision": "e6dd397a9ad368c998d714f6bd64d40b533d1ed1",
19
+ "fastplms_release_tool_sha256": "6d335c05aa49a232086a816deb25d248d1490529e5783acc3355b9bc6f03e0c2",
20
+ "fastplms_runtime_bundle_sha256": "f22353ef386f607784889dc303488a2dc5e99b009a5e423ab3eff1f1eb03a9a4",
21
+ "fastplms_runtime_revision": "e6dd397a9ad368c998d714f6bd64d40b533d1ed1",
22
+ "fastplms_source_tree_sha256": "818bf2bf5f573adc842b55f4f8feff926ddc25f904c5769ff5c382077d3a78a2",
23
+ "fastplms_weights_revision": "979e0880dfc9e0c0080839b83d9d2dc05b92786a",
24
+ "hidden_act": "gelu",
25
+ "hidden_dropout_prob": 0.0,
26
+ "hidden_size": 640,
27
+ "initializer_range": 0.02,
28
+ "intermediate_size": 2560,
29
+ "is_folding_model": false,
30
+ "layer_norm_eps": 1e-05,
31
+ "mask_token_id": 32,
32
+ "max_position_embeddings": 1026,
33
+ "model_type": "esm",
34
+ "num_attention_heads": 20,
35
+ "num_hidden_layers": 30,
36
+ "pad_token_id": 1,
37
+ "position_embedding_type": "rotary",
38
+ "tie_word_embeddings": false,
39
+ "token_dropout": true,
40
+ "transformers_version": "5.14.1",
41
+ "use_cache": false,
42
+ "vocab_list": null,
43
+ "vocab_size": 33
44
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.13.0+cu130",
4
+ "sentence_transformers": "5.6.1",
5
+ "transformers": "5.14.1"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": ""
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
fastplms_bundle.py ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77b2e675d30e4b39e4b1283804607e68633a4c7cece94d7e951931312f96ff79
3
+ size 592707264
modeling_fastplms.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generated bridge to the embedded FastPLMs runtime sources."""
2
+
3
+ import base64
4
+ import hashlib
5
+ import importlib
6
+ import importlib.util
7
+ import sys
8
+ import tempfile
9
+ from io import BytesIO
10
+ from pathlib import Path
11
+ from zipfile import ZIP_DEFLATED, ZipFile
12
+
13
+ from .fastplms_bundle import RUNTIME_DATA, RUNTIME_HASH
14
+
15
+ if RUNTIME_HASH != "f22353ef386f607784889dc303488a2dc5e99b009a5e423ab3eff1f1eb03a9a4":
16
+ raise RuntimeError("FastPLMs runtime identity differs from the bridge.")
17
+
18
+ _RUNTIME_TEMPORARIES = []
19
+
20
+ def _archive_runtime_hashes(payload):
21
+ result = {}
22
+ with ZipFile(BytesIO(payload)) as archive:
23
+ for member in archive.infolist():
24
+ name = member.filename
25
+ parts = Path(name).parts
26
+ if (
27
+ member.is_dir()
28
+ or "\\" in name
29
+ or not parts
30
+ or parts[0] != "fastplms"
31
+ or len(parts) < 2
32
+ or any(part in {"", ".", ".."} for part in parts)
33
+ or Path(name).suffix in {".pyc", ".pyo"}
34
+ or member.flag_bits & 0x1
35
+ or member.compress_type != ZIP_DEFLATED
36
+ or member.external_attr >> 16 != 0o100644
37
+ ):
38
+ raise RuntimeError("Embedded FastPLMs archive has an unsafe path.")
39
+ relative = Path(*parts[1:]).as_posix()
40
+ if relative in result:
41
+ raise RuntimeError("Embedded FastPLMs archive repeats a path.")
42
+ result[relative] = hashlib.sha256(archive.read(member)).hexdigest()
43
+ return result
44
+
45
+ def _ensure_runtime():
46
+ payload = base64.b85decode("".join(RUNTIME_DATA))
47
+ if hashlib.sha256(payload).hexdigest() != RUNTIME_HASH:
48
+ raise RuntimeError("Embedded FastPLMs runtime hash mismatch.")
49
+ expected = _archive_runtime_hashes(payload)
50
+ temporary = tempfile.TemporaryDirectory(prefix="fastplms-artifact-runtime-")
51
+ try:
52
+ runtime_root = Path(temporary.name)
53
+ with ZipFile(BytesIO(payload)) as archive:
54
+ for member in archive.infolist():
55
+ target = runtime_root.joinpath(*Path(member.filename).parts)
56
+ target.parent.mkdir(parents=True, exist_ok=True)
57
+ with target.open("xb") as handle:
58
+ handle.write(archive.read(member))
59
+ package_root = runtime_root / "fastplms"
60
+ if _runtime_file_hashes(package_root) != expected:
61
+ raise RuntimeError(
62
+ "Private FastPLMs runtime differs from the embedded archive."
63
+ )
64
+ except BaseException:
65
+ temporary.cleanup()
66
+ raise
67
+ _RUNTIME_TEMPORARIES.append(temporary)
68
+ return package_root
69
+
70
+ def _runtime_file_hashes(package_root):
71
+ result = {}
72
+ for path in sorted(package_root.rglob("*")):
73
+ relative = path.relative_to(package_root)
74
+ if path.is_symlink():
75
+ raise RuntimeError("Private FastPLMs runtime contains a symlink.")
76
+ if path.is_dir():
77
+ continue
78
+ if path.suffix in {".pyc", ".pyo"}:
79
+ raise RuntimeError("Private FastPLMs runtime contains bytecode.")
80
+ if not path.is_file():
81
+ raise RuntimeError("Private FastPLMs runtime contains a non-file entry.")
82
+ result[relative.as_posix()] = hashlib.sha256(path.read_bytes()).hexdigest()
83
+ return result
84
+
85
+ def _extend_loaded_package_paths(package_root):
86
+ for name, module in list(sys.modules.items()):
87
+ if name != "fastplms" and not name.startswith("fastplms."):
88
+ continue
89
+ paths = getattr(module, "__path__", None)
90
+ if paths is None:
91
+ continue
92
+ relative = name.split(".")[1:]
93
+ candidate = package_root.joinpath(*relative)
94
+ candidate_text = str(candidate)
95
+ if candidate.is_dir() and candidate_text not in paths:
96
+ paths.append(candidate_text)
97
+
98
+ def _merge_runtime(package, package_root):
99
+ incoming = _runtime_file_hashes(package_root)
100
+ known = getattr(package, "__fastplms_artifact_runtime_files__", None)
101
+ if not isinstance(known, dict):
102
+ raise RuntimeError(
103
+ "A non-artifact fastplms module is already loaded. Load the Hub artifact "
104
+ "in a separate Python process."
105
+ )
106
+ conflicts = sorted(
107
+ relative
108
+ for relative, digest in incoming.items()
109
+ if relative in known and known[relative] != digest
110
+ )
111
+ if conflicts:
112
+ raise RuntimeError(
113
+ "FastPLMs artifacts contain incompatible runtime sources at "
114
+ + ", ".join(repr(path) for path in conflicts[:5])
115
+ + ". Load incompatible releases in separate Python processes."
116
+ )
117
+ known = dict(known)
118
+ known.update(incoming)
119
+ package.__fastplms_artifact_runtime_files__ = known
120
+ roots = list(getattr(package, "__fastplms_artifact_runtime_roots__", ()))
121
+ if str(package_root) not in roots:
122
+ roots.append(str(package_root))
123
+ package.__fastplms_artifact_runtime_roots__ = tuple(roots)
124
+ temporaries = list(
125
+ getattr(package, "__fastplms_artifact_runtime_temporaries__", ())
126
+ )
127
+ for temporary in _RUNTIME_TEMPORARIES:
128
+ if temporary not in temporaries:
129
+ temporaries.append(temporary)
130
+ package.__fastplms_artifact_runtime_temporaries__ = tuple(temporaries)
131
+ hashes = set(getattr(package, "__fastplms_artifact_runtime_hashes__", ()))
132
+ hashes.add(RUNTIME_HASH)
133
+ package.__fastplms_artifact_runtime_hashes__ = frozenset(hashes)
134
+ _extend_loaded_package_paths(package_root)
135
+ return package
136
+
137
+ def _import_without_bytecode(module_name):
138
+ previous = sys.dont_write_bytecode
139
+ sys.dont_write_bytecode = True
140
+ try:
141
+ return importlib.import_module(module_name)
142
+ finally:
143
+ sys.dont_write_bytecode = previous
144
+
145
+ def _install_runtime():
146
+ package = sys.modules.get("fastplms")
147
+ hashes = getattr(package, "__fastplms_artifact_runtime_hashes__", ())
148
+ if RUNTIME_HASH in hashes:
149
+ return package
150
+ package_root = _ensure_runtime()
151
+ if package is not None:
152
+ return _merge_runtime(package, package_root)
153
+ spec = importlib.util.spec_from_file_location(
154
+ "fastplms",
155
+ package_root / "__init__.py",
156
+ submodule_search_locations=[str(package_root)],
157
+ )
158
+ if spec is None or spec.loader is None:
159
+ raise ImportError("Unable to load the embedded FastPLMs runtime.")
160
+ package = importlib.util.module_from_spec(spec)
161
+ package.__fastplms_artifact_runtime_hash__ = RUNTIME_HASH
162
+ package.__fastplms_artifact_runtime_hashes__ = frozenset({RUNTIME_HASH})
163
+ package.__fastplms_artifact_runtime_files__ = _runtime_file_hashes(package_root)
164
+ package.__fastplms_artifact_runtime_roots__ = (str(package_root),)
165
+ package.__fastplms_artifact_runtime_temporaries__ = tuple(
166
+ _RUNTIME_TEMPORARIES
167
+ )
168
+ sys.modules["fastplms"] = package
169
+ previous = sys.dont_write_bytecode
170
+ sys.dont_write_bytecode = True
171
+ try:
172
+ try:
173
+ spec.loader.exec_module(package)
174
+ except BaseException:
175
+ sys.modules.pop("fastplms", None)
176
+ raise
177
+ finally:
178
+ sys.dont_write_bytecode = previous
179
+ return package
180
+
181
+ _install_runtime()
182
+ _module_181 = _import_without_bytecode("fastplms.models.esm2.modeling_fastesm")
183
+ FastEsmConfig = _module_181.FastEsmConfig
184
+ FastEsmConfig.__module__ = __name__
185
+ FastEsmForMaskedLM = _module_181.FastEsmForMaskedLM
186
+ FastEsmForMaskedLM.__module__ = __name__
187
+ FastEsmForSequenceClassification = _module_181.FastEsmForSequenceClassification
188
+ FastEsmForSequenceClassification.__module__ = __name__
189
+ FastEsmForTokenClassification = _module_181.FastEsmForTokenClassification
190
+ FastEsmForTokenClassification.__module__ = __name__
191
+ FastEsmModel = _module_181.FastEsmModel
192
+ FastEsmModel.__module__ = __name__
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
13
+ }
14
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "feature-extraction",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "last_hidden_state"
7
+ }
8
+ },
9
+ "module_output_name": "token_embeddings"
10
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<cls>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "<eos>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "32": {
36
+ "content": "<mask>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "backend": "custom",
45
+ "bos_token": "<cls>",
46
+ "cls_token": "<cls>",
47
+ "eos_token": "<eos>",
48
+ "is_local": true,
49
+ "local_files_only": true,
50
+ "mask_token": "<mask>",
51
+ "model_max_length": 512,
52
+ "pad_token": "<pad>",
53
+ "tokenizer_class": "EsmTokenizer",
54
+ "unk_token": "<unk>"
55
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c4bffef5750f258ba5a14fbb998f3338069af62e17eb29961449cc2e83b37b5
3
+ size 5585
vocab.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <cls>
2
+ <pad>
3
+ <eos>
4
+ <unk>
5
+ L
6
+ A
7
+ G
8
+ V
9
+ S
10
+ E
11
+ R
12
+ T
13
+ I
14
+ D
15
+ P
16
+ K
17
+ Q
18
+ N
19
+ F
20
+ Y
21
+ M
22
+ H
23
+ W
24
+ C
25
+ X
26
+ B
27
+ U
28
+ Z
29
+ O
30
+ .
31
+ -
32
+ <null_1>
33
+ <mask>