Unable to load weights from pytorch checkpoint after splitting pytorch_model.bin into chunks
I need to transfer a pytorch_model.bin of a pretrained deeppavlov ruBERT model but I have a file size limit. So I split it into chunks using python, transferred and reassembled in the correct order. However, the size of the file increased, and when I tried to load the resulting file using BertModel.from_pretrained(pytorch_model.bin) I received an error:
During handling of the above exception, another exception occurred:
OSError: Unable to load weights from pytorch checkpoint &lt;...&gt;

So my question is: is it actually possible to split the file like that? I could possibly have a mistake in the way I split and reassemble the file. However, this could also be some version mismatch.
My python code to get chunks:
chunk_size = 40000000
file_num = 1
with open(&quot;pytorch_model.bin&quot;, &quot;rb&quot;) as f:
    chunk = f.read(chunk_size)
    while chunk:
        with open(&quot;chunk_&quot; + str(file_num), &quot;wb&quot;) as chunk_file:
            chunk_file.write(chunk)
        file_num += 1
        chunk = f.read(chunk_size)


Code to reassemble one file:
chunks = !ls | grep chunk_
chunks = sorted(chunks, key=lambda x: int(x.split(&quot;_&quot;)[-1]))

for chunk in chunks:
    with open(chunk, &quot;rb&quot;) as f:
        contents = f.read()
    if chunk == chunks[0]:
        write_mode = &quot;wb&quot;
    else:
        write_mode = &quot;ab&quot;
    with open(&quot;pytorch_model.bin&quot;, write_mode) as f:
        f.write(contents)

python 3.7.0, torch 1.5.1, transformers 4.2.2. I have no way to move files bigger than 40 MB.
TIA for your help!

Those who are new to this issue I just figured it out and save your time 
What is this error about?
==&gt; When you run the model for the first time it downloads some files { pytorch_model.bin } and if your internet is broken accidentally between processes it will continue running the pipeline file without completely downloading that pytorch_model.bin file so it will raise this issue.
Steps : 
1 ] Go to C:// Users / UserName / .cache
2 ] Delete .cache folder
3 ] And Done Just Run The Model Once Again......

