Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syntactic Tools
lambo
Commits
611bde20
Commit
611bde20
authored
Dec 13, 2022
by
piotrmp
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix.
parent
e31253c7
No related branches found
No related tags found
1 merge request
!2
Multiword generation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lambo/learning/train.py
+2
-9
2 additions, 9 deletions
src/lambo/learning/train.py
with
2 additions
and
9 deletions
src/lambo/learning/train.py
+
2
−
9
View file @
611bde20
...
...
@@ -6,6 +6,7 @@ from torch.optim import Adam
from
lambo.learning.model
import
LamboNetwork
from
lambo.learning.preprocessing_dict
import
utf_category_dictionary
,
prepare_dataloaders_withdict
from
lambo.segmenter.lambo
import
Lambo
from
lambo.utils.ud_reader
import
read_treebank
...
...
@@ -167,15 +168,7 @@ def train_pretrained_and_save(language, treebank_path, save_path, pretrained_pat
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
,
map_location
=
torch
.
device
(
'
cpu
'
))
dict
=
{}
for
line
in
open
(
pretrained_path
/
(
pretrained_name
+
'
.dict
'
)):
if
line
.
strip
()
==
''
:
continue
parts
=
line
.
split
(
'
\t
'
)
if
len
(
parts
)
==
3
and
parts
[
0
]
==
''
and
parts
[
1
]
==
''
:
# TAB character
parts
=
[
'
\t
'
,
parts
[
2
]]
dict
[
parts
[
0
]]
=
int
(
parts
[
1
])
dict
=
Lambo
.
read_dict
()
print
(
"
Reading data.
"
)
train_doc
,
dev_doc
,
test_doc
=
read_treebank
(
treebank_path
,
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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