Questions tagged [pre-trained-model]

A machine learning model created by someone else. Questions about the practical use and implementation details (using a pretrained model as a starting point, or benchmark) are allowed; however, questions about the theory behind these models are off-topic.

Filter by
Sorted by
Tagged with
42 votes
2 answers
61k views

How to save a trained model by scikit-learn? [duplicate]

I am trying to re-create the prediction of a trained model but I don't know how to save a model. For example, I want to save the trained Gaussian processing regressor model and recreate the prediction ...
Long's user avatar
  • 433
38 votes
4 answers
33k views

Is it possible to make a trainable variable not trainable?

I created a trainable variable in a scope. Later, I entered the same scope, set the scope to reuse_variables, and used get_variable to retrieve the same variable. However, I cannot set the variable's ...
Wei Liu's user avatar
  • 1,014
16 votes
4 answers
43k views

Is there any way I can download the pre-trained models available in PyTorch to a specific path?

I am referring to the models that can be found here: https://pytorch.org/docs/stable/torchvision/models.html#torchvision-models
gopalkrizna's user avatar
16 votes
1 answer
4k views

How to Fine tune existing Tensorflow Object Detection model to recognize additional classes? [closed]

Thanks to Google for providing a few pre-trained models with tensorflow API. I would like to know how to retrain a pre-trained model available from the above repository, by adding new classes to the ...
saikishor's user avatar
  • 918
15 votes
4 answers
30k views

AttributeError: 'Node' object has no attribute 'output_masks'

I use Keras pretrained model VGG16. The problem is that after configuring tensorflow to use the GPU I get an error that I didn't have before when using the CPU. The error is the following one: ...
Saroten's user avatar
  • 295
14 votes
2 answers
6k views

Can i finetune deeplab to a custom dataset in tensorflow?

I would like to customize deeplab for image segmentation using my own dataset ? Is this achievable by retraining ?
mrBean's user avatar
  • 183
14 votes
2 answers
37k views

Download pretrained ImageNet model of ResNet, VGG, etc. (.PB file)

I have downloaded a pre-trained model on ImageNet of Inception v3 from http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz (found this link while following one of the ...
Ajay Maity's user avatar
13 votes
2 answers
795 views

GPU utilization 0% during TensorFlow retraining for poets

I am following instructions for TensorFlow Retraining for Poets. GPU utilization seemed low so I instrumented the retrain.py script per the instructions in Using GPU. The log verifies that the TF ...
Lars Ericson's user avatar
  • 2,034
11 votes
6 answers
16k views

How to save/load a tensorflow hub module to/from a custom path?

The tensorflow_hub library maintainers has made it every easy for users to download and use the pre-trained tensorflow modules, e.g.: import tensorflow_hub as hub embed = hub.Module("https://tfhub....
alvas's user avatar
  • 119k
11 votes
2 answers
14k views

Continual pre-training vs. Fine-tuning a language model with MLM

I have some custom data I want to use to further pre-train the BERT model. I’ve tried the two following approaches so far: Starting with a pre-trained BERT checkpoint and continuing the pre-training ...
Pedram's user avatar
  • 2,531
11 votes
1 answer
15k views

how to load the gpu trained model into the cpu?

I am using PyTorch. I am going to use the already trained model on multiple GPUs with CPU. how to do this task? I tried on Anaconda 3 and pytorch with cpu only i dont have gpu model = models....
Vijay Prabakaran's user avatar
11 votes
1 answer
13k views

How can I load a partial pretrained pytorch model?

I'm trying to get a pytorch model running on a sentence classification task. As I am working with medical notes I am using ClinicalBert (https://github.com/kexinhuang12345/clinicalBERT) and would like ...
happyrabbit's user avatar
9 votes
4 answers
16k views

Fine Tuning Pretrained Model MobileNet_V2 in Pytorch

I am new to pyTorch and I am trying to Create a Classifier where I have around 10 kinds of Images Folder Dataset, for this task I am using Pretrained model( MobileNet_v2 ) but the problem is I am not ...
Sachin Sharma's user avatar
9 votes
4 answers
6k views

How to choose which pre-trained weights to use for my model?

I am a beginner, and I am very confused about how we can choose a pre-trained model that will improve my model. I am trying to create a cat breed classifier using pre-trained weights of a model, ...
hR 312's user avatar
  • 824
9 votes
1 answer
25k views

TypeError: ('Keyword argument not understood:', 'data_format')

I trained and downloaded a model(a CNN) using Keras from google colaboratory when I tried to load the model on my local machine(Mac OS X El Capitan), I received the following error. Traceback (most ...
Siddhant Bansal's user avatar
8 votes
1 answer
4k views

Uni-directional Transformer VS Bi-directional BERT

I just finished reading the Transformer paper and BERT paper. But couldn't figure out why Transformer is uni-directional and BERT is bi-directional as mentioned in BERT paper. As they don't use ...
JShen's user avatar
  • 409
8 votes
2 answers
21k views

Loading Torch7 trained models (.t7) in PyTorch

I am using Torch7 library for implementing neural networks. Mostly, I rely on pre-trained models. In Lua I use torch.load function to load a model saved as torch .t7 file. I am curious about ...
Arul's user avatar
  • 303
8 votes
2 answers
4k views

How to convert a PyTorch nn.Module into a HuggingFace PreTrainedModel object?

Given a simple neural net in Pytorch like: import torch.nn as nn net = nn.Sequential( nn.Linear(3, 4), nn.Sigmoid(), nn.Linear(4, 1), nn.Sigmoid() ).to(device) How do I ...
alvas's user avatar
  • 119k
8 votes
1 answer
11k views

Data Preprocessing for NLP Pre-training Models (e.g. ELMo, Bert)

I plan to train ELMo or Bert model from scratch based on data(notes typed by people) on hand. The data I have now is all typed by different people. There are problems with spelling, formatting, and ...
Xin's user avatar
  • 331
7 votes
1 answer
4k views

Pre-Trained models for text Classification

So I have few words without labels but I need to classify them into 4-5 categories. I can visibly say that this test set can be classified. Although I do not have training data so I need to use a pre-...
scifi_bot's user avatar
7 votes
2 answers
13k views

How can I add new layers on pre-trained model with PyTorch? (Keras example given)

I am working with Keras and trying to analyze the effects on accuracy that models which are built with some layers with meaningful weights, and some layers with random initializations. Keras: I load ...
Selin Gök's user avatar
7 votes
3 answers
1k views

Pre train a model (classifier) in scikit learn

I would like to pre-train a model and then train it with another model. I have model Decision Tree Classifer and then I would like to train it further with model LGBM Classifier. Is there a ...
Test's user avatar
  • 589
7 votes
1 answer
3k views

Modify trained model architecture and continue training Keras

I want to train a model in a sequential manner. That is I want to train the model initially with a simple architecture and once it is trained, I want to add a couple of layers and continue training. ...
Nagabhushan S N's user avatar
7 votes
4 answers
4k views

Duplicate node name in graph: 'conv2d_0/kernel/Adam'

I just saved a model, by that code: def train(): with tf.Session() as sess: saver = tf.train.Saver(max_to_keep = 2) Loss = myYoloLoss([Scale1,Scale2,Scale3],[Y1, Y2 ,Y3]) opt = tf....
heiheihei's user avatar
  • 729
7 votes
2 answers
7k views

VGG16 trained on grayscale imagenet

I have found the VGG16 network pre-trained on the (color) imagenet database (as .npy). Is there a VGG16 network pre-trained on a gray-scale version of the imagenet database available? (The usual '...
MathMits's user avatar
6 votes
2 answers
3k views

Error when loading FastText's french pre-trained model with gensim

I am trying to use the FastText's french pre-trained binary model (downloaded from the official FastText's github page). I need the .bin model and not the .vec word-vectors so as to approximate ...
Clara-sininen's user avatar
6 votes
2 answers
7k views

Latest Pre-trained Multilingual Word Embedding

Are there any latest pre-trained multilingual word embeddings (multiple languages are jointly mapped to a same vector space)? I have looked at the following but they don't fit my needs: FastText / ...
MachineLearner's user avatar
6 votes
1 answer
2k views

How to save a trained model (Estimator) and Load it back to test it with data in Tensorflow?

I have this snippet, for my model import pandas as pd import tensorflow as tf from tensorflow.contrib import learn from tensorflow.contrib.learn.python import SKCompat #Assume my dataset is using X['...
Surjith Bhagvath Singh's user avatar
6 votes
2 answers
2k views

ImageNet pretrained ResNet50 backbones are different between Pytorch and TensorFlow

"Obviously!", you might say... But there's one significant difference that I have trouble explaining by the difference in random initialization. Take the two pre-trained basenets (before the ...
Jav's user avatar
  • 1,527
5 votes
2 answers
7k views

ILSVRC2012 validation ground_truth labels index not matching pretrained networks index

I'm currently using VGG-S pretrained convolutional neural network provided by Lasagne library, from the following link. I downloaded the validation dataset of ILSVRC2012 in order to do a ...
Kearn's user avatar
  • 101
5 votes
4 answers
5k views

How to fix "Trainer: evaluation requires an eval_dataset" in Huggingface Transformers?

I’m trying to do a finetuning without an evaluation dataset. For that, I’m using the following code: training_args = TrainingArguments( output_dir=resume_from_checkpoint, evaluation_strategy=&...
An old man in the sea.'s user avatar
5 votes
2 answers
19k views

ValueError: `decode_predictions` expects a batch of predictions (i.e. a 2D array of shape (samples, 1000)). Found array with shape: (1, 7)

I am using VGG16 with keras for transfer learning (I have 7 classes in my new model) and as such I want to use the build-in decode_predictions method to output the predictions of my model. However, ...
AaronDT's user avatar
  • 4,020
5 votes
2 answers
12k views

How to concatenate 2 pytorch models and make the first one non-trainable in PyTorch

I've two networks, which I need to concatenate for my full model. However my first model is pre-trained and I need to make it non-trainable when training the full model. How can I achieve this in ...
Nagabhushan S N's user avatar
5 votes
2 answers
15k views

Accuracy Stuck at 50% Keras

Code import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential,Model from keras.layers import Dropout, Flatten, Dense,Input from keras import ...
Niteya Shah's user avatar
  • 1,829
5 votes
2 answers
2k views

Why do I have to do two train steps for fine-tuning InceptionV3 in Keras?

I don't understand why I have to call the fit()/fit_generator() function twice in order to fine-tune InceptionV3 (or any other pretrained model) in Keras (version 2.0.0). The documentation suggests ...
D.Laupheimer's user avatar
  • 1,074
5 votes
2 answers
12k views

Does keras have a pretrained AlexNet like VGG19?

If I want to use pretrained VGG19 network, I can simply do from keras.applications.vgg19 import VGG19 VGG19(weights='imagenet') Is there a similar implementation for AlexNet in keras or any other ...
Nagabhushan S N's user avatar
5 votes
1 answer
1k views

What is the difference between TFHub and Model Garden?

TensorFlow Hub is a repository for pre-trained models. Model Garden (Model Zoo) also keeps SOTA models and provides facilities for downloading and leveraging its models like TfHub, and both of them ...
Kaveh's user avatar
  • 4,862
5 votes
1 answer
4k views

ResNet50v2 in Keras

I want to load pre-trained ResNet50v2 model in Keras. I tried keras.applications.resnet_v2.ResNet50V2() This gave an error Traceback (most recent call last): File "<input>", line 1, in <...
Nagabhushan S N's user avatar
5 votes
1 answer
3k views

Combine outputs of two Pre Trained models (trained on different dataset) and use some form of binary classifier to predict images

I have two Pre-Trained models. Model_1 = Inception Model with Imagenet Dataset (1000 classes) My_Model = Inception Model trained with a custom dataset (20 classes) via Transfer Learning and Fine-...
Loki's user avatar
  • 51
5 votes
1 answer
1k views

Where can I find a pre-trained variational autoencoder that's trained on natural images?

Does anyone know a pre-trained variational autoencoder (VAE) or a VAE-GAN that's trained on natural images? I have been searching for a variational autoencoder that is trained on natural images (e.g. ...
Lynn Le's user avatar
  • 113
5 votes
0 answers
2k views

Trained models for tensorflow ocr

I start the course of tensorflow in udacity, and simultaneously I am looking on the web for the topic. I suppose that the typical use cases are well solved already, in a better way that i can achieve ...
mls_dev's user avatar
  • 531
5 votes
1 answer
2k views

how to load pretrained LSTM models weights in Tensorflow

I want to implement a LSTM model with pretrained weights in Tensorflow. These weights may come from Caffee or Torch. I found there are LSTM cells in file rnn_cell.py, such as rnn_cell.BasicLSTMCell ...
Zhiqiang Wan's user avatar
4 votes
3 answers
11k views

KeyError: 'The optimizer cannot recognize variable dense_1/kernel:0. for pretrained keras model VGG19

I'm using the following code to load an imagenet pre-trained VGG19 model and fit to my custom dataset. from keras.applications.vgg19 import VGG19 optim = tf.keras.optimizers.RMSprop(momentum=0.9) ...
shey's user avatar
  • 43
4 votes
1 answer
1k views

Keras VGGnet Pretrained Model Variable Sized Input

I want to extract features of a 368x368 sized image with VGG pretrained model. According to documentation VGGnet accepts 224x224 sized images. Is there a way to give variable sized input to Keras VGG? ...
mkocabas's user avatar
  • 733
4 votes
1 answer
947 views

TF Objection Detection Zoo models don't have Trainable Variables?

The models in the TF Objection Detection Zoo have meta+ckpt file, Frozen.pb file, and Saved_model file. I tried to use the meta+ckpt file to train further and also to extract some weights for ...
lamo_738's user avatar
  • 440
4 votes
2 answers
2k views

Can't restore pre-trained network with Tensorflow

I'm stuck with restoring pre-trained network with Tensorflow.... import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' sess=tf.Session() saver = tf.train.import_meta_graph('./...
soshi shimada's user avatar
4 votes
3 answers
3k views

Tensorflow load pre-trained model use different optimizer

I want to load a pre-trained model (optimized by AdadeltaOptimizer) and continue training with SGD (GradientDescentOptimizer). The models are saved and loaded with tensorlayer API: save model: ...
Irene W.'s user avatar
  • 689
4 votes
1 answer
1k views

Keras model gets worse when fine-tuning

I'm trying to follow the fine-tuning steps described in https://www.tensorflow.org/tutorials/images/transfer_learning#create_the_base_model_from_the_pre-trained_convnets to get a trained model for ...
eLearner's user avatar
4 votes
1 answer
2k views

Weight Initialization from pretrained BERT error in pytorch

I am trying to train the model using pretrained model(BERT) using pytorch. The pretrained model weights still arent accepted. I see this error: Weights of BertForMultiLable not initialized from ...
Aditya Vartak's user avatar
4 votes
2 answers
3k views

How to use model architecture of pretrained models but no weights

I want to use ResNet model architecture and want to change last few layers; how can I only use model architecture from model zoo in Tensorflow?
nerdalert's user avatar

1
2 3 4 5
11