<h2 dir="auto">🐛 Bug</h2>
<p dir="auto">2020-02-12 01:34:22,801 copying C:\Users\1025289\AppData\Local\Temp\2\tmp5d0w7nip to cache at C:\Users\1025289.flair\models\en-pos-ontonotes-fast-v0.4.pt<br>
2020-02-12 01:34:22,973 removing temp file C:\Users\1025289\AppData\Local\Temp\2\tmp5d0w7nip<br>
2020-02-12 01:34:22,988 loading file C:\Users\1025289.flair\models\en-pos-ontonotes-fast-v0.4.pt<br>
Traceback (most recent call last):<br>
File "fmain.py", line 16, in <br>
main()<br>
File "fmain.py", line 4, in main<br>
intent_obj = GET_INTENT()<br>
File "C:\Users\1025289\Desktop\intent\get_intent.py", line 10, in <strong>init</strong><br>
super().<strong>init</strong>(b_preprocess_query=b_preprocess_query)<br>
File "C:\Users\1025289\Desktop\intent\model_flair.py", line 24, in <strong>init</strong><br>
self._load_flair_model(flair_model)<br>
File "C:\Users\1025289\Desktop\intent\model_flair.py", line 30, in _load_flair_model<br>
self._seq_tag = SequenceTagger.load(flair_model)<br>
File "C:\Users\1025289\AppData\Local\Programs\Python\Python38\lib\site-packages\flair\nn.py", line 86, in load<br>
state = torch.load(f, map_location=flair.device)<br>
File "C:\Users\1025289\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 529, in load<br>
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)<br>
File "C:\Users\1025289\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 692, in _legacy_load<br>
magic_number = pickle_module.load(f, **pickle_load_args)<br>
TypeError: file must have 'read', 'readinto' and 'readline' attributes</p>
<h2 dir="auto">To Reproduce</h2>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0):1.4</li>
<li>OS (e.g., Linux): Windows 10</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source):pip</li>
<li>Python version: 3.81 x64</li>
<li>CUDA/cuDNN version: No</li>
<li>GPU models and configuration:No</li>
<li>Any other relevant information:</li>
</ul>
<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>

