<p dir="auto">for both groups of tests, the import would be</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from transformers.testing_utils import slow"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">transformers</span>.<span class="pl-s1">testing_utils</span> <span class="pl-k">import</span> <span class="pl-s1">slow</span></pre></div>
<p dir="auto">Motivation: I was about to rewrite the @slow decorator today and felt that this was cleaner.</p>
<p dir="auto">Any objections? <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/julien-c/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/julien-c">@julien-c</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/LysandreJik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/LysandreJik">@LysandreJik</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/thomwolf/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/thomwolf">@thomwolf</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sgugger/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sgugger">@sgugger</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/patrickvonplaten/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/patrickvonplaten">@patrickvonplaten</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mfuntowicz/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mfuntowicz">@mfuntowicz</a><br>
@anyoneelseimforgetting</p>
<h2 dir="auto">Environment info</h2>

<h2 dir="auto">Environment info</h2>

<ul dir="auto">
<li><code class="notranslate">transformers</code> version: 4.4.2</li>
<li>Platform:</li>
<li>Python version: 3.7.6</li>
<li>PyTorch version (GPU?): torch                             1.5.0</li>
<li>Tensorflow version (GPU?):</li>
<li>Using GPU in script?: no ( I just mentionned the number of gpu in a shell script and launch (ex . #SBATCH --partition=gpu_p2; #SBATCH --qos=qos_gpu-dev ; #SBATCH --cpus-per-task=3 )</li>
<li>Using distributed or parallel set-up in script?: no</li>
</ul>
<h3 dir="auto">Who can help</h3>
<ul dir="auto">
<li>albert, bert, xlm: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/LysandreJik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/LysandreJik">@LysandreJik</a></li>
</ul>
<p dir="auto">Library:</p>
<ul dir="auto">
<li>tokenizers: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/LysandreJik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/LysandreJik">@LysandreJik</a></li>
<li>pipelines: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/LysandreJik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/LysandreJik">@LysandreJik</a></li>
</ul>
<p dir="auto">Documentation: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sgugger/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sgugger">@sgugger</a></p>
<p dir="auto">Model I am using (FlauBERT):</p>
<p dir="auto">The problem arises when downloading the model from transformers library:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> the official example scripts: (I did not change much , pretty close to the original)</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="def get_flaubert_layer(texte):

	modelname ='flaubert-small-cased'
	
	flaubert, log = FlaubertModel.from_pretrained(modelname, output_loading_info=True)
	flaubert_tokenizer = FlaubertTokenizer.from_pretrained(modelname, do_lowercase=False)
	tokenized = texte.apply((lambda x: flaubert_tokenizer.encode(x, add_special_tokens=True)))
	max_len = 0
	for i in tokenized.values:
		if len(i) &gt; max_len:
			max_len = len(i)
	padded = np.array([i + [0] * (max_len - len(i)) for i in tokenized.values])
	token_ids = torch.tensor(padded)
	with torch.no_grad():
		last_layer = flaubert(token_ids)[0][:,0,:].numpy()
		
	return last_layer, modelname

### What I added to the code 
def read_file(filename):

	sentences = pd.read_excel(filename, sheet_name= 0)
	data_id = sentences.identifiant
	print(&quot;Total phrases: &quot;, len(data_id))
	data = sentences.verbatim
	data_label = sentences.etiquette
	classes = sentences['etiquette'].unique()
	len_classes = len(classes)
	return data_id, data, data_label, len_classes

def cross_validation_prediction(id_, texte, ylabels, file_, len_classes):
	
	features, modelname = get_flaubert_layer(texte)"><pre class="notranslate"><code class="notranslate">def get_flaubert_layer(texte):

	modelname ='flaubert-small-cased'
	
	flaubert, log = FlaubertModel.from_pretrained(modelname, output_loading_info=True)
	flaubert_tokenizer = FlaubertTokenizer.from_pretrained(modelname, do_lowercase=False)
	tokenized = texte.apply((lambda x: flaubert_tokenizer.encode(x, add_special_tokens=True)))
	max_len = 0
	for i in tokenized.values:
		if len(i) &gt; max_len:
			max_len = len(i)
	padded = np.array([i + [0] * (max_len - len(i)) for i in tokenized.values])
	token_ids = torch.tensor(padded)
	with torch.no_grad():
		last_layer = flaubert(token_ids)[0][:,0,:].numpy()
		
	return last_layer, modelname

### What I added to the code 
def read_file(filename):

	sentences = pd.read_excel(filename, sheet_name= 0)
	data_id = sentences.identifiant
	print("Total phrases: ", len(data_id))
	data = sentences.verbatim
	data_label = sentences.etiquette
	classes = sentences['etiquette'].unique()
	len_classes = len(classes)
	return data_id, data, data_label, len_classes

def cross_validation_prediction(id_, texte, ylabels, file_, len_classes):
	
	features, modelname = get_flaubert_layer(texte)
</code></pre></div>
<p dir="auto">The tasks I am working on is:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> my own task or dataset: I just want to use the model of FlauBert to producve vectors for my dataset that's all</li>
</ul>
<h2 dir="auto">To reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>get the requirements (librairies mentionned above)</li>
<li>Final part of the script to reproduce it :</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="filename = 'test'
fil = filename + &quot;.xlsx&quot;
os.chdir('/linkhome/rech/genlig01/umg16uw/Test_CLASS_avec_FlauBert/corpus')
print(&quot;File preprocessing: &quot; , fil)
id_, texte_, ylabels_, len_classes_ = read_file(fil)
cross_validation_prediction(id_, texte_, ylabels_, filename, len_classes_)	
"><pre class="notranslate"><code class="notranslate">filename = 'test'
fil = filename + ".xlsx"
os.chdir('/linkhome/rech/genlig01/umg16uw/Test_CLASS_avec_FlauBert/corpus')
print("File preprocessing: " , fil)
id_, texte_, ylabels_, len_classes_ = read_file(fil)
cross_validation_prediction(id_, texte_, ylabels_, filename, len_classes_)	

</code></pre></div>
<ol start="3" dir="auto">
<li>stack trace error :</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Loading pytorch-gpu/py3/1.5.0
  Loading requirement: cuda/10.1.2 nccl/2.5.6-2-cuda cudnn/10.1-v7.5.1.10
    gcc/8.2.0 intel-compilers/19.0.4 openmpi/4.0.1-cuda
Traceback (most recent call last):
  File &quot;test.py&quot;, line 227, in &lt;module&gt;
    cross_validation_prediction(id_, texte_, ylabels_, filename, len_classes_)	
  File &quot;test.py&quot;, line 107, in cross_validation_prediction
    features, modelname = get_flaubert_layer(texte)
  File &quot;test.py&quot;, line 56, in get_flaubert_layer
    flaubert, log = FlaubertModel.from_pretrained(modelname, output_loading_info=True)
  File &quot;/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/modeling_utils.py&quot;, line 986, in from_pretrained
    **kwargs,
  File &quot;/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/configuration_utils.py&quot;, line 386, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File &quot;/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/configuration_utils.py&quot;, line 438, in get_config_dict
    use_auth_token=use_auth_token,
  File &quot;/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/file_utils.py&quot;, line 1142, in cached_path
    local_files_only=local_files_only,
  File &quot;/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/file_utils.py&quot;, line 1349, in get_from_cache
    &quot;Connection error, and we cannot find the requested files in the cached path.&quot;
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.
srun: error: jean-zay-ia808: task 0: Exited with exit code 1
srun: Terminating job step 841126.0"><pre class="notranslate"><code class="notranslate">Loading pytorch-gpu/py3/1.5.0
  Loading requirement: cuda/10.1.2 nccl/2.5.6-2-cuda cudnn/10.1-v7.5.1.10
    gcc/8.2.0 intel-compilers/19.0.4 openmpi/4.0.1-cuda
Traceback (most recent call last):
  File "test.py", line 227, in &lt;module&gt;
    cross_validation_prediction(id_, texte_, ylabels_, filename, len_classes_)	
  File "test.py", line 107, in cross_validation_prediction
    features, modelname = get_flaubert_layer(texte)
  File "test.py", line 56, in get_flaubert_layer
    flaubert, log = FlaubertModel.from_pretrained(modelname, output_loading_info=True)
  File "/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/modeling_utils.py", line 986, in from_pretrained
    **kwargs,
  File "/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/configuration_utils.py", line 386, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/configuration_utils.py", line 438, in get_config_dict
    use_auth_token=use_auth_token,
  File "/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/file_utils.py", line 1142, in cached_path
    local_files_only=local_files_only,
  File "/gpfslocalsup/pub/anaconda-py3/2020.02/envs/pytorch-gpu-1.5.0/lib/python3.7/site-packages/transformers/file_utils.py", line 1349, in get_from_cache
    "Connection error, and we cannot find the requested files in the cached path."
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.
srun: error: jean-zay-ia808: task 0: Exited with exit code 1
srun: Terminating job step 841126.0
</code></pre></div>
<p dir="auto">I expected the model to load and get the vectors in the appropriate varaible, instead Iget this error above.<br>
I have internet and when trying to do it locally and not on the server with small sample it works but when I load a vritual env with the specific library I get this error;</p>