Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc2Vec loss always showing 0 #3183

Closed
griff4692 opened this issue Jun 28, 2021 · 2 comments
Closed

Doc2Vec loss always showing 0 #3183

griff4692 opened this issue Jun 28, 2021 · 2 comments

Comments

@griff4692
Copy link

class MonitorCallback(CallbackAny2Vec):
    def __init__(self, test_cui, test_sec):
        self.test_cui = test_cui
        self.test_sec = test_sec

    def on_epoch_end(self, model):
        print('Model loss:', model.get_latest_training_loss())
        for word in self.test_cui:  # show wv logic changes
             print(word, model.wv.most_similar(word))
        for word in self.test_sec:  # show dv logic changes
             print(word, model.dv.most_similar(word))
    model = Doc2Vec(vector_size=300, min_count=1, epochs=1, window=5, workers=32)
    print('Building vocab...')
    model.build_vocab(train_corpus)
    print(model.corpus_count, model.epochs)
    model.train(
        train_corpus, total_examples=model.corpus_count, compute_loss=True, epochs=model.epochs, callbacks=[monitor])
    print('Done training...')
    model.save('sec2vec.model')

Each time the callback prints, it prints 0. The second issue is that after the first epoch, the model seems pretty good according to calls to most_similar. Yet, after the second it appears random. I have a fairly large dataset so I don't think dramatic overfitting is happening. Is there a bug after the first epoch or is the learning rate getting messed up? It's tough to know what's going on because there's no within-epoch logging and the training loss is always evaluating to 0.

@griff4692
Copy link
Author

Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0
Model loss: 0.0

To be clear, here is a log of the model loss

@gojomo
Copy link
Collaborator

gojomo commented Jun 28, 2021

As per #2983, Doc2Vec loss-tracking has never been implemented. Closing this as duplicate; will discuss further there.

@gojomo gojomo closed this as completed Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants