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
b3fb984e
Commit
b3fb984e
authored
Nov 24, 2022
by
piotrmp
Browse files
Options
Downloads
Patches
Plain Diff
Added fallback for no pretrained model case.
parent
7b6b1b50
No related branches found
No related tags found
1 merge request
!1
Migration to UD 2.11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lambo/learning/train.py
+5
-1
5 additions, 1 deletion
src/lambo/learning/train.py
with
5 additions
and
1 deletion
src/lambo/learning/train.py
+
5
−
1
View file @
b3fb984e
...
@@ -149,7 +149,11 @@ def train_pretrained_and_save(language, treebank_path, save_path, pretrained_pat
...
@@ -149,7 +149,11 @@ def train_pretrained_and_save(language, treebank_path, save_path, pretrained_pat
"""
"""
print
(
"
Loading pretrained model
"
)
print
(
"
Loading pretrained model
"
)
pretrained_name
=
'
oscar_
'
+
language
pretrained_name
=
'
oscar_
'
+
language
pretrained_model
=
torch
.
load
(
pretrained_path
/
(
pretrained_name
+
'
.pth
'
))
file_path
=
pretrained_path
/
(
pretrained_name
+
'
.pth
'
)
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
)
dict
=
{}
dict
=
{}
for
line
in
open
(
pretrained_path
/
(
pretrained_name
+
'
.dict
'
)):
for
line
in
open
(
pretrained_path
/
(
pretrained_name
+
'
.dict
'
)):
if
line
.
strip
()
==
''
:
if
line
.
strip
()
==
''
:
...
...
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