TensorFlow in PyCharm value error: Failed to find data adapter that can handle input - tensorflow

I am referring TensorFlow speciliazation from Coursera where a certain piece of code works absolutely fine in Google Colab, whereas when I try to run it locally on PyCharm, it gives following error:
Failed to find data adapter that can handle input
Any suggestions?

Can you tell me the code where the error occurred?
It should be available in logs under your PyCharm console.
Looking at your comments, it seems that the model is expecting an array while you provided a list.
I was facing the same issue. Turns out it was a in the form of a list. I had to convert the fields into a numpy array like:
training_padded = np.array(training_padded)
training_labels = np.array(training_labels)
testing_padded = np.array(testing_padded)
testing_labels = np.array(testing_labels)
thats it!
Try it out and let me know if it works.

Related

Can you specify why ggsave function is not working?

I have run a meta-analysis in metafor and created a forest plot.
I then tried to save this, using ggsave, as below:
ggsave("../Desktop/ASPD_META_ANALYSIS_LAPTOP/CVR.png")
But I get the error:
Error in grDevices::dev.off() : QuartzBitmap_Output - unable to open
file '../Desktop/ASPD_META_ANALYSIS_LAPTOP/CVR.png'
Can someone please advise? I need a high res version of this image.
Try using
ggsave("./Desktop/ASPD_META_ANALYSIS_LAPTOP/CVR.png")
with just one point . before /Desktop

CatBoost Error: bayesian bootstrap doesn't support taken fraction option

The error occur when running gridsearchcv using catboostclassifier and bootstrap_type='Bayesian'. Any idea what that error means?
I had similar issue while training my data with CatBoostClassifier. I had set the "subsample" parameter to "0.5". After removing this parameter, it worked for me.
More details at: enter link description here
Hope this is useful.

Spacy's Dependency Parser

I was trying to play around with Spacy's Dependency Parser to extract Aspect for Aspect Based Sentiment Analysis.
I followed this link: https://remicnrd.github.io/Aspect-based-sentiment-analysis/
When I tried the following piece of the code on my data, I got an Error message.
import spacy
nlp = spacy.load('en')
dataset.review = dataset.review.str.lower()
aspect_terms = []
for review in nlp.pipe(dataset.review):
chunks = [(chunk.root.text) for chunk in review.noun_chunks if chunk.root.pos_ == 'NOUN']
aspect_terms.append(' '.join(chunks))
dataset['aspect_terms'] = aspect_terms
dataset.head(10)
The Error message was:
TypeError: object of type 'NoneType' has no len()
The Error was in this line:
for review in nlp.pipe(dataset.review):
Could someone please help me understand the issue here and how to resolve this. Thanks.
Writing the solution here incase it helps someone in future.
I was getting the Error because I had some empty rows for the column review.
I re-ran the code after removing the empty rows/rows with NaN values for the column reviews and it works fine :)

Getting this ImportErrorcan "not import name fpn_pb2", when trying to run the training using tensor flow 2 object detection API

I am doing research in deep learning using Tensor flow 2 object detection API. I am getting this error while running the model training. I followed the Gilbert Tanner and Edje Electronics tutorial for basic installations and environment settings. I am using the TensorFlow object detection API new GitHub Commit. I converted the all .protos files into .py files but still facing this error. I am attaching a screenshot of this error. please check this and let me know if you can help.
Thanks in Advance. Error
I had the same problem and also with target_assigner.proto, center_net.proto, you have to add all three .\object_detection\protos\fpn.proto .\object_detection\protos\target_assigner.proto .\object_detection\protos\center_net.proto
to protoc command. So whole command should be:
protoc --python_out=. .\object_detection\protos\anchor_generator.proto .\object_detection\protos\argmax_matcher.proto .\object_detection\protos\bipartite_matcher.proto .\object_detection\protos\box_coder.proto .\object_detection\protos\box_predictor.proto .\object_detection\protos\eval.proto .\object_detection\protos\faster_rcnn.proto .\object_detection\protos\faster_rcnn_box_coder.proto .\object_detection\protos\grid_anchor_generator.proto .\object_detection\protos\hyperparams.proto .\object_detection\protos\image_resizer.proto .\object_detection\protos\input_reader.proto .\object_detection\protos\losses.proto .\object_detection\protos\matcher.proto .\object_detection\protos\mean_stddev_box_coder.proto .\object_detection\protos\model.proto .\object_detection\protos\optimizer.proto .\object_detection\protos\pipeline.proto .\object_detection\protos\post_processing.proto .\object_detection\protos\preprocessor.proto .\object_detection\protos\region_similarity_calculator.proto .\object_detection\protos\square_box_coder.proto .\object_detection\protos\ssd.proto .\object_detection\protos\fpn.proto .\object_detection\protos\target_assigner.proto .\object_detection\protos\center_net.proto .\object_detection\protos\ssd_anchor_generator.proto .\object_detection\protos\string_int_label_map.proto .\object_detection\protos\train.proto .\object_detection\protos\keypoint_box_coder.proto .\object_detection\protos\multiscale_anchor_generator.proto .\object_detection\protos\graph_rewriter.proto .\object_detection\protos\calibration.proto .\object_detection\protos\flexible_grid_anchor_generator.proto

OrientDB 2.2.4 Load Balancing

I am trying to setup a cluster for load balancing. I am using the Java Graph API. In the documentation there is this code:
final OrientGraphFactory factory = new OrientGraphFactory("remote:localhost/demo");
factory.setConnectionStrategy(OStorageRemote.CONNECTION_STRATEGY.ROUND_ROBIN_CONNECT);
OrientGraphNoTx graph = factory.getNoTx();
I copied and pasted the code exactly like this and I get this compilation error
"incompatible types: CONNECTION_STRATEGY cannot be converted to
String"
The only relevant import I have is:
import com.orientechnologies.orient.client.remote.OStorageRemote;
Can you please help?
Has anyone tried this?
Thanks.
You could use
OStorageRemote.CONNECTION_STRATEGY.ROUND_ROBIN_CONNECT.toString()
Hope it helps