2017-01-15 4 views
6

Ich habe installiert GENSIM (durch pip) in Python. Nachdem die Installation über ich die folgende Warnung erhalten:Chunkize Warnung bei der Installation GENSIM

C: \ Python27 \ lib \ site-packages \ GENSIM \ utils.py: 855: UserWarning: erfasst Windows-; Aliasing chunkize warnings.warn chunkize_serial ("erkannt Windows-; Aliasing chunkize chunkize_serial")

Wie kann ich das beheben?

Ich bin zu importieren word2vec von gensim.models aufgrund dieser Warnung nicht in der Lage.

Ich habe die folgenden Konfigurationen: Python 2.7, Gensim-0.13.4.1, Numpy-1.11.3, Scipy-0.18.1, Muster-2.6.

Antwort

12

Sie können die Nachricht mit diesem Code unterdrücken vor GENSIM importieren:

import warnings 
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim') 

import gensim 
+0

Hallo! @Roland, Thnx. seine Arbeits jetzt – user7420652

+0

@ user7420652 Hey, danke für Ihre Antwort und glücklich zu wissen! Stack Overflow funktioniert so: Anstatt zu kommentieren (es sei denn, Sie möchten weitere Informationen hinzufügen), können Sie Antworten aufwerten, die hilfreich sind. Wenn das Problem gelöst ist, wählen Sie eine der Antworten als "Lösung", indem Sie auf das Häkchen links klicken von dieser Antwort. –

12

ich denke, ist kein großes Problem. GENSIM nur Sie wissen lassen, dass sie Alias ​​andere Funktion chunkize führen, dass Sie bestimmte os verwenden.

Überprüfung der Code von gensim.utils

if os.name == 'nt': 
    logger.info("detected Windows; aliasing chunkize to chunkize_serial") 

    def chunkize(corpus, chunksize, maxsize=0, as_numpy=False): 
     for chunk in chunkize_serial(corpus, chunksize, as_numpy=as_numpy): 
      yield chunk 
else: 
    def chunkize(corpus, chunksize, maxsize=0, as_numpy=False): 
    """ 
    Split a stream of values into smaller chunks. 
    Each chunk is of length `chunksize`, except the last one which may be smaller. 
    A once-only input stream (`corpus` from a generator) is ok, chunking is done 
    efficiently via itertools. 

    If `maxsize > 1`, don't wait idly in between successive chunk `yields`, but 
    rather keep filling a short queue (of size at most `maxsize`) with forthcoming 
    chunks in advance. This is realized by starting a separate process, and is 
    meant to reduce I/O delays, which can be significant when `corpus` comes 
    from a slow medium (like harddisk). 

    If `maxsize==0`, don't fool around with parallelism and simply yield the chunksize 
    via `chunkize_serial()` (no I/O optimizations). 

    >>> for chunk in chunkize(range(10), 4): print(chunk) 
    [0, 1, 2, 3] 
    [4, 5, 6, 7] 
    [8, 9] 

    """ 
    assert chunksize > 0 

    if maxsize > 0: 
     q = multiprocessing.Queue(maxsize=maxsize) 
     worker = InputQueue(q, corpus, chunksize, maxsize=maxsize, as_numpy=as_numpy) 
     worker.daemon = True 
     worker.start() 
     while True: 
      chunk = [q.get(block=True)] 
      if chunk[0] is None: 
       break 
      yield chunk.pop() 
    else: 
     for chunk in chunkize_serial(corpus, chunksize, as_numpy=as_numpy): 
      yield chunk 
+0

Ich habe meine Frage bearbeitet. wenn ich schreibe: von gensim.models Import word2vec, erhalte ich die chunkize Warnung. – user7420652

+0

Hallo! @ Dongmin Pete Shin, die Dinge funktionieren gut. thnx für die Hilfe. – user7420652

Verwandte Themen