rcsb-embedding-model 0.0.18__py3-none-any.whl → 0.0.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rcsb-embedding-model might be problematic. Click here for more details.

@@ -1,5 +1,4 @@
1
1
  from esm.sdk.api import SamplingConfig
2
- from esm.sdk import batch_executor
3
2
  from lightning import LightningModule
4
3
 
5
4
  from rcsb_embedding_model.utils.model import get_residue_model
@@ -14,14 +13,9 @@ class EsmModule(LightningModule):
14
13
  self.esm3 = get_residue_model(self.device)
15
14
 
16
15
  def predict_step(self, prot_batch, batch_idx):
17
- prot_embeddings = []
18
- def __batch_embedding(esm_prot):
19
- return self.esm3.forward_and_sample(
20
- self.esm3.encode(esm_prot), SamplingConfig(return_per_residue_embeddings=True)
21
- ).per_residue_embedding
22
- with batch_executor() as executor:
23
- prot_embeddings = executor.execute_batch(
24
- user_func=__batch_embedding,
25
- esm_prot=[esm_prot for esm_prot, name in prot_batch]
26
- )
27
- return tuple(prot_embeddings), tuple([name for esm_prot, name in prot_batch])
16
+ return tuple([self.__compute_embeddings(esm_prot) for esm_prot, name in prot_batch]), tuple([name for esm_prot, name in prot_batch])
17
+
18
+ def __compute_embeddings(self, esm_prot):
19
+ return self.esm3.forward_and_sample(
20
+ self.esm3.encode(esm_prot), SamplingConfig(return_per_residue_embeddings=True)
21
+ ).per_residue_embedding
@@ -76,10 +76,10 @@ def concatenate_tensors(file_list, max_residues, dim=0):
76
76
  tensor_cat = torch.cat(tensors, dim=dim)
77
77
  return tensor_cat
78
78
  else:
79
- raise ValueError("No valid tensors were loaded to concatenate.")
79
+ raise ValueError(f"No valid tensors were loaded to concatenate. {', '.join(file_list)}")
80
80
 
81
81
  def adapt_csv_to_embedding_chain_stream(src_file, res_embedding_location):
82
82
  def __parse_row(row):
83
83
  r = row.split(",")
84
84
  return os.path.join(res_embedding_location, f"{r[0]}.{r[2]}.pt"), f"{r[0]}.{r[2]}"
85
- return tuple([__parse_row(r) for r in open(src_file)])
85
+ return tuple([__parse_row(r.strip()) for r in open(src_file)])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rcsb-embedding-model
3
- Version: 0.0.18
3
+ Version: 0.0.20
4
4
  Summary: Protein Embedding Model for Structure Search
5
5
  Project-URL: Homepage, https://github.com/rcsb/rcsb-embedding-model
6
6
  Project-URL: Issues, https://github.com/rcsb/rcsb-embedding-model/issues
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
 
18
18
  # RCSB Embedding Model
19
19
 
20
- **Version** 0.0.18
20
+ **Version** 0.0.20
21
21
 
22
22
 
23
23
  ## Overview
@@ -15,16 +15,16 @@ rcsb_embedding_model/inference/structure_inference.py,sha256=lqbDBPSea8IoNyQXl83
15
15
  rcsb_embedding_model/model/layers.py,sha256=lhKaWC4gTS_T5lHOP0mgnnP8nKTPEOm4MrjhESA4hE8,743
16
16
  rcsb_embedding_model/model/residue_embedding_aggregator.py,sha256=k3UW63Ax8DtjCMdD3O5xNxtyAu28l2n3-Ab6nS0atm0,1967
17
17
  rcsb_embedding_model/modules/chain_module.py,sha256=sDSPXJmWuU2C3lt1NorlbUVWZvRSLzumPdFQk01h3VI,403
18
- rcsb_embedding_model/modules/esm_module.py,sha256=4IQgrNQlGThxl0PhobVzyp7N3FcyAbvek_KxJozGImQ,945
18
+ rcsb_embedding_model/modules/esm_module.py,sha256=MzE-9_25262m80yW7Pb-Pkf8L-R_xb3FPcz9gOlNgAI,705
19
19
  rcsb_embedding_model/modules/structure_module.py,sha256=dEtDNdWo1j2sSDa0JiOHQfEfQzIWqSLEKpvOX0GrXZ4,1048
20
20
  rcsb_embedding_model/types/api_types.py,sha256=SCwALwvEb0KRKaoWKbuN7JyfOH-1whsI0Z4ki41dht8,1235
21
- rcsb_embedding_model/utils/data.py,sha256=FVb6tzoX4SrJf3Fr6UFbxZJQsUr9xp5RbkK6nqXhcuQ,3222
21
+ rcsb_embedding_model/utils/data.py,sha256=ATgHC6d7xgc2eYtCsEsgMxhAFvYp4R9C0TlNStc1jG0,3254
22
22
  rcsb_embedding_model/utils/model.py,sha256=rpZa-gfm3cEtbBd7UXMHrZv3x6f0AC8TJT3gtrSxr5I,852
23
23
  rcsb_embedding_model/utils/structure_parser.py,sha256=IWMQ8brlEMe6_ND-DBESOli8vlqHxladTssjbM9RSKw,2751
24
24
  rcsb_embedding_model/utils/structure_provider.py,sha256=eWtxjkPpmRfmil_DKR1J6miaXR3lQ28DF5O0qrqSgGA,786
25
25
  rcsb_embedding_model/writer/batch_writer.py,sha256=rTFNasB0Xp4-XCNTXKeEWZxSrb7lvZytoRldJUWn9Jg,3312
26
- rcsb_embedding_model-0.0.18.dist-info/METADATA,sha256=PzSnwGeAeUbYxhpRBgEiZZdj2bGdLrT8QAy0uB_BxNQ,5310
27
- rcsb_embedding_model-0.0.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- rcsb_embedding_model-0.0.18.dist-info/entry_points.txt,sha256=MK11jTIEmaV-x4CkPX5IymDaVs7Ky_f2xxU8BJVZ_9Q,69
29
- rcsb_embedding_model-0.0.18.dist-info/licenses/LICENSE.md,sha256=oUaHiKgfBkChth_Sm67WemEvatO1U0Go8LHjaskXY0w,1522
30
- rcsb_embedding_model-0.0.18.dist-info/RECORD,,
26
+ rcsb_embedding_model-0.0.20.dist-info/METADATA,sha256=LBfyPJYo7iUu2XmBC0mzoX-Qo1_FHu8BPWw8au1VkQI,5310
27
+ rcsb_embedding_model-0.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ rcsb_embedding_model-0.0.20.dist-info/entry_points.txt,sha256=MK11jTIEmaV-x4CkPX5IymDaVs7Ky_f2xxU8BJVZ_9Q,69
29
+ rcsb_embedding_model-0.0.20.dist-info/licenses/LICENSE.md,sha256=oUaHiKgfBkChth_Sm67WemEvatO1U0Go8LHjaskXY0w,1522
30
+ rcsb_embedding_model-0.0.20.dist-info/RECORD,,