Skip to content

Latest commit

 

History

History
167 lines (135 loc) · 5.64 KB

model_card_template.md

File metadata and controls

167 lines (135 loc) · 5.64 KB
{"card_data"=>nil}

{{ model_name | default("SpanMarker for Named Entity Recognition", true) }}

This is a SpanMarker model{% if dataset_id %} trained on the [{{ dataset_name if dataset_name else dataset_id }}](https://huggingface.co/datasets/{{ dataset_id }}) dataset{% endif %} that can be used for {{ task_name | default("Named Entity Recognition", true) }}.{% if encoder_id %} This SpanMarker model uses [{{ encoder_name if encoder_name else encoder_id }}](https://huggingface.co/{{ encoder_id }}) as the underlying encoder.{% endif %}

Model Details

Model Description

  • Model Type: SpanMarker {% if encoder_id -%}

{%- endif %}

  • Maximum Sequence Length: {{ model_max_length }} tokens
  • Maximum Entity Length: {{ entity_max_length }} words {% if dataset_id -%}

{%- endif %} {% if language -%} - Language{{"s" if language is not string and language | length > 1 else ""}}: {%- if language is string %} {{ language }} {%- else %} {% for lang in language -%} {{ lang }}{{ ", " if not loop.last else "" }} {%- endfor %} {%- endif %} {%- else -%} {%- endif %} {% if license -%} - License: {{ license }} {%- else -%} {%- endif %}

Model Sources

Model Labels

{{ label_examples }}{% endif -%} {% if metrics_table %}

Evaluation

Metrics

{{ metrics_table }}{% endif %}

Uses

Direct Use for Inference

from span_marker import SpanMarkerModel

# Download from the {{ hf_emoji }} Hub
model = SpanMarkerModel.from_pretrained("{{ model_id | default('span_marker_model_id', true) }}")
# Run inference
entities = model.predict("{{ predict_example | replace('"', '\\"') | default("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.", true)}}")

Downstream Use

You can finetune this model on your own dataset.

Click to expand
from span_marker import SpanMarkerModel, Trainer

# Download from the {{ hf_emoji }} Hub
model = SpanMarkerModel.from_pretrained("{{ model_id | default('span_marker_model_id', true) }}")

# Specify a Dataset with "tokens" and "ner_tag" columns
dataset = load_dataset("conll2003") # For example CoNLL2003

# Initialize a Trainer using the pretrained model & dataset
trainer = Trainer(
    model=model,
    train_dataset=dataset["train"],
    eval_dataset=dataset["validation"],
)
trainer.train()
trainer.save_model("{{ model_id | default('span_marker_model_id', true) }}-finetuned")

Training Details

{% if train_set_metrics %}

Training Set Metrics

{{ train_set_metrics }}{% endif %}{% if hyperparameters %}

Training Hyperparameters

{% for name, value in hyperparameters.items() %}- {{ name }}: {{ value }} {% endfor %}{% endif %}{% if eval_lines %}

Training Results

{{ eval_lines }}{% endif %}{% if co2_eq_emissions %}

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • Carbon Emitted: {{ "%.3f"|format(co2_eq_emissions["emissions"] / 1000) }} kg of CO2
  • Hours Used: {{ co2_eq_emissions["hours_used"] }} hours

Training Hardware

  • On Cloud: {{ "Yes" if co2_eq_emissions["on_cloud"] else "No" }}
  • GPU Model: {{ co2_eq_emissions["hardware_used"] or "No GPU used" }}
  • CPU Model: {{ co2_eq_emissions["cpu_model"] }}
  • RAM Size: {{ "%.2f"|format(co2_eq_emissions["ram_total_size"]) }} GB {% endif %}

Framework Versions

  • Python: {{ version["python"] }}
  • SpanMarker: {{ version["span_marker"] }}
  • Transformers: {{ version["transformers"] }}
  • PyTorch: {{ version["torch"] }}
  • Datasets: {{ version["datasets"] }}
  • Tokenizers: {{ version["tokenizers"] }}

Citation

BibTeX

@software{Aarsen_SpanMarker,
    author = {Aarsen, Tom},
    license = {Apache-2.0},
    title = {{"{{SpanMarker for Named Entity Recognition}}"}},
    url = {https://github.com/tomaarsen/SpanMarkerNER}
}