Я работаю над проектом Python, пытаясь заставить его работать. Тем не менее, я продолжаю получать следующую ошибку.
ImportError: нет модуля с именем 'bword2vec'
Traceback
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'
bsg.py
import theano
from theano import tensor as T, printing
<b>from bword2vec import BWord2Vec</b>
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
<b>class BSG(BWord2Vec)</b>:
"""
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
.
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):
...
Любые предложения на этот счет будут высоко оценены.