> ## Documentation Index
> Fetch the complete documentation index at: https://docs.biohub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed multiple sequences with ESMC

> Use the esm SDK parallel executor to generate ESMC representations for multiple protein sequences.

Use this developer guide after completing [Run your first ESMC inference](/learn/tutorials/esmc).
The SDK parallel executor coordinates concurrent requests while respecting the service's request limits.

## Before you begin

Prepare a bounded list of valid amino-acid sequences and a [Biohub Platform API key](https://biohub.ai/developer-console/api-keys).

<Steps>
  <Step title="Create the client and embedding function">
    ```python theme={null}
    from getpass import getpass

    from esm.sdk import esmc_client, parallel_executor
    from esm.sdk.api import ESMCInferenceClient, ESMProtein, LogitsConfig, LogitsOutput

    token = getpass("Biohub API key: ")
    model = esmc_client(
        model="esmc-300m-2024-12",
        url="https://biohub.ai",
        token=token,
    )

    embedding_config = LogitsConfig(
        sequence=True,
        return_hidden_states=False,
        return_mean_hidden_states=True,
    )

    def embed_sequence(model: ESMCInferenceClient, sequence: str) -> LogitsOutput:
        protein_tensor = model.encode(ESMProtein(sequence=sequence))
        return model.logits(protein_tensor, embedding_config)
    ```
  </Step>

  <Step title="Submit the sequence collection">
    ```python theme={null}
    sequences = [
        "MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG",
        "MKTIIALSYIFCLVFADYKDDDDK",
    ]

    with parallel_executor() as executor:
        outputs = executor.execute_batch(
            user_func=embed_sequence,
            model=model,
            sequence=sequences,
        )
    ```
  </Step>

  <Step title="Verify every output">
    ```python theme={null}
    for index, output in enumerate(outputs, start=1):
        embedding = output.mean_hidden_state.float().squeeze()
        print(index, embedding.shape)
    ```

    Confirm that the number of outputs matches the number of input sequences and that every representation is non-empty.
  </Step>
</Steps>

For a complete dataset example, open the [ESMC embedding notebook](https://colab.research.google.com/github/Biohub/esm/blob/main/cookbook/tutorials/embed.ipynb).
