esm icon indicating copy to clipboard operation
esm copied to clipboard

Batch Support for Obtaining Residue Embeddings

Open Junseok0207 opened this issue 6 months ago • 3 comments

I am currently trying to obtain residue embeddings for protein sequences. The typical workflow involves the following steps:

protein = ESMProtein(sequence=sequence)
protein_tensor = self.model.encode(protein)
config = SamplingConfig(return_per_residue_embeddings=True)
output = client.forward_and_sample(protein_tensor, config)
embeddings = output.per_residue_embedding

However, I don't know how to get embeddings in batch mode. I checked the example in esm/examples/local_generate.py (lines 129-135), but it only shows the batch_generate function, which does not include a way to obtain embeddings. How can I achieve embeddings with batch?

Junseok0207 avatar Aug 12 '24 06:08 Junseok0207