I am facing a problem with the sci kit neural network (sknn) module.
The code:
from sknn.mlp import Regressor, Layer
capasinicio = TodasEstaciones.loc['2015-01-12':'2015-03-31'].as_matrix()[:,[0,2]]
capasalida = TodasEstaciones.loc['2015-01-12':'2015-03-31'].as_matrix()[:,1]
neurones = 1000
tasaaprendizaje = 0.00001
numiteraciones = 9000
#Definition of the training for the neural network
redneural = Regressor(
layers=[
Layer("ExpLin", units=neurones),
Layer("ExpLin", units=neurones), Layer("Linear")],
learning_rate=tasaaprendizaje,
n_iter=numiteraciones)
redneural.fit(capasinicio, capasalida)
#Get the prediction for the train set
valortest = ([])
for i in range(capasinicio.shape[0]):
prediccion = redneural.predict(np.array([capasinicio[i,:].tolist()]))
valortest.append(prediccion[0][0])
The error message:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-e1e3c4d6d246> in <module>()
----> 1 from sknn.mlp import Regressor, Layer
2
3 capasinicio = TodasEstaciones.loc['2015-01-12':'2015-03-31'].as_matrix()[:,[0,2]]
4 capasalida = TodasEstaciones.loc['2015-01-12':'2015-03-31'].as_matrix()[:,1]
5 neurones = 1000
ModuleNotFoundError: No module named 'sknn'
It appears that installing the module through pip
pip install scikit-neuralnetwork
does not solve the problem
any help would be appreciated :)
what worked for me: I uninstalled both python and anaconda, then reinstalled anaconda while specifying that its corresponding PATH gets the priority when calling modules (an option that is not recommended by the developers).
Related
I am working on google colab with the segmentation_models library. It worked perfectly the first week using it, but now it seems that I can't import the library anymore. Here is the error message, when I execute import segmentation_models as sm :
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-6f48ce46383f> in <module>
1 import tensorflow as tf
----> 2 import segmentation_models as sm
3 frames
/usr/local/lib/python3.8/dist-packages/efficientnet/__init__.py in init_keras_custom_objects()
69 }
70
---> 71 keras.utils.generic_utils.get_custom_objects().update(custom_objects)
72
73
AttributeError: module 'keras.utils.generic_utils' has no attribute 'get_custom_objects'
Colab uses tensorflow version 2.11.0.
I did not find any information about this particular error message. Does anyone know where the problem may come from ?
Encountered the same issue sometimes. How I solved it:
open the file keras.py, change all the 'init_keras_custom_objects' to 'init_tfkeras_custom_objects'.
the location of the keras.py is in the error message. In your case, it should be in /usr/local/lib/python3.8/dist-packages/efficientnet/
I am trying to import a package 'xagg' but it gives me the error described below. I managed to install 'xagg' but the following error popped up when I try to import it
Here is the command line
import xagg as xa
The error I got:
ModuleNotFoundError Traceback (most recent call last)
Input In [15], in <module>
----> 1 import xagg as xa
File ~\AppData\Roaming\Python\Python39\site-packages\xagg\__init__.py:5, in <module>
1 # Eventually restrict to just pixel_overlaps and aggregate; with
2 # everything else happening behind the scenes (and the exporting
3 # happening as methods to the classes that are exported from those
4 # two functions)
----> 5 from .wrappers import pixel_overlaps
6 from .aux import (normalize,fix_ds,get_bnds,subset_find)
7 from .core import aggregate
ModuleNotFoundError: No module named 'xagg.wrappers'
OS: Windows
pip install wrapper
I hope it work
I am trying to use ELMoForManyLangs programmatically, by using Embedder python object.
from elmoformanylangs import Embedder
e = Embedder('/content/drive/MyDrive/ColabNotebooks/158', batch_size = 64)
When I run, I am getting the following error:
TypeError Traceback (most recent call last)
<ipython-input-11-e628da2114ae> in <module>()
----> 1 from elmoformanylangs import Embedder
2 # e = Embedder('/content/drive/MyDrive/ColabNotebooks/158', batch_size = 64)
10 frames
/usr/local/lib/python3.7/dist-packages/overrides/signature.py in ensure_all_positional_args_defined_in_sub(super_sig, sub_sig, super_type_hints, sub_type_hints, check_first_parameter, method_name)
193 if super_param.kind == Parameter.VAR_POSITIONAL:
194 if not sub_has_var_args:
--> 195 raise TypeError(f"{method_name}: `{super_param.name}` must be present")
196 continue
197 if (
TypeError: Highway.forward: `input` must be present
Do you have any suggestions to fix it?
I had the same issue. It seems to be a problem related to overrides package.
I solve downgrading the 'overrides' package in my virtual-env. In particular I switched from overrides==6.0.1 to overrides==3.1.0.
So you should try to do:
pip uninstall overrides
pip install overrides==3.1.0
Iam getting the below error ModuleNotFoundError: No module named 'rasa_nlu', even though i installed rasa_nlu and rasa
My code :
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer
def train_nlu(data, config, model_dir):
training_data = load_data(data)
trainer = Trainer(RasaNLUConfig(config))
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name='weathernlu')
if __name__ == '__main__':
train_nlu('.data/data.json', 'config_spacy.json', './models/nlu')
Error message:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-6ab2834ad68f> in <module>()
----> 1 from rasa_nlu.training_data import load_data
2 #from rasa_nlu.converters import load_data
3 from rasa_nlu.config import RasaNLUConfig
4 from rasa_nlu.model import Trainer
5
ModuleNotFoundError: No module named 'rasa_nlu'
Someone please help me
In Rasa >= 1.0, there is no separate installation of NLU. It's just rasa, and then in code you'd access rasa.nlu. Make sure you're looking at the latest version of the docs and have installed the latest version of rasa - https://rasa.com/docs/rasa/user-guide/installation/
Working with torch package:
import torch
from torch.autograd import Variable
x_data = [1.0,2.0,3.0]
y_data = [2.0,4.0,6.0]
w = Variable(torch.Tensor([1.0]), requires_grad = True)
def forward(x):
return x*w
def loss(x,y):
y_pred = forward(x)
return (y_pred-y)*(y_pred-y)
print("my prediction before training",4,forward(4))
for epoch in range(10):
for x_val, y_val in zip(x_data,y_data):
l= loss(x_val, y_val)
l.backward()
print("\tgrad: ", x_val, y_val, w.grad.data[0])
w.data=w.data-0.01*w.grad.data
w.grad.data.zero_()
print("progress:", epoch, l.data[0] )
print("my new prediction after training ", forward(4))
Got error:
runfile('C:/gdrive/python/temp2.py', wdir='C:/gdrive/python')
Traceback (most recent call last):
File "C:\gdrive\python\temp2.py", line 11, in <module>
from torch.autograd import Variable
ModuleNotFoundError: No module named 'torch.autograd'
Command conda list pytorch brings:
# packages in environment at C:\Users\g\.conda\envs\test:
#
# Name Version Build Channel
(test) PS C:\gdrive\python>
How to fix this problem?
It seems to me that you have installed pytorch using conda.
Might be you have torch named folder in your current directory.
Try changing the directory, or try installing pytorch using pip.
This https://github.com/pytorch/pytorch/issues/1851 might help you to solve your problem.
People who are using pip:
pip install torchvision