我正在做一个python项目,试图让它运行起来。然而,我不断得到以下错误。你知道吗
ImportError: No module named 'bword2vec'
Traceback (most recent call last):
File "/home/nayantara/PycharmProjects/BSG/run_bsg.py", line 3, in <module>
from interfaces.interface_configurator import InterfaceConfigurator
File "/home/nayantara/PycharmProjects/BSG/interfaces/interface_configurator.py", line 4, in <module>
from interfaces.i_bsg import IBSG
File "/home/nayantara/PycharmProjects/BSG/interfaces/i_bsg.py", line 1, in <module>
from models.bsg import BSG
File "/home/nayantara/PycharmProjects/BSG/models/bsg.py", line 3, in <module>
from bword2vec import BWord2Vec
ImportError: No module named 'bword2vec'
import theano from theano import tensor as T, printing from bword2vec import BWord2Vec from layers.custom.bsg_encoder import BSGEncoder from layers.standard.dense import Dense from layers.standard.embeddings import Embeddings from libraries.utils.other import merge_ordered_dicts class BSG(BWord2Vec): """ Theano implementation of the Bayesian Skip-gram model. """ def __init__(self, vocab_size, input_dim=50, hidden_dim=50, latent_dim=100, lr_opt=None, margin=1., model_name='BSG with the hinge loss'): """ :param vocab_size: the number of unique words ... ...
在同一个文件夹中还有一个名为bword2vec.py
的文件。你知道吗
import pickle import os import theano from support import load, write_vectors, kl_spher from pickle import UnpicklingError from libraries.tools.ordered_attrs import OrderedAttrs ## theano configuration theano.optimizer_including = 'cudnn' class BWord2Vec(OrderedAttrs): #Base class for the Bayesian Skip-gram model, it contains methods that can be #used for multiple variants of BSG. def __init__(self): OrderedAttrs.__init__(self) ... def initialize_param(self, param_name, param_value): ...
在这方面的任何建议都将不胜感激。你知道吗
我以前也遇到过这个问题。 你能检查一下在同一个文件夹中是否有
__init__.py
吗? 如果丢失,请手动创建相同的文件并重试。 希望它能起作用。请告诉我们进展如何。你知道吗相关问题 更多 >
编程相关推荐