Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
punctuator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nlpworkers
punctuator
Commits
0ea26120
Commit
0ea26120
authored
4 years ago
by
Bartłomiej Bojanowski
Browse files
Options
Downloads
Patches
Plain Diff
Fix key error dict
parent
d6a46bf8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!15
Test punct
Pipeline
#3277
failed with stages
in 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
worker.py
+3
-3
3 additions, 3 deletions
worker.py
with
3 additions
and
3 deletions
worker.py
+
3
−
3
View file @
0ea26120
...
...
@@ -40,8 +40,8 @@ class Worker(nlp_ws.NLPWorker):
self
.
config
=
configparser
.
ConfigParser
()
self
.
config
.
read
(
"
config.ini
"
)
self
.
config
=
self
.
config
[
"
deployment
"
]
self
.
languagetool_map
=
{
'
model_path_pl
'
:
'
pl-PL
'
,
'
model_path_ru
'
:
'
ru
'
,
'
model_path_en
'
:
'
en-US
'
}
self
.
languagetool_map
=
{
self
.
config
[
'
model_path_pl
'
]
:
'
pl-PL
'
,
self
.
config
[
'
model_path_ru
'
]
:
'
ru
'
,
self
.
config
[
'
model_path_en
'
]
:
'
en-US
'
}
self
.
max_context_size
=
int
(
self
.
config
[
"
max_context_size
"
])
self
.
overlap
=
int
(
self
.
config
[
"
overlap
"
])
...
...
@@ -123,7 +123,7 @@ class Worker(nlp_ws.NLPWorker):
).
to
(
device
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_path
)
mapping
=
{}
with
open
(
f
"
{
model_path
}
/classes.json
"
,
"
r
"
)
as
f
:
with
open
(
f
"
{
self
.
config
[
'
model_path
_pl
'
]
}
/classes.json
"
,
"
r
"
)
as
f
:
mapping
=
json
.
load
(
f
)
mapping
=
list
(
mapping
.
keys
())
return
tool
,
model
,
tokenizer
,
mapping
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment