<ol dir="auto">
<li>
<p dir="auto">just use <code class="notranslate">conda install transformers</code>，the transformers version is 4.4.2,  can't run<br>
1.1. error:<br>
```bash<br>
can't import pipline</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  # then use tokenizer and model to get my feature vector，ERROR：

    RuntimeError: Error(s) in loading state_dict for BartModel:"><pre class="notranslate"><code class="notranslate">  # then use tokenizer and model to get my feature vector，ERROR：

    RuntimeError: Error(s) in loading state_dict for BartModel:
</code></pre></div>
<p dir="auto">size mismatch for model.encoder.embed_positions.weight: copying a param with shape torch.Size([16386, 768]) from<br>
checkpoint, the shape in current model is torch.Size([1026, 768]).<br>
```</p>
</li>
<li>
<p dir="auto">change to use <code class="notranslate">pip install transformers</code>, the transformers version is 3.3.0,can't run<br>
2.1. error:<br>
```bash<br>
can't import name tokenizer</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  # then i found it in issue that use &quot;pip install tokenizer&quot;, it has exited, and tokenizer version is 0.8.0rc2. I find another env that can work,the tokenizer version is 0.5.0,so i use pip to change its version from 0.8.0rc2 to 0.5.0.ERROR:
  
  pip's dependency ..... which is incompatibe
  
 # however the version of toikenizer in only one env which can run is 0.5.0 . 
  ```"><pre class="notranslate"><code class="notranslate">  # then i found it in issue that use "pip install tokenizer", it has exited, and tokenizer version is 0.8.0rc2. I find another env that can work,the tokenizer version is 0.5.0,so i use pip to change its version from 0.8.0rc2 to 0.5.0.ERROR:
  
  pip's dependency ..... which is incompatibe
  
 # however the version of toikenizer in only one env which can run is 0.5.0 . 
  ```
</code></pre></div>
</li>
<li>
<p dir="auto">So the only one worked env is:</p>
</li>
</ol>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="conda create -n dnabert python=3.6

# pytorch-transformers 
pip install pytorch-transformers

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

# dnabert
git clone https://github.com/jerryji1993/DNABERT
cd DNABERT
python3 -m pip install --editable .
cd examples
python3 -m pip install -r requirements.txt 

# allenai 
conda install cudatoolkit=10.0
pip install git+https://github.com/allenai/longformer.git

# huggingface
pip install transformers"><pre class="notranslate">conda create -n dnabert python=3.6

<span class="pl-c"><span class="pl-c">#</span> pytorch-transformers </span>
pip install pytorch-transformers

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

<span class="pl-c"><span class="pl-c">#</span> dnabert</span>
git clone https://github.com/jerryji1993/DNABERT
<span class="pl-c1">cd</span> DNABERT
python3 -m pip install --editable <span class="pl-c1">.</span>
<span class="pl-c1">cd</span> examples
python3 -m pip install -r requirements.txt 

<span class="pl-c"><span class="pl-c">#</span> allenai </span>
conda install cudatoolkit=10.0
pip install git+https://github.com/allenai/longformer.git

<span class="pl-c"><span class="pl-c">#</span> huggingface</span>
pip install transformers</pre></div>
<h1 dir="auto">我做错了什么才会到这种局面？</h1>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="RuntimeError: Error(s) in loading state_dict for BartModel:
	size mismatch for model.encoder.embed_positions.weight: copying a param with shape torch.Size([16386, 768]) from checkpoint, the shape in current model is torch.Size([1026, 768])."><pre class="notranslate">RuntimeError: Error(s) <span class="pl-k">in</span> loading state_dict <span class="pl-k">for</span> BartModel:
	size mismatch <span class="pl-k">for</span> <span class="pl-smi">model.encoder.embed_positions.weight: copying a param with shape torch.Size([16386, 768]) from checkpoint, the shape</span> <span class="pl-k">in</span> current model is torch.Size([1026, 768]).</pre></div>
<p dir="auto">I use longformer model called longformer-encdec-base-16384 which is downloaded in <a href="https://github.com/allenai/longformer%EF%BC%8Cand">https://github.com/allenai/longformer，and</a> use huggingface to load the model，when transformers’ version is 3.1.0， the code can run, but when it is 4.4.2，the error happened.</p>
<p dir="auto">MeanWhile,when I use the model to proposal pairs of sentences，I found it that the returned token_type_ids values are just zero<br>
without one. how ever,in the model's special_tokens_map.json, it has defined cls_token and sep_token.</p>
<p dir="auto">Finally, I sincerely hope you would reply me soon. Thanks！</p>