Comments (2)
Hi!
As far as I understand the scikit-learn wrapper for Keras, it constructs the model using the build function you provide during the .fit()
method, which is stored in the model
attribute. From the error log you posted, I suspect the problem is that the model has not been constructed yet when you call learner.query()
. Let me know if it helps!
from modal.
Thank you for your answer.
I change keras library from tensorflow to origin,use example code from github and it can work.
finally code as following:
model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3), activation='relu', input_shape=(28, 28, 1)))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(10, activation='softmax'))
try:
_model = keras.utils.multi_gpu_model(model,gpus=2)
print("Training using multiple GPUs..")
except ValueError:
_model = model
print("Training using single GPU or CPU..")
_model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])
However,I used resnet50 in keras as my learner,another error occurred
with tensorflow.device('/cpu:0'):
model = Sequential()
model.add(resnet50.ResNet50(include_top = False, pooling = 'avg', weights = None,input_tensor=Input(shape=(28, 28, 1))))
model.add(Dense(10, activation = 'softmax'))
adam = optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False)
and error is :
Training using multiple GPUs..
WARNING:tensorflow:From /home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Traceback (most recent call last):
File "/home/es712/Documents/MingHan/pycode/test/ALtest.py", line 92, in
verbose=1
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/modAL/models/learners.py", line 79, in init
X_training, y_training, bootstrap_init, **fit_kwargs)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/modAL/models/base.py", line 63, in init
self._fit_to_known(bootstrap=bootstrap_init, **fit_kwargs)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/modAL/models/base.py", line 106, in _fit_to_known
self.estimator.fit(self.X_training, self.y_training, **fit_kwargs)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/wrappers/scikit_learn.py", line 209, in fit
return super(KerasClassifier, self).fit(x, y, **kwargs)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/wrappers/scikit_learn.py", line 151, in fit
history = self.model.fit(x, y, **fit_args)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/engine/training.py", line 1213, in fit
self._make_train_function()
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/engine/training.py", line 316, in _make_train_function
loss=self.total_loss)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/keras/optimizers.py", line 543, in get_updates
p_t = p - lr_t * m_t / (K.sqrt(v_t) + self.epsilon)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 815, in binary_op_wrapper
y = ops.convert_to_tensor(y, dtype=x.dtype.base_dtype, name="y")
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1039, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1097, in convert_to_tensor_v2
as_ref=False)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1175, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 304, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 245, in constant
allow_broadcast=True)
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 283, in _constant_impl
allow_broadcast=allow_broadcast))
File "/home/es712/pythonenvs/tensorflow1.13.1/tensorflow1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 454, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.
from modal.
Related Issues (20)
- Multivariate Active regression
- How to extract the image names and labels in the training set after completing the active learning loop and write them to a CSV file
- decision_function instead of predict_proba HOT 5
- AttributeError: bootstrap_init HOT 3
- TypeError: cannot concatenate object of type '<class 'numpy.ndarray'>'; only Series and DataFrame objs are valid
- Can I use modAL with estimators from other libraries than scikit-learn like xgboost? HOT 1
- Which sampling method is best for very unbalanced data? HOT 1
- Encountering error with number of batches per epoch
- mmdetection integration with modAL
- Adding active learning regression implementations based on greedy sampling HOT 2
- modAL not installable via pypi anymore HOT 3
- the modAL package has been changed into modal in the pip repository HOT 7
- Data augmentation with `skorch`
- QBC approach for multi-class classification
- Suggestion on how to improve acquisition.UCB for active GP example HOT 1
- QBC stratified bootstrapping HOT 1
- Use modAL on BERT models HOT 1
- Spacy NER HOT 1
- raise ImportError( ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first.
- uncertainty query for 2d classifier output
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modal.