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

avoid division by zero #2404

Merged
merged 2 commits into from
Mar 7, 2019
Merged

avoid division by zero #2404

merged 2 commits into from
Mar 7, 2019

Conversation

mpenkov
Copy link
Collaborator

@mpenkov mpenkov commented Mar 7, 2019

Fix #2377

Test code:

from gensim.models.fasttext import FastText
from gensim.utils import tokenize
from gensim.test.utils import datapath
import smart_open

import logging
logging.basicConfig(level=logging.ERROR)

path = datapath('alldata-id-10.txt')
with smart_open.smart_open(path, 'r', encoding='utf-8') as fin:
    sentences = [l.rstrip() for l in fin]
model = FastText(sentences=sentences, sg=1, hs=1, min_n=4, max_n=6)
print(model)

On develop HEAD (b868073):

Segmentation fault (core dumped)

On this branch:

FastText(vocab=39, size=100, alpha=0.025)

@mpenkov mpenkov added the 3.7.2 label Mar 7, 2019
@mpenkov mpenkov merged commit d8bad9d into piskvorky:develop Mar 7, 2019
@mpenkov mpenkov deleted the zerodiv branch March 7, 2019 06:18
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

Successfully merging this pull request may close these issues.

1 participant