InferenceApi for TokenClassification does not work
See original GitHub issueI’ve tried InferenceApi
for the pipeline of token-classification but failed:
>>> from huggingface_hub.inference_api import InferenceApi
>>> api=InferenceApi("KoichiYasuoka/bert-base-japanese-upos")
>>> r=api(inputs="國境の長いトンネルを拔けると雪國であつた。")
>>> import json
>>> print(json.dumps(r,indent=2,ensure_ascii=False))
{
"error": "maximum recursion depth exceeded while calling a Python object"
}
I remember that it worked last month and the result still remains in the cache:
>>> from huggingface_hub.inference_api import InferenceApi
>>> api=InferenceApi("KoichiYasuoka/bert-base-japanese-upos")
>>> r=api(inputs="難儀な難儀は難儀する")
>>> import json
>>> print(json.dumps(r,indent=2,ensure_ascii=False))
[
{
"entity_group": "ADJ",
"score": 0.6918697953224182,
"word": "難 儀",
"start": null,
"end": null
},
{
"entity_group": "AUX",
"score": 0.995212972164154,
"word": "な",
"start": null,
"end": null
},
{
"entity_group": "NOUN",
"score": 0.9972944259643555,
"word": "難 儀",
"start": null,
"end": null
},
{
"entity_group": "ADP",
"score": 0.9995647072792053,
"word": "は",
"start": null,
"end": null
},
{
"entity_group": "VERB",
"score": 0.6875597238540649,
"word": "難 儀",
"start": null,
"end": null
},
{
"entity_group": "AUX",
"score": 0.9953439235687256,
"word": "す る",
"start": null,
"end": null
}
]
Something changed on InferenceApi
or TokenClassification?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Detailed parameters - Hugging Face
In general the Hosted API Inference accepts a simple string as an input. However, more advanced usage depends on the “task” that the...
Read more >[inference] token classification | Kaggle
In essence, I treat it as a token classification problem instead of text classification. I insert in CLS tokens before each discourse text...
Read more >notebooks/token_classification-tf.ipynb at main - GitHub
In this notebook, we will see how to fine-tune one of the Transformers model to a token classification task, which is the task...
Read more >Infer trained model API | Elasticsearch Guide [8.5] | Elastic
none : No truncation occurs; the inference request receives an error. first : Only the first sequence is ... NER is a special...
Read more >Named Entity Recognition - Sparse Use Cases - Neural Magic
You will apply a “named entity recognition” token classification use case ... of miscellaneous entities that do not belong to the previous three...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found the culprit which was linked to bad merge between master and the API fork (Turns out GPT2ForTokenClassification was added relatively recently).
Thank you @Narsil and I’ve just confirmed that it works well:
Thank you again and I close this issue.