(train_dataset, fields, opt)
Building and saving the vocab
Building and saving the vocab
Building and saving the vocab
def build_save_vocab(train_dataset, fields, opt):
    """ Building and saving the vocab """
    fields = inputters.build_vocab(train_dataset, fields, opt.data_type,
                                   opt.share_vocab,
                                   opt.src_vocab,
                                   opt.src_vocab_size,
                                   opt.src_words_min_frequency,
                                   opt.tgt_vocab,
                                   opt.tgt_vocab_size,
                                   opt.tgt_words_min_frequency)

    # Can't save fields, so remove/reconstruct at training time.
    vocab_file = opt.save_data + '.vocab.pt'
    torch.save(inputters.save_fields_to_vocab(fields), vocab_file)
def build_save_vocab ( train_dataset , fields , opt ) : fields = inputters . build_vocab ( train_dataset , fields , opt . data_type , opt . share_vocab , opt . src_vocab , opt . src_vocab_size , opt . src_words_min_frequency , opt . tgt_vocab , opt . tgt_vocab_size , opt . tgt_words_min_frequency ) # Can't save fields, so remove/reconstruct at training time. vocab_file = opt . save_data + '.vocab.pt' torch . save ( inputters . save_fields_to_vocab ( fields ) , vocab_file )