I used AWS Sagemaker with Jupyter notebook to train my Turicreate model. It trained successfully but I'm unable to export it to a CoreML model. It shows the below error. I've tried various kernels in the Jupyter notebook with the same result. Any ideas on how to fix this error?
turicreate 5.4
GPU: mxnet-cu100
KeyError Traceback (most recent call last)
<ipython-input-6-3499bdb76e06> in <module>()
1 # Export for use in Core ML
----> 2 model.export_coreml('pushupsTC.mlmodel')
~/anaconda3/envs/python3/lib/python3.6/site-packages/turicreate/toolkits/object_detector/object_detector.py in export_coreml(self, filename, include_non_maximum_suppression, iou_threshold, confidence_threshold)
1216 assert (self._model[23].name == 'pool5' and
1217 self._model[24].name == 'specialcrop5')
-> 1218 del net._children[24]
1219 net._children[23] = op
1220
KeyError: 24
Related
Please help me with resolving the problem I'm facing.
Here is the code which I run on a Jupyter notebook.
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('abc').getOrCreate()
--> I got error as
RuntimeError Traceback (most recent call last)
C:\Users\MOHANA~1\AppData\Local\Temp/ipykernel_18536/4172048100.py in <module>
1 from pyspark.sql import SparkSession
----> 2 spark = SparkSession.builder.appName('abc').getOrCreate()
RuntimeError: Java gateway process exited before sending its port number
I am trying to run yolov5 in Google colab GPU free version
!pip install PyYAML==5.3
I am getting an error
Model Summary: 407 layers, 8.84875e+07 parameters, 8.84875e+07 gradients
Optimizer groups: 134 .bias, 142 conv.weight, 131 other
Traceback (most recent call last):
File "/content/yolov5/train.py", line 116, in train
ckpt['model'] = {k: v for k, v in ckpt['model'].float().state_dict().items()
File "/content/yolov5/train.py", line 117, in <dictcomp>
if model.state_dict()[k].shape == v.shape} # to FP32, filter
KeyError: 'model.18.conv.weight'
My command in google colab is
!python /content/yolov5/train.py --img 640 --batch 4 --epochs 30 \
--data /content/yolov5/data/clothing.yaml
--cfg /content/yolov5/models/yolov5x.yaml \
--weights yolov5x.pt \
--name yolov5_clothing --cache
Can you please help me to resolve this ?
Thanks
This issue has been resolved by yolo team asked me to run requirements.txt and download yolo again.
Everything is fine you can see the more details on https://github.com/ultralytics/yolov5/issues/2181
Thanks
With the current version 0.22.2 there is a interactive tool to enter interactive data and see the results. Its called Libsvm GUI.
I never managed to have it running in Jupyter notebook.
Having seen that there is a binder option. When trying this (which should not depend on my computer environment) errors come up.
https://scikit-learn.org/stable/auto_examples/applications/svm_gui.html
Automatically created module for IPython interactive environment
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-e5e1b6a6b155> in <module>
6
7 import matplotlib
----> 8 matplotlib.use('TkAgg')
9
10 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
/srv/conda/envs/notebook/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
305 f"for the old name will be dropped %(removal)s.")
306 kwargs[new] = kwargs.pop(old)
--> 307 return func(*args, **kwargs)
308
309 # wrapper() must keep the same documented signature as func(): if we
/srv/conda/envs/notebook/lib/python3.7/site-packages/matplotlib/__init__.py in use(backend, warn, force)
1305 if force:
1306 from matplotlib.pyplot import switch_backend
-> 1307 switch_backend(name)
1308 else:
1309 # Finally if pyplot is not imported update both rcParams and
/srv/conda/envs/notebook/lib/python3.7/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
234 "Cannot load backend {!r} which requires the {!r} interactive "
235 "framework, as {!r} is currently running".format(
--> 236 newbackend, required_framework, current_framework))
237
238 rcParams['backend'] = rcParamsDefault['backend'] = newbackend
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
Seeing the first error, it seems even with the untouched binder environment there is something wrong. But I am not sure if it is with binder or with the code itself.
What can I try to make it working?
I cannot succeed to use xgboost package in Azure Machine Learning Studio interpreter. I am trying to import a model using xgboost that I trained in order to deploy it here. But It seems that my package is not set correctly because I cannot access to certain functions, particularly "xgboost.sklearn"
My model is of course using the xgboost.sklearn.something to do the classification
I tried to implement the package following two different methods :
from the tar.gz principle like here :
How can certain python libraries be imported in azure ML?Like the line import humanfriendly gives error
and also by clean package with the sandbox like there :
Uploading xgboost to azure machine learning: %1 is not a valid Win32 application\r\nProcess returned with non-zero exit code 1
import sys
import sklearn
import pandas as pd
import pickle
import xgboost
def azureml_main(dataframe1 = None, dataframe2 = None):
sys.path.insert(0,".\Script Bundle")
model = pickle.load(open(".\\Script
Bundle\\xgboost\\XGBv1.pkl",'rb'))
dataframe1, dftrue = filterdata(dataframe1)
## one processing step
pred = predictorV1(dataframe1,dftrue)
dataframe1['Y'] = pred
return dataframe1
Here is the error I get
Error 0085: The following error occurred during script evaluation, please view the output log for more information:
---------- Start of error message from Python interpreter ----------
Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 199, in batch
odfs = mod.azureml_main(*idfs)
File "C:\temp\1098d8754a52467181a9509ed16de8ac.py", line 89, in azureml_main
model = pickle.load(open(".\\Script Bundle\\xgboost\\XGBv1.pkl", 'rb'))
ImportError: No module named 'xgboost.sklearn'
Process returned with non-zero exit code 1
---------- End of error message from Python interpreter ----------
Start time: UTC 05/22/2019 13:11:08
End time: UTC 05/22/2019 13:11:49
I am running this example code ( seq2seq built on Keras)form https://github.com/fchollet/keras/blob/master/examples/lstm_seq2seq.py.
This code runs correctly on my Ubuntu. But an error occured when I ran the same code on my Windows.
It says:
Using TensorFlow backend.
Number of samples: 10000
Number of unique input tokens: 73
Number of unique output tokens: 86
Max sequence length for inputs: 17
Max sequence length for outputs: 42
Traceback (most recent call last):
File "h:/eclipse_workspace/Keras_DL/src/seq2seq/lstm_seq2seq.py", line 125, in
encoder = LSTM(latent_dim, return_state = True)
File "D:\software\anaconda\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "D:\software\anaconda\lib\site-packages\keras\layers\recurrent.py", line 949, in init
super(LSTM, self).init(**kwargs)
File "D:\software\anaconda\lib\site-packages\keras\layers\recurrent.py", line 191, in init
super(Recurrent, self).init(**kwargs)
File "D:\software\anaconda\lib\site-packages\keras\engine\topology.py", line 281, in init
raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', 'return_state')
I found that return_state do exists in
keras.layers.recurrent.Recurrent(return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False, implementation=0)
Can anyone tell me how can I run this demo correctly on Windows?
My system info:
- OS : Windows 10 64 bit
- python 3.5.2 64 bit
- cudnn-8.0-windows10-x64-v5.1
- keras 2.04 tensorflow-gpu 1.1.0
Your Keras version is too old. return_state is added in Keras 2.0.5. I suggest you install the latest version from GitHub, since the example code you're running has been added to the library less than 24 hours ago.