Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambo
Manage
Activity
Members
Labels
Plan
Issues
45
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
Package Registry
Container Registry
Operate
Environments
Terraform modules
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
Syntactic Tools
lambo
Commits
51c310b1
Commit
51c310b1
authored
2 years ago
by
piotrmp
Browse files
Options
Downloads
Patches
Plain Diff
Bug fix.
parent
1b098707
1 merge request
!1
Migration to UD 2.11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lambo/learning/train.py
+1
-1
1 addition, 1 deletion
src/lambo/learning/train.py
src/lambo/segmenter/lambo.py
+2
-2
2 additions, 2 deletions
src/lambo/segmenter/lambo.py
with
3 additions
and
3 deletions
src/lambo/learning/train.py
+
1
−
1
View file @
51c310b1
...
...
@@ -153,7 +153,7 @@ def train_pretrained_and_save(language, treebank_path, save_path, pretrained_pat
if
not
file_path
.
exists
():
print
(
"
Pretrained model not found, falling back to training from scratch.
"
)
return
train_new_and_save
(
'
LAMBO-BILSTM
'
,
treebank_path
,
save_path
,
epochs
,
device
)
pretrained_model
=
torch
.
load
(
file_path
)
pretrained_model
=
torch
.
load
(
file_path
,
map_location
=
torch
.
device
(
'
cpu
'
)
)
dict
=
{}
for
line
in
open
(
pretrained_path
/
(
pretrained_name
+
'
.dict
'
)):
if
line
.
strip
()
==
''
:
...
...
This diff is collapsed.
Click to expand it.
src/lambo/segmenter/lambo.py
+
2
−
2
View file @
51c310b1
...
...
@@ -38,7 +38,7 @@ class Lambo():
model_name
=
Lambo
.
getDefaultModel
(
provided_name
)
dict_path
,
model_path
=
download_model
(
model_name
)
dict
=
Lambo
.
read_dict
(
dict_path
)
model
=
torch
.
load
(
model_path
)
model
=
torch
.
load
(
model_path
,
map_location
=
torch
.
device
(
'
cpu
'
)
)
return
cls
(
model
,
dict
)
@staticmethod
...
...
@@ -75,7 +75,7 @@ class Lambo():
:param model_name: model name
:return:
"""
model
=
torch
.
load
(
model_path
/
(
model_name
+
'
.pth
'
))
model
=
torch
.
load
(
model_path
/
(
model_name
+
'
.pth
'
)
,
map_location
=
torch
.
device
(
'
cpu
'
)
)
dict
=
Lambo
.
read_dict
(
model_path
/
(
model_name
+
'
.dict
'
))
return
cls
(
model
,
dict
)
...
...
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