Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

conversion to huggingface transformers fails for NER models #570

@Timoeller

Description

@Timoeller

Hi everyone,

I tried converting some models. For multi-label text classification head it tells me that only 1 head is allowed. I can work around that. However, for a model with TokenClassificationHead it tells me the following:

  File "conversion_huggingface_models.py", line 43, in convert_to_transformers
    transformer_model = model.convert_to_transformers()
  File "/mnt/beegfs/users/thomas.haider/Documents/workspace/poetry/farm/FARM/farm/modeling/adaptive_model.py", line 543, in convert_to_transformers
    self.language_model.model.config.id2label = {id: label for id, label in enumerate(self.prediction_heads[0].label_list)}
  File "/hpc/users/thomas.haider/Documents/workspace/python37-venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 594, in __getattr__
    type(self).__name__, name))
AttributeError: 'TokenClassificationHead' object has no attribute 'label_list'

Any idea what's going on there?

Thanks.

Originally posted by @tnhaider in #196 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions