text stringlengths 81 47k | source stringlengths 59 147 |
|---|---|
Question: <p>I am trying to run an example that uses keras/tensorflow. I am using Keras 2.0.8.
When I write this simple code:</p>
<pre><code>from keras.layers import ZeroPadding2D
pad = ZeroPadding2D(padding=(1, 1), data_format=None)
</code></pre>
<p>and try to debug <code>ZeroPadding2D</code> I am directed to a file... | https://stackoverflow.com/questions/47017035/keras-2-code-is-executing-keras-1-compatibility-code |
Question: <p>From the Keras documentation:</p>
<p>dropout: Float between 0 and 1. Fraction of the units to drop for the
linear transformation of the inputs.</p>
<p>recurrent_dropout: Float between 0 and 1. Fraction of the units to
drop for the linear transformation of the recurrent state.</p>
<p>Can anyone point t... | https://stackoverflow.com/questions/44924690/keras-the-difference-between-lstm-dropout-and-lstm-recurrent-dropout |
Question: <p>I am working on predicting the <a href="https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average" rel="nofollow noreferrer">EWMA (exponential weighted moving average) formula</a> on a time series using a simple RNN. Already posted about it <a href="https://stackoverflow.com/questions/5734809... | https://stackoverflow.com/questions/57396482/exact-model-converging-on-keras-tf-but-not-on-keras |
Question: <p>Trying to run a trained keras model with the following python code:</p>
<pre class="lang-py prettyprint-override"><code>from keras.preprocessing.image import img_to_array
from keras.models import load_model
from imutils.video import VideoStream
from threading import Thread
import numpy as np
import imuti... | https://stackoverflow.com/questions/58878421/unexpected-keyword-argument-ragged-in-keras |
Question: <p>I have just built my first model using Keras and this is the output. It looks like the standard output you get after building any Keras artificial neural network. Even after looking in the documentation, I do not fully understand what the epoch is and what the loss is which is printed in the output.</p>
<... | https://stackoverflow.com/questions/34673396/what-does-the-standard-keras-model-output-mean-what-is-epoch-and-loss-in-keras |
Question: <p>I have a simple NN model for detecting hand-written digits from a 28x28px image written in python using Keras (Theano backend):</p>
<pre><code>model0 = Sequential()
#number of epochs to train for
nb_epoch = 12
#amount of data each iteration in an epoch sees
batch_size = 128
model0.add(Flatten(input_shap... | https://stackoverflow.com/questions/36946671/keras-model-summary-result-understanding-the-of-parameters |
Question: <p>I use the following code when training a model in keras</p>
<pre><code>from keras.callbacks import EarlyStopping
model = Sequential()
model.add(Dense(100, activation='relu', input_shape = input_shape))
model.add(Dense(1))
model_2.compile(optimizer='adam', loss='mean_squared_error', metrics=['accuracy'])... | https://stackoverflow.com/questions/48285129/saving-best-model-in-keras |
Question: <p>I would like to custom a Keras loss function but I do not really understand something.</p>
<p>If I use tensorflow as a backend for Keras, do I need to use functions from <code>keras.backend</code> or can I use functions directly from tensorflow.</p>
<p>I only see posts where people are using functions fr... | https://stackoverflow.com/questions/52534202/keras-backend-tensorflow-vs-keras |
Question: <p>I create an virtual environment in my conda named 'keras_ev' and install the keras in it
by </p>
<pre><code>conda install keras
</code></pre>
<p>after that when i </p>
<pre><code>activate keras_ev
jupyter notebook
</code></pre>
<p>the notebook does not show my keras_ev environment <a href="https://i.s... | https://stackoverflow.com/questions/47659318/keras-installation |
Question: <p>I am trying to install keras on a Windows pc (procedure has to be done offline) I have downloaded (through another pc then transfered to this one) wheels for both modules and I am trying to install them by pip install . However, keras needs keras-applications installed and keras-applications needs keras in... | https://stackoverflow.com/questions/54402523/keras-and-keras-applications-dependencies |
Question: <p>I am building a multi-class classifier with Keras 2.02 (with Tensorflow backend),and I do not know how to calculate precision and recall in Keras. Please help me.</p>
Answer: <p>Python package <a href="https://pypi.org/project/keras-metrics/" rel="noreferrer" title="keras-metrics">keras-metrics</a> could ... | https://stackoverflow.com/questions/43076609/how-to-calculate-precision-and-recall-in-keras |
Question: <p>I'm working with Keras and I'm trying to rewrite categorical_crossentropy by using the Keras abstract backend, but I'm stuck. </p>
<p>This is my custom function, I want just the weighted sum of crossentropy:</p>
<pre><code>def custom_entropy( y_true, y_pred):
y_pred /= K.sum(y_pred, axis=-1, keepdims... | https://stackoverflow.com/questions/47555568/keras-crossentropy |
Question: <p>I have installed Keras, and wanted to switch the backend to Theano. I checked out <a href="https://stackoverflow.com/questions/40036748/keras-backend-importerror-cannot-import-name-ctc-ops">this post</a>, but still have no idea where to put the created json file. Also, below is the error I got when running... | https://stackoverflow.com/questions/40310035/how-to-change-keras-backend-wheres-the-json-file |
Question: <p>I am trying to modify the lstm_seq2seq.py example of keras, to modify it to a bidirectional lstm model.</p>
<p><a href="https://github.com/keras-team/keras/blob/master/examples/lstm_seq2seq.py" rel="noreferrer">https://github.com/keras-team/keras/blob/master/examples/lstm_seq2seq.py</a></p>
<p>I try diff... | https://stackoverflow.com/questions/47923370/keras-bidirectional-lstm-seq2seq |
Question: <p>I am using Python 3.6 and Tensorflow 2.0, and have some Keras codes:</p>
<pre><code>import keras
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(1))
model.compile(optimizer='adam',loss='mean_squared_error',metrics=['accuracy'])
</code></pre>
<p>When ... | https://stackoverflow.com/questions/62690377/tensorflow-compatibility-with-keras |
Question: <p>Are these libraries fairly interchangeable?</p>
<p>Looking here, <a href="https://stackshare.io/stackups/keras-vs-pytorch-vs-scikit-learn" rel="noreferrer">https://stackshare.io/stackups/keras-vs-pytorch-vs-scikit-learn</a>, it seems the major difference is the underlying framework (at least for PyTorch).... | https://stackoverflow.com/questions/54527439/differences-in-scikit-learn-keras-or-pytorch |
Question: <p>Using Anaconda Python 2.7 Windows 10.</p>
<p>I am training a language model using the Keras exmaple:</p>
<pre><code>print('Build model...')
model = Sequential()
model.add(GRU(512, return_sequences=True, input_shape=(maxlen, len(chars))))
model.add(Dropout(0.2))
model.add(GRU(512, return_sequences=False))... | https://stackoverflow.com/questions/36952763/how-to-return-history-of-validation-loss-in-keras |
Question: <p>Based on the famous <code>check_blas.py</code> script, I wrote this one to check that theano can in fact use multiple cores:</p>
<pre class="lang-py prettyprint-override"><code>import os
os.environ['MKL_NUM_THREADS'] = '8'
os.environ['GOTO_NUM_THREADS'] = '8'
os.environ['OMP_NUM_THREADS'] = '8'
os.envir... | https://stackoverflow.com/questions/36908978/keras-not-using-multiple-cores |
Question: <p>I have cloned human pose estimation keras model from this link <a href="https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation" rel="noreferrer">human pose estimation keras</a> </p>
<p>When I try to load the model on google colab, I get the following error</p>
<p>code</p>
<pre><code>... | https://stackoverflow.com/questions/53212672/read-only-mode-in-keras |
Question: <p>Hi I have been trying to make a custom loss function in keras for dice_error_coefficient. It has its implementations in <strong>tensorboard</strong> and I tried using the same function in keras with tensorflow but it keeps returning a <strong>NoneType</strong> when I used <strong>model.train_on_batch</stro... | https://stackoverflow.com/questions/45961428/make-a-custom-loss-function-in-keras |
Question: <p>can anyone tell me how is backpropagation done in Keras? I read that it is really easy in Torch and complex in Caffe, but I can't find anything about doing it with Keras. I am implementing my own layers in Keras (A very beginner) and would like to know how to do the backward propagation. </p>
<p>Thank you... | https://stackoverflow.com/questions/47416861/backward-propagation-in-keras |
Question: <p>I reference the link: <a href="https://stackoverflow.com/questions/46464549/keras-custom-loss-function-accessing-current-input-pattern">Keras custom loss function: Accessing current input pattern</a>.</p>
<p>But I get error: " TypeError: Cannot convert a symbolic Keras input/output to a numpy array.... | https://stackoverflow.com/questions/66287143/keras-loss-functionfrom-keras-input |
Question: <p>Try to run Keras in MacOSX, using a virtual environment</p>
<p><strong>Versions</strong></p>
<ul>
<li>MacOSX: 10.12.4 (16E195) </li>
<li>Python 2.7</li>
</ul>
<p><strong>Troubleshooting</strong></p>
<ul>
<li>Recreate Virtualenv</li>
<li>Reinstall keras</li>
</ul>
<p><strong>Logs</strong></p>
<pre><co... | https://stackoverflow.com/questions/44612653/keras-no-module-named-models |
Question: <pre><code>import tensorflow as tf
from tensorflow import keras
</code></pre>
<p>Results are</p>
<pre><code>ImportError Traceback (most recent call last)
<ipython-input-1-75a28e3c6620> in <module>
1 import tensorflow as tf
----> 2 from tensorflow import keras... | https://stackoverflow.com/questions/63687206/cannot-import-name-keras-error-when-importing-keras |
Question: <p>I'm using anaconda ver 3, and I have installed python as well separately from anaconda. I installed python ver 2.7 and ver 3.6 from python website. </p>
<p>Now, I have installed keras from anaconda command prompt by using conda install keras. However, when I open jupyter notebook and write :</p>
<pre><co... | https://stackoverflow.com/questions/61069835/no-module-named-keras-after-installing-keras |
Question: <p>I am implementing ApesNet in keras. It has an ApesBlock that has skip connections. How do I add this to a sequential model in keras? The ApesBlock has two parallel layers that merge at the end by element-wise addition.<img src="https://i.sstatic.net/UrFP8.png" alt="enter image description here"></p>
Answe... | https://stackoverflow.com/questions/42384602/implementing-skip-connections-in-keras |
Question: <p>I was importing keras in my jupyter notebook, but I'm getting <strong>cannot import name 'layers' from 'keras'</strong></p>
<p>Traceback:</p>
<pre><code>ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_9104\626967271.py in <module>
1 imp... | https://stackoverflow.com/questions/77083867/getting-cannot-import-name-layers-from-keras-while-importing-keras |
Question: <p>I'd like to update Keras to version 2.3.0 with conda.
Currently, I've got Keras 2.2.4 running. </p>
<p>First, I tried </p>
<pre><code>conda update keras
</code></pre>
<p>which didn't work.
Then I tried</p>
<pre><code>conda install -c conda-forge keras
conda install -c conda-forge/label/broken keras
con... | https://stackoverflow.com/questions/58268587/how-to-update-keras-with-conda |
Question: <p>I have a multi output(200) binary classification model which I wrote in keras.</p>
<p>In this model I want to add additional metrics such as ROC and AUC but to my knowledge keras dosen't have in-built ROC and AUC metric functions.</p>
<p>I tried to import ROC, AUC functions from scikit-learn</p>
<pre><code... | https://stackoverflow.com/questions/41032551/how-to-compute-receiving-operating-characteristic-roc-and-auc-in-keras |
Question: <p>For a Feedforward Network (FFN), it is easy to compute the number of parameters. Given a CNN, LSTM etc is there a quick way to find the number of parameters in a keras model?</p>
Answer: <p>Models and layers have special method for that purpose:</p>
<pre><code>model.count_params()
</code></pre>
<p>Also,... | https://stackoverflow.com/questions/35792278/how-to-find-number-of-parameters-of-a-keras-model |
Question: <p>I understand that tensorflow version 2.x are eager execution enabled. However, I see a big performance and speed difference if I import Keras from tensorflow via <code>tensorflow.python.keras</code> vs <code>tensorflow.keras</code>. I am using tensorflow version 2.3.1.</p>
<p>I can train my model much fast... | https://stackoverflow.com/questions/64749519/diff-between-importing-keras-as-from-tensorflow-python-import-keras-vs-from-t |
Question: <p>This is a piece of code I get from github for hierarchical attention network,the code is originally in Keras 1.2.2. now I have to change it to compile with Keras 2.0.5, however, it has such error messages that I could not solve.</p>
<p>The original code is the following</p>
<pre class="lang-py prettyprin... | https://stackoverflow.com/questions/46994409/why-the-keras-code-get-error-messages-when-changing-from-keras-1-2-2-to-keras-2 |
Question: <p>My data can be viewed as a matrix of 10B entries (100M x 100), which is very sparse (< 1/100 * 1/100 of entries are non-zero). I would like to feed the data into into a Keras Neural Network model which I have made, using a Tensorflow backend.</p>
<p>My first thought was to expand the data to be dense,... | https://stackoverflow.com/questions/41538692/using-sparse-matrices-with-keras-and-tensorflow |
Question: <p>I am trying to write my own keras layer. In this layer, I want to use some other keras layers. Is there any way to do something like this:</p>
<pre><code>class MyDenseLayer(tf.keras.layers.Layer):
def __init__(self, num_outputs):
super(MyDenseLayer, self).__init__()
self.num_outputs = num_output... | https://stackoverflow.com/questions/54194724/how-to-use-keras-layers-in-custom-keras-layer |
Question: <p>I am kinda new to keras. I managed to build a network which has two outputs:</p>
<pre><code>q_dot_P : <tf.Tensor 'concatenate_1/concat:0' shape=(?, 7) dtype=float32>
q_dot_N : <tf.Tensor 'concatenate_2/concat:0' shape=(?, 10) dtype=float32>
</code></pre>
<p><a href="https://i.sstatic.net/HhJB... | https://stackoverflow.com/questions/52661518/keras-custom-loss |
Question: <p>I am setting up my computer to run DL with a GPU and I couldn't find info on whether one should install keras or keras-gpu. Currently I have it running with conda and keras using tensorflow-gpu as backend. What would be the difference if I switch keras to keras-gpu? </p>
Answer: <p>this is a paragraph bor... | https://stackoverflow.com/questions/52988311/what-is-the-difference-between-keras-and-keras-gpu |
Question: <p>I have tried reinstalling anaconda. I also tried uninstalling and reinstalling keras.
I have tensorflow 2.3.0 and keras 2.4.3 installed. But I just can't seem to be able to import keras.
This is my import statement.</p>
<pre><code>from keras.models import Sequential
from keras.layers import Dense, LSTM
fr... | https://stackoverflow.com/questions/65682994/modulenotfounderror-no-module-named-keras-cant-import-keras |
Question: <p>I'm trying to import keras and the code returns an error about tensorflow.</p>
<pre><code>import numpy
import matplotlib.pyplot as plt
import pandas
import math
from keras.models import Sequential
from keras.layers import Dense
</code></pre>
<p>and the error says:</p>
<pre><code>Using TensorFlow backend... | https://stackoverflow.com/questions/53689722/importing-keras |
Question: <p>I have a problem with keras; I've installed it once but somehow I cannot import it anymore since I recently installed some other packages. If I want to import keras, I get the following error (among many other warnings etc.):</p>
<pre><code>ModuleNotFoundError: No module named 'tensorflow.tsl'
</code></pre... | https://stackoverflow.com/questions/74640526/trouble-installing-keras |
Question: <p>Currently I use the following code:</p>
<pre><code>callbacks = [
EarlyStopping(monitor='val_loss', patience=2, verbose=0),
ModelCheckpoint(kfold_weights_path, monitor='val_loss', save_best_only=True, verbose=0),
]
model.fit(X_train.astype('float32'), Y_train, batch_size=batch_size, nb_epoch=nb_epo... | https://stackoverflow.com/questions/37293642/how-to-tell-keras-stop-training-based-on-loss-value |
Question: <p>I've got multiple outputs from my model from multiple Dense layers. My model has <code>'accuracy'</code> as the only metric in compilation. I'd like to know the loss and accuracy for each output. This is some part of my code.</p>
<pre><code>scores = model.evaluate(X_test, [y_test_one, y_test_two], verbose... | https://stackoverflow.com/questions/51299836/what-values-are-returned-from-model-evaluate-in-keras |
Question: <p>I ran the same code (with the same data) on CPU first using keras 1.2.0 and then keras 2.0.3 in both codes keras is with TensorFlow backend and also I used sklearn for model selection, plus pandas to read data. </p>
<p>I was surprised when I got the MSE(Mean squared error) of 42 using keras 2.0.3 and 21 u... | https://stackoverflow.com/questions/43637515/getting-worse-result-using-keras-2-than-keras-1 |
Question: <p>I'm relatively new to Keras and Tensorflow and I want to learn the basic implementations. For this I want to build a model that can learn/detect/predict handwritten digits, therefore I use the MNIST-dataset from Keras. I already created this model with the Keras Functional API and everything works fine. No... | https://stackoverflow.com/questions/61140515/convert-keras-fuctional-api-into-a-keras-subclassed-model |
Question: <p><strong><em>What I am doing</em></strong><br>
I am training and using a convolutional neuron network (CNN) for image-classification using Keras with Tensorflow-gpu as backend.</p>
<p><strong><em>What I am using</em></strong><br>
- PyCharm Community 2018.1.2<br>
- both Python 2.7 and 3.5 (but not both at a... | https://stackoverflow.com/questions/50895110/what-do-i-need-k-clear-session-and-del-model-for-keras-with-tensorflow-gpu |
Question: <p>I'm trying to add Keras module into PyCharm. Keras is installed into <code>/usr/local/lib/python2.7/site-packages/Keras-1.0.8-py2.7.egg</code>.</p>
<p>PyCharm interpreter settings looks like that:</p>
<p><a href="https://i.sstatic.net/WKhcW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/W... | https://stackoverflow.com/questions/39523550/pycharm-cant-find-keras |
Question: <p>I can't import <code>Keras</code> in PyCharm IDE on a Mac. I have tried installing and uninstalling Keras using both <code>pip</code>, <code>pip3</code>, <code>conda</code>, and easy install, but none worked. I have tried changing interpreters (Python 2.7 and 3.6) but neither worked.</p>
<p>In a terminal,... | https://stackoverflow.com/questions/52174530/modulenotfounderror-no-module-named-keras |
Question: <p>I am trying to install keras using my conda environment. I have been instructed to install the keras with Tensorflow backend using the following command:</p>
<blockquote>
<p>install -c hesi_m keras</p>
</blockquote>
<p>But the problem is it downloads some packages and then errors outs follows:</p>
<pr... | https://stackoverflow.com/questions/50784067/anaconda-keras-installation-issue |
Question: <p>In Keras, if you need to have a custom loss with additional parameters, we can use it like mentioned on <a href="https://datascience.stackexchange.com/questions/25029/custom-loss-function-with-additional-parameter-in-keras">https://datascience.stackexchange.com/questions/25029/custom-loss-function-with-add... | https://stackoverflow.com/questions/48373845/loading-model-with-custom-loss-keras |
Question: <p>I am Creating a leaf Identification Classifier using the CNN, the Keras and the Tensorflow backends on Windows. I have installed Anaconda, Tensorflow, numpy, scipy and keras.</p>
<p>I installed keras using pip3:</p>
<pre><code>C:\> pip3 list | grep -i keras
Keras 2.2.4
Keras-Applications... | https://stackoverflow.com/questions/54050581/installed-keras-with-pip3-but-getting-the-no-module-named-keras-error |
Question: <p>I am working on Udacity Self-driving Car project which teaches a car to run autonomously(Behavior Clonning).</p>
<p>I am getting a weird Unicode error.</p>
<p>The Error Stated is as follows:</p>
<blockquote>
<p>(dl) Vidits-MacBook-Pro-2:BehavioralClonning-master ViditShah$ python drive.py model.h5
... | https://stackoverflow.com/questions/48211904/keras-version-error |
Question: <p>For several days now, I'm trying to replicate my keras training results with pytorch. Whatever I do, the pytorch model will overfit far earlier and stronger to the validation set then in keras. For pytorch I use the same XCeption Code from <a href="https://github.com/Cadene/pretrained-models.pytorch" rel="... | https://stackoverflow.com/questions/50079735/pytorch-vs-keras-pytorch-model-overfits-heavily |
Question: <p>I am implementing own Keras loss function. How can I access tensor values?</p>
<p>What I've tried</p>
<pre><code>def loss_fn(y_true, y_pred):
print y_true
</code></pre>
<p>It prints</p>
<pre><code>Tensor("target:0", shape=(?, ?), dtype=float32)
</code></pre>
<p>Is there any Keras function to acces... | https://stackoverflow.com/questions/43448029/how-can-i-print-the-values-of-keras-tensors |
Question: <p>I'd like to make a prediction for a single image with Keras. I've trained my model so I'm just loading the weights. </p>
<pre><code>from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation... | https://stackoverflow.com/questions/43017017/keras-model-predict-for-a-single-image |
Question: <p>I am trying to reuse the weight matrix from a previous layer. As a toy example I want to do something like this:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
from keras.layers import Dense, Input
from keras.layers import merge
from keras import backend as K
from keras.models impo... | https://stackoverflow.com/questions/39564579/keras-reuse-weights-from-a-previous-layer-converting-to-keras-tensor |
Question: <p>When I run a keras script, I get the following output:</p>
<pre><code>Using TensorFlow backend.
2017-06-14 17:40:44.621761: W
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow
library wasn't compiled to use SSE4.1 instructions, but these are
available on your machine and could speed up C... | https://stackoverflow.com/questions/44544766/how-do-i-check-if-keras-is-using-gpu-version-of-tensorflow |
Question: <p>I am very new to keras. Trying to build a binary classifier for an NLP task. (My code is motivated from imdb example - <a href="https://github.com/fchollet/keras/blob/master/examples/imdb_cnn.py" rel="noreferrer">https://github.com/fchollet/keras/blob/master/examples/imdb_cnn.py</a>)</p>
<p>Below is my co... | https://stackoverflow.com/questions/33380897/keras-indexerror |
Question: <p>Which one is the recommended (or more future-proof) way to use Keras?</p>
<p>What are the advantages/disadvantages of each?</p>
<p>I guess there are more differences than simply saving one <code>pip install</code> step and writing <code>tensorflow.python.keras</code> instead of <code>keras</code>.</p>
A... | https://stackoverflow.com/questions/48893528/keras-vs-tensorflow-python-keras-which-one-to-use |
Question: <p>I have a problem which deals with predicting two outputs when given a vector of predictors.
Assume that a predictor vector looks like <code>x1, y1, att1, att2, ..., attn</code>, which says <code>x1, y1</code> are coordinates and <code>att's </code> are the other attributes attached to the occurrence of <co... | https://stackoverflow.com/questions/44036971/multiple-outputs-in-keras |
Question: <p>In Keras, to predict class of a datatest, the <code>predict_classes()</code> is used.</p>
<p>For example:</p>
<pre><code>classes = model.predict_classes(X_test, batch_size=32)
</code></pre>
<p>My question is, I know the usage of <code>batch_size</code> in training, but why does it need a <code>batch_siz... | https://stackoverflow.com/questions/37911321/why-does-prediction-needs-batch-size-in-keras |
Question: <p>Can someone explain the intuition behind 'causal' padding in Keras. Is there any particular application where this can be used?</p>
<p>The keras manual says this type of padding results in dilated convolution. What exactly it means by 'dilated' convolution?</p>
Answer: <p>This is a great concise explanat... | https://stackoverflow.com/questions/52578950/causal-padding-in-keras |
Question: <p>Here is the complete code<br>
top part runs fine till i import keras.
I have tried installing and uninstalling keras, however the error is still there</p>
<h1>Classification template</h1>
<pre><code># Importing the libraries
import numpy as my
import matplotlib.pyplot as plt
import pandas as pd
# Impor... | https://stackoverflow.com/questions/59548311/trouble-importing-keras |
Question: <p>Is it possible to implement MLP mixture of expert methodology in Keras?
Could you please guide me by a simple code in Keras for a binary problem with 2 experts.</p>
<p>It needs to define a cost function like this:</p>
<pre class="lang-python prettyprint-override"><code>g = gate.layers[-1].output
o1 = mlp... | https://stackoverflow.com/questions/40074730/keras-mixture-of-models |
Question: <p>Keras' <code>fit_generator()</code> model method expects a generator which produces tuples of the shape (input, targets), where both elements are NumPy arrays. <a href="https://keras.io/models/model/" rel="noreferrer">The documentation</a> seems to imply that if I simply wrap a <a href="https://www.tensorf... | https://stackoverflow.com/questions/46135499/how-to-properly-combine-tensorflows-dataset-api-and-keras |
Question: <p>I am using Anaconda and already have TensorFlow and Keras imported, and I tried to import keras using the following code</p>
<pre><code>import keras as ks
</code></pre>
<p>but it didn't work instead I got the follwing error:</p>
<pre><code> AttributeError Traceback (most recen... | https://stackoverflow.com/questions/76937613/i-cant-import-keras |
Question: <p>I tried to switch Backend with Keras (from TensorFlow to Theano) but did not manage.
I followed the temps described <a href="https://keras.io/backend/" rel="noreferrer">here</a> but it doesn't work. I created a keras.json in the keras' directory (as it did not exist) but it doesn't change anything when I i... | https://stackoverflow.com/questions/42177658/how-to-switch-backend-with-keras-from-tensorflow-to-theano |
Question: <p>I would like to build a Keras model which uses a numerical SPICE-like method for forward propagation. Since SPICE problems are not analytically-solvable, I have built the following class. The class works very well to implement prediction (numerical forward prorogation) and determine gradients (analytically... | https://stackoverflow.com/questions/54752965/keras-model-nested-inside-of-custom-keras-layer |
Question: <p>What is the difference between <code>spacy.load('en_core_web_sm')</code> and <code>spacy.load('en')</code>? <a href="https://stackoverflow.com/questions/50487495/what-is-difference-between-en-core-web-sm-en-core-web-mdand-en-core-web-lg-mod">This link</a> explains different model sizes. But I am still not ... | https://stackoverflow.com/questions/54334304/spacy-cant-find-model-en-core-web-sm-on-windows-10-and-python-3-5-3-anaco |
Question: <p>I have installed <strong>spaCy</strong> with python for my NLP project.</p>
<p>I have installed that using <code>pip</code>. How can I verify installed spaCy version?</p>
<p>using </p>
<pre><code>pip install -U spacy
</code></pre>
<p>What is command to verify installed spaCy version?</p>
Answer: <p>Y... | https://stackoverflow.com/questions/47350942/how-to-verify-installed-spacy-version |
Question: <p>I already have spaCy downloaded, but everytime I try the <code>nlp = spacy.load("en_core_web_lg")</code>, command, I get this error: </p>
<p><code>OSError: [E050] Can't find model 'en_core_web_lg'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.</code></p>
<p>... | https://stackoverflow.com/questions/56470403/spacy-nlp-spacy-loaden-core-web-lg |
Question: <p>In my project I have spaCy as a dependency in my <code>setup.py</code>, but I want to add also a default model.</p>
<p>My attempt so far has been:</p>
<pre><code>install_requires=['spacy', 'en_core_web_sm'],
dependency_links=['https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0... | https://stackoverflow.com/questions/53383352/spacy-and-spacy-models-in-setup-py |
Question: <p>I have been trying to find how to get the dependency tree with spaCy but I can't find anything on how to get the tree, only on <a href="https://spacy.io/usage/examples#subtrees" rel="noreferrer">how to navigate the tree</a>.</p>
Answer: <p>It turns out, the tree is available <a href="https://spacy.io/docs... | https://stackoverflow.com/questions/36610179/how-to-get-the-dependency-tree-with-spacy |
Question: <p>i am trying to upgrade my spacy version to nightly especially for using spacy transformers</p>
<p>so i converted spacy simple train datasets of format like</p>
<p><code>td = [["Who is Shaka Khan?", {"entities": [(7, 17, "FRIENDS")]}],["I like London.", {"entitie... | https://stackoverflow.com/questions/64675654/spacy-bilou-format-to-spacy-json-format |
Question: <p>What is the best way to add/remove stop words with spacy? I am using <a href="https://spacy.io/docs/api/token" rel="noreferrer"><code>token.is_stop</code></a> function and would like to make some custom changes to the set. I was looking at the documentation but could not find anything regarding of stop wor... | https://stackoverflow.com/questions/41170726/add-remove-custom-stop-words-with-spacy |
Question: <p>I'm using Anaconda and I'm trying to install spaCy.</p>
<p>At this point:
<code>python -m spacy download fr_core_news_sm</code></p>
<p>I get stuck with the "no module named spacy" error.</p>
<p>Don't understand what I'm doing wrong.</p>
<p>Thanks,</p>
Answer: <p>You have to install spaCy before ... | https://stackoverflow.com/questions/66969484/anaconda-jupyterlab-spacy-no-module-named-spacy-in-terminal |
Question: <p>Is it possible to use spacy to translate this sentence into some other language, for e.g. french?</p>
<pre><code>import spacy
nlp = spacy.load('en')
doc = nlp(u'This is a sentence.')
</code></pre>
<p>If spacy is not the right tool for this, then which (Free and open source) python library can translate t... | https://stackoverflow.com/questions/51311392/translate-text-using-spacy |
Question: <p>After apparently successful installation of spacy-nightly (spacy-nightly-2.0.0a14) and english model (en_core_web_sm) I was still receiving error message during attempt to run it</p>
<pre><code>import spacy
nlp = spacy.load('en_core_web_sm')
ValueError: thinc.extra.search.MaxViolation has the wrong size,... | https://stackoverflow.com/questions/46544808/spacy-nightly-spacy-2-0-issue-with-thinc-extra-maxviolation-has-wrong-size |
Question: <p>How can I extract noun phrases from text using spacy?<br>
I am not referring to part of speech tags.
In the documentation I cannot find anything about noun phrases or regular parse trees.</p>
Answer: <p>If you want base NPs, i.e. NPs without coordination, prepositional phrases or relative clauses, you ca... | https://stackoverflow.com/questions/33289820/noun-phrases-with-spacy |
Question: <p>I attempt to install spacy in my <code>Python</code> using <code>conda install spacy</code> at <code>anaconda</code> prompt.
However, the prompt returns a lot of conflicts.
Some of them are</p>
<pre><code>Package lxml conflicts for:
anaconda==2019.07=py3_0 -> lxml==4.3.4=py3h1350720_0
Package openpy... | https://stackoverflow.com/questions/57335852/unable-to-install-spacy-using-pip-install-spacy |
Question: <p>I have been using Spacy for noun chunks extraction using Doc.noun_chunks property provided by Spacy.
How could I extract verb phrases from input text using Spacy library (of the form 'VERB ? ADV * VERB +' )?</p>
Answer: <p>This might help you.</p>
<pre><code>from __future__ import unicode_literals
import... | https://stackoverflow.com/questions/47856247/extract-verb-phrases-using-spacy |
Question: <p>I am trying to install spacy. I am using python 2 and I saw a post <a href="https://stackoverflow.com/questions/43370851/failed-building-wheel-for-spacy">Failed building wheel for spacy</a> as I am having the same issue.</p>
<p>I ran <code>pip install --no-cache-dir spacy</code> but still I am getting </p... | https://stackoverflow.com/questions/51996739/installing-spacy |
Question: <p>i've been trying to import <strong>spacy</strong> but everytime an error appears as a result.
I used this line to install the package :</p>
<pre><code>conda install -c conda-forge spacy
</code></pre>
<p>then i tried to <strong>import spacy</strong> and it gives me this error:</p>
<pre><code>--------------... | https://stackoverflow.com/questions/67890652/cant-import-spacy |
Question: <p>I understand that spacy 2 alpha (or called spacy-nightly) is building vectors of words based on their context - so I do understand differences between values of similarity for words in nlp('apples oranges') and separated nlp('apples') and nlp('oranges') (and of course I am using different models for spacy ... | https://stackoverflow.com/questions/46608372/spacy-1-vs-spacy-2-spacy-nightly-have-they-changed-data-model-why-similarity |
Question: <p>I am using Phrasematcher in Spacy and getting an error like this - </p>
<pre><code>matcher = PhraseMatcher(nlp.vocab)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "spacy/matcher.pyx", line 505, in spacy.matcher.PhraseMatcher.__init__ (spacy/matcher.cpp:11371... | https://stackoverflow.com/questions/48293778/phrasematcher-spacy-error |
Question: <p>I am using rasa.ai to build a bot. So far it was working fine but this morning I installed this <a href="https://github.com/JustinaPetr/Weatherbot_Tutorial/blob/master/Video%20files/requirements.txt" rel="nofollow noreferrer">requirement</a> , then installed Spacy with below command.</p>
<pre><code>python... | https://stackoverflow.com/questions/50399260/spacy-linking-not-working |
Question: <p>Why am I getting this error <code>AttributeError: module 'srsly' has no attribute 'read_yaml'</code></p>
<p>when I attempt <code>python -m spacy download en_core_web_sm</code></p>
<p>I've been following the instructions here <a href="https://spacy.io/usage" rel="nofollow noreferrer">Install spaCy</a></p>
... | https://stackoverflow.com/questions/66586400/python-m-spacy-download-en-core-web-sm-fails-using-spacy-3-0-3 |
Question: <p>I am using Spacy for NLP in Python. I am trying to use <code>nlp.pipe()</code> to generate a list of Spacy doc objects, which I can then analyze. Oddly enough, <code>nlp.pipe()</code> returns an object of the class <code><generator object pipe at 0x7f28640fefa0></code>. How can I get it to return a l... | https://stackoverflow.com/questions/51369858/spacy-nlp-pipe-returns-generator |
Question: <p>I'm following this tutorial <a href="https://spacy.io/usage/training#quickstart" rel="nofollow noreferrer">https://spacy.io/usage/training#quickstart</a> in order to train a custom model of distilbert.
Everything is already installed, data are converted and the config file is ready.</p>
<p>When I launch th... | https://stackoverflow.com/questions/68982157/spacy-3-1-keyerror-train-using-spacy-train-command |
Question: <p>I am using Spacy for extracting nouns from sentences. These sentences are grammatically poor and may contain some spelling mistakes as well.</p>
<p>Here is the code that I am using:</p>
<p><strong>Code</strong></p>
<pre><code>import spacy
import re
nlp = spacy.load("en_core_web_sm")
sentence= &... | https://stackoverflow.com/questions/66751457/meaningless-spacy-nouns |
Question: <p>My environment</p>
<ul>
<li>MacOS 10.15 / Debian 11</li>
<li>Python 3.8.2 / 3.8.12</li>
<li>Spacy 3.1.2</li>
<li>Spacy-langdetect 0.1.2</li>
</ul>
<p>I'm trying to use <a href="https://spacy.io/universe/project/spacy-langdetect" rel="nofollow noreferrer">spacy-langdetect</a> to add a language detection fea... | https://stackoverflow.com/questions/69120859/spacy-nlp-pipe-error-with-multiprocessing-n-process-1-using-spacy-langdetect |
Question: <pre><code>UserWarning: [W094] Model 'en_training' (0.0.0) specifies an under-constrained spaCy version requirement: >=2.1.4.
This can lead to compatibility problems with older versions,
or as new spaCy versions are released, because the model may say it's compatible when it's not.
Consider changing the... | https://stackoverflow.com/questions/70880056/how-to-fix-spacy-en-training-incompatible-with-current-spacy-version |
Question: <p>I've been using spacy 2.3.1 until now and have trained and saved a couple of pipelines for my custom Language class. But now using spacy 3.0 and <code>spacy.load('model-path')</code> I'm facing problems such as <code>config.cfg file not found</code> and other kinds of errors.</p>
<p>Do I have to train the ... | https://stackoverflow.com/questions/67146973/migrate-trained-spacy-2-pipelines-to-spacy-3 |
Question: <p>I try to use Spacy to syntactically parse the following sentence:</p>
<pre><code>my_sentence = "delete failed setup"
</code></pre>
<p>So I do the following:</p>
<pre><code>import spacy
nlp = spacy.load("en")
doc = nlp(my_sentence)
</code></pre>
<p>However, Spacy does not recognize this... | https://stackoverflow.com/questions/71847943/correcting-incorrect-spacy-label |
Question: <p>I have installed spaCy using <code>pip install spacy</code> but when trying <code>python -m spacy.en.download all</code>, I get the following error ..</p>
<p><a href="https://i.sstatic.net/XmMd8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XmMd8.png" alt="enter image description here"></... | https://stackoverflow.com/questions/41725166/installing-spacy-ssl-certificate-error |
Question: <p>While trying to import spaCy in my jupyter notebook, I encountered this error:</p>
<pre><code>---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[8], line 7
4 import seaborn as sns
5 impo... | https://stackoverflow.com/questions/78648747/import-spacy-keyerror-reduce-cython |
Question: <p>I always used spacy library with english or german. </p>
<p>To load the library I used this code:</p>
<pre><code>import spacy
nlp = spacy.load('en')
</code></pre>
<p>I would like to use the Spanish tokeniser, but I do not know how to do it, because spacy does not have a spanish model.
I've tried this</p... | https://stackoverflow.com/questions/42947733/use-spacy-spanish-tokenizer |
Question: <p>I recently tried to install the spaCy module for python 3.x. The installation looks like it runs successfully (shows no errors), but when I try to import spaCy, or when I try to install spaCy models, I get the error below. I have tried installing spaCy using both <code>pip install</code> and <code>conda in... | https://stackoverflow.com/questions/44886163/python-spacy-module-wont-import |
Question: <p>I get data from Universal Dependencies I work mostly with Indonesian (bahasa) so I clone the repo:</p>
<ul>
<li><a href="https://github.com/conllul/UL_Indonesian-PUD" rel="nofollow noreferrer">https://github.com/conllul/UL_Indonesian-PUD</a></li>
<li><a href="https://github.com/conllul/UL_Indonesian-GSD" ... | https://stackoverflow.com/questions/53318940/spacy-convert-conllul-to-spacy-json-format |
Question: <p>I have an app that uses the Spacy model "en_core_web_sm". I have tested the app on my local machine and it works fine.</p>
<p>However when I deploy it to Heroku, it gives me this error:</p>
<p>"Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a... | https://stackoverflow.com/questions/61702357/how-to-add-a-spacy-model-to-a-requirements-txt-file |
Question: <p>I'm having the following problem.
I've been trying to replicate example code from this source:
<a href="https://github.com/huggingface/transformers/issues/2986" rel="nofollow noreferrer">Github</a></p>
<p>I'm using Jupyter Lab environment on Linux and Spacy 3.1</p>
<pre><code># $ pip install spacy-transfor... | https://stackoverflow.com/questions/71977955/how-to-fix-spacy-transformers-for-spacy-version-3-1 |
Question: <p>I'm trying to work with spacy . I need to download language model for English, Italian and Spanish.
I can't manually install the model ( because I hope to build a piece of code that is portable ) so i wrote a little function which basically is </p>
<pre><code>import os
import spacy
lang='en'
try:
... | https://stackoverflow.com/questions/60753705/oserror-import-language-model-spacy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.