<p dir="auto">Hi<br>
I need to pretrain the bert on one dataset and finetune it then on other datasets, so basically<br>
removing classifier from first part and substitute it with a new one with the specific number of<br>
labels, currently with current codes, it will be error to do it when loading pretrained model,<br>
could you please assist me how I can do this? I have a deadline soon and really appreciate your help urgently.<br>
thanks<br>
Best<br>
Julia</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="model = model_class.from_pretrained(args.model_name_or_path, from_tf=bool('.ckpt' in args.model_name_or_path), config=config)"><pre class="notranslate"><code class="notranslate">model = model_class.from_pretrained(args.model_name_or_path, from_tf=bool('.ckpt' in args.model_name_or_path), config=config)
</code></pre></div>
<p dir="auto">File "julia/libs/anaconda3/envs/transformers/lib/python3.5/site-packages/pytorch_transformers/modeling_utils.py", line 461, in from_pretrained<br>
model.<strong>class</strong>.<strong>name</strong>, "\n\t".join(error_msgs)))<br>
RuntimeError: Error(s) in loading state_dict for BertRUBIForSequenceClassification:<br>
size mismatch for classifier.weight: copying a param with shape torch.Size([174, 768]) from checkpoint, the shape in current model is torch.Size([3, 768]).<br>
size mismatch for classifier.bias: copying a param with shape torch.Size([174]) from checkpoint, the shape in current model is torch.Size([3]).</p>
<p dir="auto">I am using the following version of transformer, datasets and huggingface_hub.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/77198742/232941383-cc398bb4-88c0-4a12-9ff1-c59f8c5aa1a6.png"><img src="https://user-images.githubusercontent.com/77198742/232941383-cc398bb4-88c0-4a12-9ff1-c59f8c5aa1a6.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">I am running into the following error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" NameError: name 'PartialState' is not defined."><pre class="notranslate"> NameError: name <span class="pl-s"><span class="pl-pds">'</span>PartialState<span class="pl-pds">'</span></span> is not defined.</pre></div>
<p dir="auto">How to resolve this issue  to work with my versions of the  transformer, datasets and huggingface_hub ?<br>
My code was running just fine until yesterday.</p>