36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from pathlib import Path
|
|
from typing import Self
|
|
|
|
class GLiNER:
|
|
@classmethod
|
|
def from_pretrained(
|
|
cls,
|
|
model_id: str,
|
|
revision: str | None = None,
|
|
cache_dir: str | Path | None = None,
|
|
force_download: bool = False,
|
|
proxies: dict[str, str] | None = None,
|
|
resume_download: bool = False,
|
|
local_files_only: bool = False,
|
|
token: str | bool | None = None,
|
|
map_location: str = "cpu",
|
|
strict: bool = False,
|
|
load_tokenizer: bool | None = None,
|
|
resize_token_embeddings: bool | None = True,
|
|
compile_torch_model: bool | None = False,
|
|
load_onnx_model: bool | None = False,
|
|
onnx_model_file: str | None = "model.onnx",
|
|
max_length: int | None = None,
|
|
max_width: int | None = None,
|
|
post_fusion_schema: str | None = None,
|
|
_attn_implementation: str | None = None,
|
|
) -> Self: ...
|
|
def predict_entities(
|
|
self,
|
|
text: str,
|
|
labels: list[str],
|
|
flat_ner: bool = True,
|
|
threshold: float = 0.5,
|
|
multi_label: bool = False,
|
|
) -> list[dict[str, object]]: ...
|