Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nlp
ahisto-modules
Named Entity Recognition Experiments
Commits
a15f4ea0
Commit
a15f4ea0
authored
Sep 15, 2022
by
Vít Novotný
Browse files
Add `NerModel.tokenizer`
parent
69c56bf1
Pipeline
#147174
passed with stage
in 9 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ahisto_named_entity_search/recognition/model.py
View file @
a15f4ea0
...
...
@@ -11,7 +11,7 @@ from adaptor.evaluators.token_classification import MeanFScore
from
adaptor.objectives.MLM
import
MaskedLanguageModeling
from
adaptor.lang_module
import
LangModule
from
adaptor.utils
import
StoppingStrategy
,
AdaptationArguments
from
transformers
import
AutoModelForTokenClassification
from
transformers
import
AutoModelForTokenClassification
,
AutoTokenizer
from
..config
import
CONFIG
as
_CONFIG
from
..document
import
Document
,
Sentence
...
...
@@ -42,6 +42,11 @@ class NerModel:
def
__init__
(
self
,
model_name_or_basename
:
str
):
self
.
model_name_or_basename
=
model_name_or_basename
@
property
def
tokenizer
(
self
)
->
AutoTokenizer
:
tokenizer
=
AutoTokenizer
.
from_pretrained
(
self
.
model_name_or_basename
)
return
tokenizer
@
property
def
model
(
self
)
->
AutoModelForTokenClassification
:
model
=
AutoModelForTokenClassification
.
from_pretrained
(
self
.
model_name_or_basename
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment