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
7fffa595
Commit
7fffa595
authored
2 years ago
by
piotrmp
Browse files
Options
Downloads
Patches
Plain Diff
Added handling for unknown language in OSCAR.
parent
ac107081
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
Migration to UD 2.11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lambo/examples/run_pretraining.py
+10
-1
10 additions, 1 deletion
src/lambo/examples/run_pretraining.py
with
10 additions
and
1 deletion
src/lambo/examples/run_pretraining.py
+
10
−
1
View file @
7fffa595
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
Script from pretraining models using OSCAR corpora
Script from pretraining models using OSCAR corpora
"""
"""
import
gzip
import
gzip
from
urllib.error
import
HTTPError
import
importlib_resources
as
resources
import
importlib_resources
as
resources
from
pathlib
import
Path
from
pathlib
import
Path
...
@@ -39,7 +41,14 @@ if __name__ == '__main__':
...
@@ -39,7 +41,14 @@ if __name__ == '__main__':
continue
continue
print
(
"
Language:
"
+
language
)
print
(
"
Language:
"
+
language
)
print
(
"
Downloading corpus...
"
)
print
(
"
Downloading corpus...
"
)
download_archive1_from_oscar
(
language
,
tmppath
,
OSCAR_LOGIN
,
OSCAR_PASSWORD
)
try
:
download_archive1_from_oscar
(
language
,
tmppath
,
OSCAR_LOGIN
,
OSCAR_PASSWORD
)
except
HTTPError
as
err
:
if
err
.
code
==
404
:
print
(
"
Language unavailable in OSCAR. moving on...
"
)
continue
else
:
raise
err
with
gzip
.
open
(
tmppath
)
as
jsonfile
:
with
gzip
.
open
(
tmppath
)
as
jsonfile
:
train_documents
,
test_documents
=
read_jsonl_to_documents
(
jsonfile
)
train_documents
,
test_documents
=
read_jsonl_to_documents
(
jsonfile
)
print
(
"
Generated
"
+
str
(
len
(
train_documents
))
+
"
documents.
"
)
print
(
"
Generated
"
+
str
(
len
(
train_documents
))
+
"
documents.
"
)
...
...
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