class_docstr: Input examples to a SingleEdgePredictor.
class_docstr_tok: ["Input","examples","to","a","SingleEdgePredictor","."]
docstr: Run encoder and extract span representations for coreference.
  
  'encoder' should be a model returning one TokenEmbeddings field,
  from which span features will be extracted, as well as a TokenOffsets field
  which maps input tokens to output tokens.
  
  The returned dataset will contain one example for each label in the inputs'
  EdgeLabels field.
  
  Args:
    inputs: input Dataset
    encoder: encoder model, compatible with inputs
    edge_field: name of edge field in data
    embs_field: name of embeddings field in model output
    offset_field: name of offset field in model output
    progress: optional pass-through progress indicator
    verbose: if true, print estimated memory usage
  
  Returns:
    EdgeFeaturesDataset with extracted span representations
docstr_tok: ["Run","encoder","and","extract","span","representations","for","coreference",".","'encoder","'","should","be","a","model","returning","one","TokenEmbeddings","field",",","from","which","span","features","will","be","extracted",",","as","well","as","a","TokenOffsets","field","which","maps","input","tokens","to","output","tokens",".","The","returned","dataset","will","contain","one","example","for","each","label","in","the","inputs'","EdgeLabels","field",".","Args",":","inputs",":","input","Dataset","encoder",":","encoder","model",",","compatible","with","inputs","edge_field",":","name","of","edge","field","in","data","embs_field",":","name","of","embeddings","field","in","model","output","offset_field",":","name","of","offset","field","in","model","output","progress",":","optional","pass-through","progress","indicator","verbose",":","if","true",",","print","estimated","memory","usage","Returns",":","EdgeFeaturesDataset","with","extracted","span","representations"]
code: def build(
      cls,
      inputs: list[JsonDict],
      encoder: lit_model.BatchedModel,
      edge_field: str,
      embs_field: str,
      offset_field: str,
      progress=lambda x: x,
      verbose=False,
  ):
      """Run encoder and extract span representations for coreference.
  
      'encoder' should be a model returning one TokenEmbeddings field,
      from which span features will be extracted, as well as a TokenOffsets field
      which maps input tokens to output tokens.
  
      The returned dataset will contain one example for each label in the inputs'
      EdgeLabels field.
  
      Args:
        inputs: input Dataset
        encoder: encoder model, compatible with inputs
        edge_field: name of edge field in data
        embs_field: name of embeddings field in model output
        offset_field: name of offset field in model output
        progress: optional pass-through progress indicator
        verbose: if true, print estimated memory usage
  
      Returns:
        EdgeFeaturesDataset with extracted span representations
      """
      examples = []
      encoder_outputs = progress(encoder.predict(inputs))
      for i, output in enumerate(encoder_outputs):
          exs = _make_probe_inputs(
              inputs[i][edge_field],
              output[embs_field],
              output[offset_field],
              src_idx=i,
          )
          examples.extend(exs)
          if verbose and i == 10:
              _estimate_memory_needs(inputs, edge_field, examples[0])
  
      return cls(examples)
  
imports: import os
  from collections.abc import Iterable
  from typing import Optional
  from absl import logging
  from lit_nlp.api import dataset
  from lit_nlp.api import dtypes
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.lib import utils
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling the EdgeFeaturesDataset obj's underlying member method code with example usage: obj.build(cls, inputs, encoder, edge_field, embs_field, offset_field, progress, verbose) and returns: cls