<p dir="auto">Error text:</p>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="======================================================================
ERROR: test_serialization_filelike_api_requirements (__main__.TestTorch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;test_torch.py&quot;, line 4446, in test_serialization_filelike_api_requirements
    _ = torch.load(filemock)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 590, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 754, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
TypeError: file must have 'read', 'readinto' and 'readline' attributes

======================================================================
ERROR: test_serialization_filelike_missing_attrs (__main__.TestTorch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;test_torch.py&quot;, line 4473, in test_serialization_filelike_missing_attrs
    self._test_serialization_filelike(to_serialize, mock, desc)
  File &quot;test_torch.py&quot;, line 4458, in _test_serialization_filelike
    b = torch.load(data)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 590, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 754, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
TypeError: file must have 'read', 'readinto' and 'readline' attributes

======================================================================
ERROR: test_serialization_filelike_stress (__main__.TestTorch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;test_torch.py&quot;, line 4479, in test_serialization_filelike_stress
    self._test_serialization_filelike(a, lambda x: FilelikeMock(x, has_readinto=False),
  File &quot;test_torch.py&quot;, line 4458, in _test_serialization_filelike
    b = torch.load(data)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 590, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File &quot;C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py&quot;, line 754, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
TypeError: file must have 'read', 'readinto' and 'readline' attributes

----------------------------------------------------------------------
Ran 3620 tests in 103.071s"><pre class="notranslate">======================================================================
<span class="pl-en">ERROR</span>: <span class="pl-s">test_serialization_filelike_api_requirements (__main__.TestTorch)</span>
----------------------------------------------------------------------
Traceback (most recent call last):
  File <span class="pl-s">"test_torch.py"</span>, line <span class="pl-c1">4446</span>, in <span class="pl-en">test_serialization_filelike_api_requirements</span>
    _ <span class="pl-k">=</span> torch.load(filemock)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">590</span>, in <span class="pl-en">load</span>
    <span class="pl-k">return</span> _legacy_load(opened_file, map_location, pickle_module, <span class="pl-k">**</span>pickle_load_args)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">754</span>, in <span class="pl-en">_legacy_load</span>
    magic_number <span class="pl-k">=</span> pickle_module.load(f, <span class="pl-k">**</span>pickle_load_args)
<span class="pl-en">TypeError</span>: <span class="pl-s">file must have 'read', 'readinto' and 'readline' attributes</span>

======================================================================
<span class="pl-en">ERROR</span>: <span class="pl-s">test_serialization_filelike_missing_attrs (__main__.TestTorch)</span>
----------------------------------------------------------------------
Traceback (most recent call last):
  File <span class="pl-s">"test_torch.py"</span>, line <span class="pl-c1">4473</span>, in <span class="pl-en">test_serialization_filelike_missing_attrs</span>
    <span class="pl-c1">self</span>._test_serialization_filelike(to_serialize, mock, desc)
  File <span class="pl-s">"test_torch.py"</span>, line <span class="pl-c1">4458</span>, in <span class="pl-en">_test_serialization_filelike</span>
    b <span class="pl-k">=</span> torch.load(data)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">590</span>, in <span class="pl-en">load</span>
    <span class="pl-k">return</span> _legacy_load(opened_file, map_location, pickle_module, <span class="pl-k">**</span>pickle_load_args)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">754</span>, in <span class="pl-en">_legacy_load</span>
    magic_number <span class="pl-k">=</span> pickle_module.load(f, <span class="pl-k">**</span>pickle_load_args)
<span class="pl-en">TypeError</span>: <span class="pl-s">file must have 'read', 'readinto' and 'readline' attributes</span>

======================================================================
<span class="pl-en">ERROR</span>: <span class="pl-s">test_serialization_filelike_stress (__main__.TestTorch)</span>
----------------------------------------------------------------------
Traceback (most recent call last):
  File <span class="pl-s">"test_torch.py"</span>, line <span class="pl-c1">4479</span>, in <span class="pl-en">test_serialization_filelike_stress</span>
    <span class="pl-c1">self</span>._test_serialization_filelike(a, <span class="pl-k">lambda</span> <span class="pl-smi">x</span>: FilelikeMock(x, <span class="pl-v">has_readinto</span><span class="pl-k">=</span><span class="pl-c1">False</span>),
  File <span class="pl-s">"test_torch.py"</span>, line <span class="pl-c1">4458</span>, in <span class="pl-en">_test_serialization_filelike</span>
    b <span class="pl-k">=</span> torch.load(data)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">590</span>, in <span class="pl-en">load</span>
    <span class="pl-k">return</span> _legacy_load(opened_file, map_location, pickle_module, <span class="pl-k">**</span>pickle_load_args)
  File <span class="pl-s">"C:\Users\circleci\project\build\win_tmp\build\torch\serialization.py"</span>, line <span class="pl-c1">754</span>, in <span class="pl-en">_legacy_load</span>
    magic_number <span class="pl-k">=</span> pickle_module.load(f, <span class="pl-k">**</span>pickle_load_args)
<span class="pl-en">TypeError</span>: <span class="pl-s">file must have 'read', 'readinto' and 'readline' attributes</span>

----------------------------------------------------------------------
Ran 3620 tests in 103.071s</pre></div>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>python test_torch.py</li>
</ol>

<h2 dir="auto">Expected behavior</h2>

<h2 dir="auto">Environment</h2>
<p dir="auto">Please copy and paste the output from our<br>
<a href="https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py" rel="nofollow">environment collection script</a><br>
(or fill out the checklist below manually).</p>
<p dir="auto">You can get the script and run it with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py"><pre class="notranslate"><code class="notranslate">wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
</code></pre></div>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): e4db0a5</li>
<li>OS (e.g., Linux): Windows</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): source</li>
<li>Build command you used (if compiling from source): python setup.py build</li>
<li>Python version: 3.8</li>
<li>CUDA/cuDNN version: N/A</li>
<li>GPU models and configuration: N/A</li>
<li>Any other relevant information:</li>
</ul>
<h2 dir="auto">Additional context</h2>

<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ezyang/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ezyang">@ezyang</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gchanan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gchanan">@gchanan</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zou3519/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zou3519">@zou3519</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/peterjc123/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/peterjc123">@peterjc123</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a></p>