This message was deleted.
# ask-for-help
s
This message was deleted.
t
My code:
Copy code
# Save the pipeline
ner = pipeline(
    task="ner",
    model=model,
    tokenizer=tokenizer,
    aggregation_strategy="simple", # <-- Aggregation Strategy being set here
    device=device,
)

bentoml.transformers.save_model(name="ner", pipeline=ner)

# Serve the pipeline
runner = bentoml.transformers.get("ner:latest").to_runner()

svc = bentoml.Service("ner_service", runners=[runner])


@svc.api(input=Text(), output=JSON())
async def predictions(input: str) -> list:
    return await runner.async_run(input)
But the results are still returned as individual tokens. Something like this:
Copy code
# input text = "Los Angeles"
[
  {
    "entity": "B-City",
    "score": 0.9210142493247986,
    "index": 1,
    "word": "Los",
    "start": 0,
    "end": 3
  },
  {
    "entity": "I-City",
    "score": 0.9572663307189941,
    "index": 2,
    "word": "## Ang",
    "start": 3,
    "end": 6
  },
  {
    "entity": "I-City",
    "score": 0.9572663307189941,
    "index": 2,
    "word": "##eles",
    "start": 6,
    "end": 10
  },
]
I would expect the results to be something like
Copy code
[
    {
        "entity_group": "City",
        "score": 0.9461781,
        "word": "Los Angeles",
        "start": 0,
        "end": 10,
    }
]
I am using
transformers 4.28.1
and
bentoml 1.0.19