Giter VIP home page Giter VIP logo

Comments (3)

yudian931122 avatar yudian931122 commented on May 26, 2024

我也遇到了这个问题,将elmoformanylangs/elmo.py中的elmoformanylangs.elmo.Embedder.sents2elmo按照项目里SIFRank_zh-master/others/elmo.py的内容改一下,能正常运行了

from sifrank_zh.

piaofeng23 avatar piaofeng23 commented on May 26, 2024

我是改了才出的这个错误
File "C:/Users/飘枫/Desktop/SIFRank_zh-master/SIFRank_zh-master/test/test.py", line 21, in
keyphrases = SIFRank(text, SIF, zh_model, N=15,elmo_layers_weight=elmo_layers_weight)
File "C:\Users\飘枫\Desktop\SIFRank_zh-master\SIFRank_zh-master\model\method.py", line 179, in SIFRank
sent_embeddings, candidate_embeddings_list = SIF.get_tokenized_sent_embeddings(text_obj,if_DS=if_DS,if_EA=if_EA)
File "C:\Users\飘枫\Desktop\SIFRank_zh-master\SIFRank_zh-master\embeddings\sent_emb_sif.py", line 49, in get_tokenized_sent_embeddings
elmo_embeddings = self.word_embeddor.get_tokenized_words_embeddings(tokens_segmented)
File "C:\Users\飘枫\Desktop\SIFRank_zh-master\SIFRank_zh-master\embeddings\word_emb_elmo.py", line 29, in get_tokenized_words_embeddings
elmo_embedding = [np.pad(emb, pad_width=((0,0),(0,abs(max_len-emb.shape[1])),(0,0)) , mode='constant') for emb in elmo_embedding]
File "C:\Users\飘枫\Desktop\SIFRank_zh-master\SIFRank_zh-master\embeddings\word_emb_elmo.py", line 29, in
elmo_embedding = [np.pad(emb, pad_width=((0,0),(0,abs(max_len-emb.shape[1])),(0,0)) , mode='constant') for emb in elmo_embedding]
File "<array_function internals>", line 6, in pad
File "D:\PYTHON\envs\pytorch\lib\site-packages\numpy\lib\arraypad.py", line 746, in pad
pad_width = _as_pairs(pad_width, array.ndim, as_index=True)
File "D:\PYTHON\envs\pytorch\lib\site-packages\numpy\lib\arraypad.py", line 521, in _as_pairs
return np.broadcast_to(x, (ndim, 2)).tolist()
File "<array_function internals>", line 6, in broadcast_to
File "D:\PYTHON\envs\pytorch\lib\site-packages\numpy\lib\stride_tricks.py", line 180, in broadcast_to
return _broadcast_to(array, shape, subok=subok, readonly=True)
File "D:\PYTHON\envs\pytorch\lib\site-packages\numpy\lib\stride_tricks.py", line 125, in _broadcast_to
op_flags=['readonly'], itershape=shape, order='C')
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (3,2) and requested shape (2,2)

from sifrank_zh.

piaofeng23 avatar piaofeng23 commented on May 26, 2024

不知道这个是啥问题

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.