Giter VIP home page Giter VIP logo

Comments (3)

sunyilgdx avatar sunyilgdx commented on May 26, 2024

可否将elmo.py里修改后的代码贴一下,还有报的错

from sifrank_zh.

Sundyo avatar Sundyo commented on May 26, 2024

可否将elmo.py里修改后的代码贴一下,还有报的错

Traceback (most recent call last):
File "D:/大论文/类似项目代码参考/SIFRank/test/test.py", line 21, in
keyphrases = SIFRank(text, SIF, zh_model, N=15,elmo_layers_weight=elmo_layers_weight)
File "D:\大论文\类似项目代码参考\SIFRank\model\method.py", line 180, in SIFRank
sent_embeddings, candidate_embeddings_list = SIF.get_tokenized_sent_embeddings(text_obj,if_DS=if_DS,if_EA=if_EA)
File "D:\大论文\类似项目代码参考\SIFRank\embeddings\sent_emb_sif.py", line 48, in get_tokenized_sent_embeddings
elmo_embeddings = self.word_embeddor.get_tokenized_words_embeddings(tokens_segmented)
File "D:\大论文\类似项目代码参考\SIFRank\embeddings\word_emb_elmo.py", line 29, in get_tokenized_words_embeddings
elmo_embedding = [np.pad(emb, pad_width=((0,0),(0,max_len-emb.shape[1]),(0,0)) , mode='constant') for emb in elmo_embedding]
File "D:\大论文\类似项目代码参考\SIFRank\embeddings\word_emb_elmo.py", line 29, in
elmo_embedding = [np.pad(emb, pad_width=((0,0),(0,max_len-emb.shape[1]),(0,0)) , mode='constant') for emb in elmo_embedding]
File "<array_function internals>", line 6, in pad
File "F:\Anaconda3\envs\keyword_extraction\lib\site-packages\numpy\lib\arraypad.py", line 741, in pad
pad_width = _as_pairs(pad_width, array.ndim, as_index=True)
File "F:\Anaconda3\envs\keyword_extraction\lib\site-packages\numpy\lib\arraypad.py", line 512, in _as_pairs
raise ValueError("index can't contain negative values")
ValueError: index can't contain negative values

这是报错。我在项目文件夹里找到了三个elmo.py文件,而且内容也是不需要修改的,很奇怪,不知道是不是我运行方法有误

from sifrank_zh.

sunyilgdx avatar sunyilgdx commented on May 26, 2024

elmo.py 应该是在 Python36\Lib\site-packages\elmoformanylangs\elmo.py 这个文件下,你找找看

from sifrank_zh.

Related Issues (20)

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.