def find_text_field_embedder(model: torch.nn.Module) -> torch.nn.Module:
    """
    Takes a `Model` and returns the `Module` that is a `TextFieldEmbedder`.  We return just the
    first one, as it's very rare to have more than one.  If there isn't a `TextFieldEmbedder` in the
    given `Model`, we raise a `ValueError`.
    """
    from allennlp.modules.text_field_embedders.text_field_embedder import TextFieldEmbedder

    for module in model.modules():
        if isinstance(module, TextFieldEmbedder):
            return module
    raise ValueError("Couldn't find TextFieldEmbedder!")
Takes a `Model` and returns the `Module` that is a `TextFieldEmbedder`.  We return just the
first one, as it's very rare to have more than one.  If there isn't a `TextFieldEmbedder` in the
given `Model`, we raise a `ValueError`.
allennlp/nn/util.py