Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5dacbf1

Browse files
litesaber15facebook-github-bot
authored andcommittedAug 16, 2019
Propagate min_freq for vocab correctly (facebookresearch#907)
Summary: Pull Request resolved: facebookresearch#907 Propogate min_freq to build_vocab. Note, `vocab_size` param does not work, torchtext fields have no support for it. Reviewed By: jinfengr Differential Revision: D16795720 fbshipit-source-id: cc60c3559bab391d4949306962d3d9bb2e1e6f87
1 parent a170dd4 commit 5dacbf1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎pytext/data/data_handler.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,12 @@ def init_target_metadata(
484484
if label.use_vocab:
485485
if not hasattr(label, "vocab"): # Don't rebuild vocab
486486
print("Building vocab for label {}".format(name))
487-
label.build_vocab(train_data, eval_data, test_data)
487+
label.build_vocab(
488+
train_data,
489+
eval_data,
490+
test_data,
491+
min_freq=getattr(label, "min_freq", 1),
492+
)
488493
else:
489494
print(f"Vocab for label {name} has been built. Not rebuilding.")
490495
print(

0 commit comments

Comments
 (0)
Please sign in to comment.