Skip to content

avoid division by zero#2404

Merged
mpenkov merged 2 commits into
piskvorky:developfrom
mpenkov:zerodiv
Mar 7, 2019
Merged

avoid division by zero#2404
mpenkov merged 2 commits into
piskvorky:developfrom
mpenkov:zerodiv

Conversation

@mpenkov
Copy link
Copy Markdown
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