deep-learning

Predictor prediction function to classify text using a saved BERT model

六月ゝ 毕业季﹏ 提交于 2020-07-22 06:41:34
问题 I have created a BERT model for classifying a user generated text string as FAQ or not FAQ. I have saved my model using the export_savedmodel() function. I wish to write a function to predict the output for a new set of strings, which takes as input a list of the strings. I tried using predictor.from_saved_model() method but that method requires passing key value pairs for input id, segment id, label id and input mask. I am a beginner and I do not understand completely what to pass here.

Predictor prediction function to classify text using a saved BERT model

半腔热情 提交于 2020-07-22 06:41:07
问题 I have created a BERT model for classifying a user generated text string as FAQ or not FAQ. I have saved my model using the export_savedmodel() function. I wish to write a function to predict the output for a new set of strings, which takes as input a list of the strings. I tried using predictor.from_saved_model() method but that method requires passing key value pairs for input id, segment id, label id and input mask. I am a beginner and I do not understand completely what to pass here.

pretrained VGG16 model misclassifies even though val accuracy is high and val loss is low [closed]

半腔热情 提交于 2020-07-22 05:50:47
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 hours ago . Improve this question I am new to Deep Learning and started with some tutorials, where I implemented VGG16 Net from Scratch. I wanted to classify integrated circuits in defect and non defect classes. I played around with it, changed the hyperparamters and got a really good result with

How to fix “ResourceExhaustedError: OOM when allocating tensor”

假装没事ソ 提交于 2020-07-21 11:35:05
问题 I wanna make a model with multiple inputs. So, I try to build a model like this. # define two sets of inputs inputA = Input(shape=(32,64,1)) inputB = Input(shape=(32,1024)) # CNN x = layers.Conv2D(32, kernel_size = (3, 3), activation = 'relu')(inputA) x = layers.Conv2D(32, (3,3), activation='relu')(x) x = layers.MaxPooling2D(pool_size=(2,2))(x) x = layers.Dropout(0.2)(x) x = layers.Flatten()(x) x = layers.Dense(500, activation = 'relu')(x) x = layers.Dropout(0.5)(x) x = layers.Dense(500,

How to fix “ResourceExhaustedError: OOM when allocating tensor”

こ雲淡風輕ζ 提交于 2020-07-21 11:34:55
问题 I wanna make a model with multiple inputs. So, I try to build a model like this. # define two sets of inputs inputA = Input(shape=(32,64,1)) inputB = Input(shape=(32,1024)) # CNN x = layers.Conv2D(32, kernel_size = (3, 3), activation = 'relu')(inputA) x = layers.Conv2D(32, (3,3), activation='relu')(x) x = layers.MaxPooling2D(pool_size=(2,2))(x) x = layers.Dropout(0.2)(x) x = layers.Flatten()(x) x = layers.Dense(500, activation = 'relu')(x) x = layers.Dropout(0.5)(x) x = layers.Dense(500,

How to fix “ResourceExhaustedError: OOM when allocating tensor”

大兔子大兔子 提交于 2020-07-21 11:29:30
问题 I wanna make a model with multiple inputs. So, I try to build a model like this. # define two sets of inputs inputA = Input(shape=(32,64,1)) inputB = Input(shape=(32,1024)) # CNN x = layers.Conv2D(32, kernel_size = (3, 3), activation = 'relu')(inputA) x = layers.Conv2D(32, (3,3), activation='relu')(x) x = layers.MaxPooling2D(pool_size=(2,2))(x) x = layers.Dropout(0.2)(x) x = layers.Flatten()(x) x = layers.Dense(500, activation = 'relu')(x) x = layers.Dropout(0.5)(x) x = layers.Dense(500,

Pretraining a language model on a small custom corpus

烂漫一生 提交于 2020-07-21 07:55:47
问题 I was curious if it is possible to use transfer learning in text generation, and re-train/pre-train it on a specific kind of text. For example, having a pre-trained BERT model and a small corpus of medical (or any "type") text, make a language model that is able to generate medical text. The assumption is that you do not have a huge amount of "medical texts" and that is why you have to use transfer learning. Putting it as a pipeline, I would describe this as: Using a pre-trained BERT

Pretraining a language model on a small custom corpus

筅森魡賤 提交于 2020-07-21 07:55:05
问题 I was curious if it is possible to use transfer learning in text generation, and re-train/pre-train it on a specific kind of text. For example, having a pre-trained BERT model and a small corpus of medical (or any "type") text, make a language model that is able to generate medical text. The assumption is that you do not have a huge amount of "medical texts" and that is why you have to use transfer learning. Putting it as a pipeline, I would describe this as: Using a pre-trained BERT

Trying to understand Pytorch's implementation of LSTM

不羁的心 提交于 2020-07-21 04:59:37
问题 I have a dataset containing 1000 examples where each example has 5 features (a,b,c,d,e). I want to feed 7 examples to an LSTM so it predicts the feature (a) of the 8th day. Reading Pytorchs documentation of nn.LSTM() I came up with the following: input_size = 5 hidden_size = 10 num_layers = 1 output_size = 1 lstm = nn.LSTM(input_size, hidden_size, num_layers) fc = nn.Linear(hidden_size, output_size) out, hidden = lstm(X) # Where X's shape is ([7,1,5]) output = fc(out[-1]) output # output's

Google Colab: Why is CPU faster than TPU?

久未见 提交于 2020-07-19 06:45:18
问题 I'm using Google colab TPU to train a simple Keras model. Removing the distributed strategy and running the same program on the CPU is much faster than TPU . How is that possible? import timeit import os import tensorflow as tf from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.optimizers import Adam # Load Iris dataset x = load_iris().data y