Giter Club home page Giter Club logo

Comments (3)

TobiasLee avatar TobiasLee commented on August 30, 2024

这里的 word2vec 文件存储的格式是第一行注明 vocab_siz embedding_size 的,读取的时候跳过了这一行。猜测是因为少了一行导致,可以把读取第一行的注释掉:

def Read_WordVec(config):
    with open(config.vec_file, 'r') as fvec:
        wordLS = []
        vec_ls =[]
        # fvec.readline() # 这一行是读取文件头信息的,如果没有信息可以注释掉,避免 size 不匹配

from sc-lstm.

19970623 avatar 19970623 commented on August 30, 2024

您好,请问这个问题解决了吗,我注释了fvec.readline(),但依然报错assert len(wordLS) == config.vocab_size
AssertionError

from sc-lstm.

hit-computer avatar hit-computer commented on August 30, 2024

@19970623 这里把 vocab_size 设置成词表大小就行了(即和 vec_file 里word数量相同)

from sc-lstm.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.