Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
4cd2bb70
Commit
4cd2bb70
authored
Apr 12, 2018
by
Myle Ott
Browse files
Revert "Make dictionary size a multiple of 8"
This reverts commit b2e119c209363e6ff6d2878a69c7d1a507a2e9be.
parent
26f87c7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
11 deletions
+1
-11
fairseq/dictionary.py
fairseq/dictionary.py
+1
-11
No files found.
fairseq/dictionary.py
View file @
4cd2bb70
...
@@ -124,6 +124,7 @@ class Dictionary(object):
...
@@ -124,6 +124,7 @@ class Dictionary(object):
...
...
```
```
"""
"""
if
isinstance
(
f
,
str
):
if
isinstance
(
f
,
str
):
try
:
try
:
if
not
ignore_utf_errors
:
if
not
ignore_utf_errors
:
...
@@ -146,17 +147,6 @@ class Dictionary(object):
...
@@ -146,17 +147,6 @@ class Dictionary(object):
d
.
indices
[
word
]
=
len
(
d
.
symbols
)
d
.
indices
[
word
]
=
len
(
d
.
symbols
)
d
.
symbols
.
append
(
word
)
d
.
symbols
.
append
(
word
)
d
.
count
.
append
(
count
)
d
.
count
.
append
(
count
)
# apply padding so that the dictionary size is a nice round number
factor
=
8
padding
=
0
while
len
(
d
.
symbols
)
%
factor
!=
0
:
word
=
'madeupword{:04d}'
.
format
(
padding
)
d
.
indices
[
word
]
=
len
(
d
.
symbols
)
d
.
symbols
.
append
(
word
)
d
.
count
.
append
(
0
)
assert
len
(
d
.
symbols
)
%
factor
==
0
return
d
return
d
def
save
(
self
,
f
,
threshold
=
3
,
nwords
=-
1
):
def
save
(
self
,
f
,
threshold
=
3
,
nwords
=-
1
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment