Hi,
I have a local Python 3.8 conda environment with tensorflow and transformers installed with pip (because conda does not install transformers with Python 3.8)
But I keep getting warning messages like “Some layers from the model checkpoint at (model-name) were not used when initializing (…)”
Even running the first simple example from the quick tour page generates 2 of these warning (although slightly different) as shown below
Code:
from transformers import pipeline
classifier = pipeline('sentiment-analysis')

Output:
Downloading: 100% 629/629 [00:11<00:00, 52.5B/s]
Downloading: 100% 268M/268M [00:11<00:00, 23.9MB/s]

Some layers from the model checkpoint at distilbert-base-uncased-finetuned-sst-2-english were not used when initializing TFDistilBertModel: ['pre_classifier', 'classifier', 'dropout_19']
- This IS expected if you are initializing TFDistilBertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing TFDistilBertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
All the layers of TFDistilBertModel were initialized from the model checkpoint at distilbert-base-uncased-finetuned-sst-2-english.
If your task is similar to the task the model of the checkpoint was trained on, you can already use TFDistilBertModel for predictions without further training.

Downloading: 100% 232k/232k [00:02<00:00, 111kB/s]
Downloading: 100% 230/230 [00:01<00:00, 226B/s]

Some layers from the model checkpoint at distilbert-base-uncased-finetuned-sst-2-english were not used when initializing TFDistilBertForSequenceClassification: ['dropout_19']
- This IS expected if you are initializing TFDistilBertForSequenceClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing TFDistilBertForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some layers of TFDistilBertForSequenceClassification were not initialized from the model checkpoint at distilbert-base-uncased-finetuned-sst-2-english and are newly initialized: ['dropout_38']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

My configuration (‘transformers-cli env’ output):
2020-11-10 21:32:33.799767: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-11-10 21:32:33.804571: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
WARNING:tensorflow:From c:\users\basvdw\miniconda3\envs\lm38\lib\site-packages\transformers\commands\env.py:36: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-11-10 21:32:37.029143: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-11-10 21:32:37.049021: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x154dca447d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-11-10 21:32:37.055558: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-11-10 21:32:37.061622: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-11-10 21:32:37.065536: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2020-11-10 21:32:37.074543: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: S825
2020-11-10 21:32:37.080321: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: S825

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

- `transformers` version: 3.5.0
- Platform: Windows-10-10.0.18362-SP0
- Python version: 3.8.6
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): 2.3.1 (False)
- Using GPU in script?: No:
- Using distributed or parallel set-up in script?: No

Does anyone know what causes this messages and how I could fix this ? I do not really understand the warning, because I thought I was using a pre-trained model which doesn’t need any more training…
Any help would be appreciated !