Diffusion
DiffusionDecoder(model)
Class for decoding from a diffusion model by forward sampling.
Source code in instanovo/inference/diffusion.py
decode(spectra, spectra_padding_mask, precursors, initial_sequence=None, start_step=DIFFUSION_START_STEP, eval_steps=DIFFUSION_EVAL_STEPS)
Decoding predictions from a diffusion model by forward sampling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spectra |
FloatTensor[batch_size, sequence_length, 2]
|
A batch of spectra to be decoded. |
required |
spectra_padding_mask |
BoolTensor[batch_size, sequence_length]
|
Padding mask for a batch of variable length spectra. |
required |
precursors |
FloatTensor[batch_size, 3]
|
Precursor mass, charge and m/z for a batch of spectra. |
required |
initial_sequence |
None | LongTensor[batch_size, output_sequence_length]
|
An initial sequence for the model to refine. If no initial sequence is provided (the value is None), will sample a random sequence from a uniform unigram model. Defaults to None. |
None
|
start_step |
int
|
The step at which to insert the initial sequence and start refinement. If
|
DIFFUSION_START_STEP
|
Returns:
Type | Description |
---|---|
tuple[list[list[str]], list[float]]
|
tuple[list[list[str]], list[float]]: The decoded peptides and their log-probabilities for a batch of spectra. |