导入错误:没有名为“bword2vec”的模块

2024-03-29 12:21:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在做一个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'

你知道吗bsg.py公司

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的文件。你知道吗

bword2公司向量

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):
        ...

在这方面的任何建议都将不胜感激。你知道吗


Tags: infrompyimporthomelinetheanointerfaces