We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error when running DrQA PyTorch 1.0.0
When running the basic example on SQUAD 
```python examples/train_model.py -m drqa -t squad -bs 32```
Throwing this. 
```[ training... ]
/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:177: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  alpha_flat = F.softmax(scores.view(-1, y.size(1)))
/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:237: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  alpha = F.softmax(scores)
/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:210: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
  alpha = F.log_softmax(xWy)
Traceback (most recent call last):
  File "examples/train_model.py", line 16, in <module>
    TrainLoop(opt).train()
  File "/content/DuReader/data/ParlAI/parlai/scripts/train_model.py", line 500, in train
    world.parley()
  File "/content/DuReader/data/ParlAI/parlai/core/worlds.py", line 641, in parley
    batch_act = self.batch_act(agent_idx, batch_observations[agent_idx])
  File "/content/DuReader/data/ParlAI/parlai/core/worlds.py", line 614, in batch_act
    batch_actions = a.batch_act(batch_observation)
  File "/content/DuReader/data/ParlAI/parlai/agents/drqa/drqa.py", line 227, in batch_act
    self.model.update(batch)
  File "/content/DuReader/data/ParlAI/parlai/agents/drqa/model.py", line 102, in update
    self.train_loss.update(loss.data[0], ex[0].size(0))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
```
I think this is related to the new version of PyTorch and the fix should be fairly trivial. Anyone working on fixing it soon? If not I could probably do a PR. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `parlai/agents/drqa/model.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 # Copyright (c) Facebook, Inc. and its affiliates.
4 # This source code is licensed under the MIT license found in the
5 # LICENSE file in the root directory of this source tree.
6 import torch
7 import torch.optim as optim
8 import torch.nn.functional as F
9 import numpy as np
10 import logging
11 
12 from torch.autograd import Variable
13 from .utils import load_embeddings, AverageMeter
14 from .rnn_reader import RnnDocReader
15 
16 logger = logging.getLogger('DrQA')
17 
18 
19 class DocReaderModel(object):
20     """High level model that handles intializing the underlying network
21     architecture, saving, updating examples, and predicting examples.
22     """
23 
24     def __init__(self, opt, word_dict, feature_dict, state_dict=None):
25         # Book-keeping.
26         self.opt = opt
27         self.word_dict = word_dict
28         self.feature_dict = feature_dict
29         self.updates = 0
30         self.train_loss = AverageMeter()
31 
32         # Building network.
33         self.network = RnnDocReader(opt)
34         if state_dict:
35             new_state = set(self.network.state_dict().keys())
36             for k in list(state_dict['network'].keys()):
37                 if k not in new_state:
38                     del state_dict['network'][k]
39             self.network.load_state_dict(state_dict['network'])
40 
41         # Building optimizer.
42         parameters = [p for p in self.network.parameters() if p.requires_grad]
43         if opt['optimizer'] == 'sgd':
44             self.optimizer = optim.SGD(parameters, opt['learning_rate'],
45                                        momentum=opt['momentum'],
46                                        weight_decay=opt['weight_decay'])
47         elif opt['optimizer'] == 'adamax':
48             self.optimizer = optim.Adamax(parameters,
49                                           weight_decay=opt['weight_decay'])
50         else:
51             raise RuntimeError('Unsupported optimizer: %s' % opt['optimizer'])
52 
53     def set_embeddings(self):
54         # Read word embeddings.
55         if not self.opt.get('embedding_file'):
56             logger.warning('[ WARNING: No embeddings provided. '
57                            'Keeping random initialization. ]')
58             return
59         logger.info('[ Loading pre-trained embeddings ]')
60         embeddings = load_embeddings(self.opt, self.word_dict)
61         logger.info('[ Num embeddings = %d ]' % embeddings.size(0))
62 
63         # Sanity check dimensions
64         new_size = embeddings.size()
65         old_size = self.network.embedding.weight.size()
66         if new_size[1] != old_size[1]:
67             raise RuntimeError('Embedding dimensions do not match.')
68         if new_size[0] != old_size[0]:
69             logger.warning(
70                 '[ WARNING: Number of embeddings changed (%d->%d) ]' %
71                 (old_size[0], new_size[0])
72             )
73 
74         # Swap weights
75         self.network.embedding.weight.data = embeddings
76 
77         # If partially tuning the embeddings, keep the old values
78         if self.opt['tune_partial'] > 0:
79             if self.opt['tune_partial'] + 2 < embeddings.size(0):
80                 fixed_embedding = embeddings[self.opt['tune_partial'] + 2:]
81                 self.network.fixed_embedding = fixed_embedding
82 
83     def update(self, ex):
84         # Train mode
85         self.network.train()
86 
87         # Transfer to GPU
88         if self.opt['cuda']:
89             inputs = [Variable(e.cuda(non_blocking=True)) for e in ex[:5]]
90             target_s = Variable(ex[5].cuda(non_blocking=True))
91             target_e = Variable(ex[6].cuda(non_blocking=True))
92         else:
93             inputs = [Variable(e) for e in ex[:5]]
94             target_s = Variable(ex[5])
95             target_e = Variable(ex[6])
96 
97         # Run forward
98         score_s, score_e = self.network(*inputs)
99 
100         # Compute loss and accuracies
101         loss = F.nll_loss(score_s, target_s) + F.nll_loss(score_e, target_e)
102         self.train_loss.update(loss.data[0], ex[0].size(0))
103 
104         # Clear gradients and run backward
105         self.optimizer.zero_grad()
106         loss.backward()
107 
108         # Clip gradients
109         torch.nn.utils.clip_grad_norm(self.network.parameters(),
110                                       self.opt['grad_clipping'])
111 
112         # Update parameters
113         self.optimizer.step()
114         self.updates += 1
115 
116         # Reset any partially fixed parameters (e.g. rare words)
117         self.reset_parameters()
118 
119     def predict(self, ex):
120         # Eval mode
121         self.network.eval()
122 
123         # Transfer to GPU
124         if self.opt['cuda']:
125             inputs = [Variable(e.cuda(non_blocking=True), volatile=True)
126                       for e in ex[:5]]
127         else:
128             inputs = [Variable(e, volatile=True) for e in ex[:5]]
129 
130         # Run forward
131         score_s, score_e = self.network(*inputs)
132 
133         # Transfer to CPU/normal tensors for numpy ops
134         score_s = score_s.data.cpu()
135         score_e = score_e.data.cpu()
136 
137         # Get argmax text spans
138         text = ex[-2]
139         spans = ex[-1]
140         predictions = []
141         pred_scores = []
142         max_len = self.opt['max_len'] or score_s.size(1)
143         for i in range(score_s.size(0)):
144             scores = torch.ger(score_s[i], score_e[i])
145             scores.triu_().tril_(max_len - 1)
146             scores = scores.numpy()
147             s_idx, e_idx = np.unravel_index(np.argmax(scores), scores.shape)
148             s_offset, e_offset = spans[i][s_idx][0], spans[i][e_idx][1]
149             predictions.append(text[i][s_offset:e_offset])
150             pred_scores.append(np.max(scores))
151 
152         return predictions, pred_scores
153 
154     def reset_parameters(self):
155         # Reset fixed embeddings to original value
156         if self.opt['tune_partial'] > 0:
157             offset = self.opt['tune_partial'] + 2
158             if offset < self.network.embedding.weight.data.size(0):
159                 self.network.embedding.weight.data[offset:] \
160                     = self.network.fixed_embedding
161 
162     def save(self, filename):
163         params = {
164             'state_dict': {
165                 'network': self.network.state_dict(),
166             },
167             'feature_dict': self.feature_dict,
168             'config': self.opt,
169         }
170         try:
171             torch.save(params, filename)
172         except BaseException:
173             logger.warn('[ WARN: Saving failed... continuing anyway. ]')
174 
175     def cuda(self):
176         self.network.cuda()
177
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/parlai/agents/drqa/model.py b/parlai/agents/drqa/model.py
--- a/parlai/agents/drqa/model.py
+++ b/parlai/agents/drqa/model.py
@@ -99,7 +99,7 @@
 
         # Compute loss and accuracies
         loss = F.nll_loss(score_s, target_s) + F.nll_loss(score_e, target_e)
-        self.train_loss.update(loss.data[0], ex[0].size(0))
+        self.train_loss.update(loss.data.item(), ex[0].size(0))
 
         # Clear gradients and run backward
         self.optimizer.zero_grad()

{"golden_diff": "diff --git a/parlai/agents/drqa/model.py b/parlai/agents/drqa/model.py\n--- a/parlai/agents/drqa/model.py\n+++ b/parlai/agents/drqa/model.py\n@@ -99,7 +99,7 @@\n \n         # Compute loss and accuracies\n         loss = F.nll_loss(score_s, target_s) + F.nll_loss(score_e, target_e)\n-        self.train_loss.update(loss.data[0], ex[0].size(0))\n+        self.train_loss.update(loss.data.item(), ex[0].size(0))\n \n         # Clear gradients and run backward\n         self.optimizer.zero_grad()\n", "issue": "Error when running DrQA PyTorch 1.0.0\nWhen running the basic example on SQUAD \r\n```python examples/train_model.py -m drqa -t squad -bs 32```\r\nThrowing this. \r\n```[ training... ]\r\n/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:177: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.\r\n  alpha_flat = F.softmax(scores.view(-1, y.size(1)))\r\n/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:237: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.\r\n  alpha = F.softmax(scores)\r\n/content/DuReader/data/ParlAI/parlai/agents/drqa/layers.py:210: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.\r\n  alpha = F.log_softmax(xWy)\r\nTraceback (most recent call last):\r\n  File \"examples/train_model.py\", line 16, in <module>\r\n    TrainLoop(opt).train()\r\n  File \"/content/DuReader/data/ParlAI/parlai/scripts/train_model.py\", line 500, in train\r\n    world.parley()\r\n  File \"/content/DuReader/data/ParlAI/parlai/core/worlds.py\", line 641, in parley\r\n    batch_act = self.batch_act(agent_idx, batch_observations[agent_idx])\r\n  File \"/content/DuReader/data/ParlAI/parlai/core/worlds.py\", line 614, in batch_act\r\n    batch_actions = a.batch_act(batch_observation)\r\n  File \"/content/DuReader/data/ParlAI/parlai/agents/drqa/drqa.py\", line 227, in batch_act\r\n    self.model.update(batch)\r\n  File \"/content/DuReader/data/ParlAI/parlai/agents/drqa/model.py\", line 102, in update\r\n    self.train_loss.update(loss.data[0], ex[0].size(0))\r\nIndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number\r\n```\r\nI think this is related to the new version of PyTorch and the fix should be fairly trivial. Anyone working on fixing it soon? If not I could probably do a PR. \n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates.\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\nimport torch\nimport torch.optim as optim\nimport torch.nn.functional as F\nimport numpy as np\nimport logging\n\nfrom torch.autograd import Variable\nfrom .utils import load_embeddings, AverageMeter\nfrom .rnn_reader import RnnDocReader\n\nlogger = logging.getLogger('DrQA')\n\n\nclass DocReaderModel(object):\n    \"\"\"High level model that handles intializing the underlying network\n    architecture, saving, updating examples, and predicting examples.\n    \"\"\"\n\n    def __init__(self, opt, word_dict, feature_dict, state_dict=None):\n        # Book-keeping.\n        self.opt = opt\n        self.word_dict = word_dict\n        self.feature_dict = feature_dict\n        self.updates = 0\n        self.train_loss = AverageMeter()\n\n        # Building network.\n        self.network = RnnDocReader(opt)\n        if state_dict:\n            new_state = set(self.network.state_dict().keys())\n            for k in list(state_dict['network'].keys()):\n                if k not in new_state:\n                    del state_dict['network'][k]\n            self.network.load_state_dict(state_dict['network'])\n\n        # Building optimizer.\n        parameters = [p for p in self.network.parameters() if p.requires_grad]\n        if opt['optimizer'] == 'sgd':\n            self.optimizer = optim.SGD(parameters, opt['learning_rate'],\n                                       momentum=opt['momentum'],\n                                       weight_decay=opt['weight_decay'])\n        elif opt['optimizer'] == 'adamax':\n            self.optimizer = optim.Adamax(parameters,\n                                          weight_decay=opt['weight_decay'])\n        else:\n            raise RuntimeError('Unsupported optimizer: %s' % opt['optimizer'])\n\n    def set_embeddings(self):\n        # Read word embeddings.\n        if not self.opt.get('embedding_file'):\n            logger.warning('[ WARNING: No embeddings provided. '\n                           'Keeping random initialization. ]')\n            return\n        logger.info('[ Loading pre-trained embeddings ]')\n        embeddings = load_embeddings(self.opt, self.word_dict)\n        logger.info('[ Num embeddings = %d ]' % embeddings.size(0))\n\n        # Sanity check dimensions\n        new_size = embeddings.size()\n        old_size = self.network.embedding.weight.size()\n        if new_size[1] != old_size[1]:\n            raise RuntimeError('Embedding dimensions do not match.')\n        if new_size[0] != old_size[0]:\n            logger.warning(\n                '[ WARNING: Number of embeddings changed (%d->%d) ]' %\n                (old_size[0], new_size[0])\n            )\n\n        # Swap weights\n        self.network.embedding.weight.data = embeddings\n\n        # If partially tuning the embeddings, keep the old values\n        if self.opt['tune_partial'] > 0:\n            if self.opt['tune_partial'] + 2 < embeddings.size(0):\n                fixed_embedding = embeddings[self.opt['tune_partial'] + 2:]\n                self.network.fixed_embedding = fixed_embedding\n\n    def update(self, ex):\n        # Train mode\n        self.network.train()\n\n        # Transfer to GPU\n        if self.opt['cuda']:\n            inputs = [Variable(e.cuda(non_blocking=True)) for e in ex[:5]]\n            target_s = Variable(ex[5].cuda(non_blocking=True))\n            target_e = Variable(ex[6].cuda(non_blocking=True))\n        else:\n            inputs = [Variable(e) for e in ex[:5]]\n            target_s = Variable(ex[5])\n            target_e = Variable(ex[6])\n\n        # Run forward\n        score_s, score_e = self.network(*inputs)\n\n        # Compute loss and accuracies\n        loss = F.nll_loss(score_s, target_s) + F.nll_loss(score_e, target_e)\n        self.train_loss.update(loss.data[0], ex[0].size(0))\n\n        # Clear gradients and run backward\n        self.optimizer.zero_grad()\n        loss.backward()\n\n        # Clip gradients\n        torch.nn.utils.clip_grad_norm(self.network.parameters(),\n                                      self.opt['grad_clipping'])\n\n        # Update parameters\n        self.optimizer.step()\n        self.updates += 1\n\n        # Reset any partially fixed parameters (e.g. rare words)\n        self.reset_parameters()\n\n    def predict(self, ex):\n        # Eval mode\n        self.network.eval()\n\n        # Transfer to GPU\n        if self.opt['cuda']:\n            inputs = [Variable(e.cuda(non_blocking=True), volatile=True)\n                      for e in ex[:5]]\n        else:\n            inputs = [Variable(e, volatile=True) for e in ex[:5]]\n\n        # Run forward\n        score_s, score_e = self.network(*inputs)\n\n        # Transfer to CPU/normal tensors for numpy ops\n        score_s = score_s.data.cpu()\n        score_e = score_e.data.cpu()\n\n        # Get argmax text spans\n        text = ex[-2]\n        spans = ex[-1]\n        predictions = []\n        pred_scores = []\n        max_len = self.opt['max_len'] or score_s.size(1)\n        for i in range(score_s.size(0)):\n            scores = torch.ger(score_s[i], score_e[i])\n            scores.triu_().tril_(max_len - 1)\n            scores = scores.numpy()\n            s_idx, e_idx = np.unravel_index(np.argmax(scores), scores.shape)\n            s_offset, e_offset = spans[i][s_idx][0], spans[i][e_idx][1]\n            predictions.append(text[i][s_offset:e_offset])\n            pred_scores.append(np.max(scores))\n\n        return predictions, pred_scores\n\n    def reset_parameters(self):\n        # Reset fixed embeddings to original value\n        if self.opt['tune_partial'] > 0:\n            offset = self.opt['tune_partial'] + 2\n            if offset < self.network.embedding.weight.data.size(0):\n                self.network.embedding.weight.data[offset:] \\\n                    = self.network.fixed_embedding\n\n    def save(self, filename):\n        params = {\n            'state_dict': {\n                'network': self.network.state_dict(),\n            },\n            'feature_dict': self.feature_dict,\n            'config': self.opt,\n        }\n        try:\n            torch.save(params, filename)\n        except BaseException:\n            logger.warn('[ WARN: Saving failed... continuing anyway. ]')\n\n    def cuda(self):\n        self.network.cuda()\n", "path": "parlai/agents/drqa/model.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates.\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\nimport torch\nimport torch.optim as optim\nimport torch.nn.functional as F\nimport numpy as np\nimport logging\n\nfrom torch.autograd import Variable\nfrom .utils import load_embeddings, AverageMeter\nfrom .rnn_reader import RnnDocReader\n\nlogger = logging.getLogger('DrQA')\n\n\nclass DocReaderModel(object):\n    \"\"\"High level model that handles intializing the underlying network\n    architecture, saving, updating examples, and predicting examples.\n    \"\"\"\n\n    def __init__(self, opt, word_dict, feature_dict, state_dict=None):\n        # Book-keeping.\n        self.opt = opt\n        self.word_dict = word_dict\n        self.feature_dict = feature_dict\n        self.updates = 0\n        self.train_loss = AverageMeter()\n\n        # Building network.\n        self.network = RnnDocReader(opt)\n        if state_dict:\n            new_state = set(self.network.state_dict().keys())\n            for k in list(state_dict['network'].keys()):\n                if k not in new_state:\n                    del state_dict['network'][k]\n            self.network.load_state_dict(state_dict['network'])\n\n        # Building optimizer.\n        parameters = [p for p in self.network.parameters() if p.requires_grad]\n        if opt['optimizer'] == 'sgd':\n            self.optimizer = optim.SGD(parameters, opt['learning_rate'],\n                                       momentum=opt['momentum'],\n                                       weight_decay=opt['weight_decay'])\n        elif opt['optimizer'] == 'adamax':\n            self.optimizer = optim.Adamax(parameters,\n                                          weight_decay=opt['weight_decay'])\n        else:\n            raise RuntimeError('Unsupported optimizer: %s' % opt['optimizer'])\n\n    def set_embeddings(self):\n        # Read word embeddings.\n        if not self.opt.get('embedding_file'):\n            logger.warning('[ WARNING: No embeddings provided. '\n                           'Keeping random initialization. ]')\n            return\n        logger.info('[ Loading pre-trained embeddings ]')\n        embeddings = load_embeddings(self.opt, self.word_dict)\n        logger.info('[ Num embeddings = %d ]' % embeddings.size(0))\n\n        # Sanity check dimensions\n        new_size = embeddings.size()\n        old_size = self.network.embedding.weight.size()\n        if new_size[1] != old_size[1]:\n            raise RuntimeError('Embedding dimensions do not match.')\n        if new_size[0] != old_size[0]:\n            logger.warning(\n                '[ WARNING: Number of embeddings changed (%d->%d) ]' %\n                (old_size[0], new_size[0])\n            )\n\n        # Swap weights\n        self.network.embedding.weight.data = embeddings\n\n        # If partially tuning the embeddings, keep the old values\n        if self.opt['tune_partial'] > 0:\n            if self.opt['tune_partial'] + 2 < embeddings.size(0):\n                fixed_embedding = embeddings[self.opt['tune_partial'] + 2:]\n                self.network.fixed_embedding = fixed_embedding\n\n    def update(self, ex):\n        # Train mode\n        self.network.train()\n\n        # Transfer to GPU\n        if self.opt['cuda']:\n            inputs = [Variable(e.cuda(non_blocking=True)) for e in ex[:5]]\n            target_s = Variable(ex[5].cuda(non_blocking=True))\n            target_e = Variable(ex[6].cuda(non_blocking=True))\n        else:\n            inputs = [Variable(e) for e in ex[:5]]\n            target_s = Variable(ex[5])\n            target_e = Variable(ex[6])\n\n        # Run forward\n        score_s, score_e = self.network(*inputs)\n\n        # Compute loss and accuracies\n        loss = F.nll_loss(score_s, target_s) + F.nll_loss(score_e, target_e)\n        self.train_loss.update(loss.data.item(), ex[0].size(0))\n\n        # Clear gradients and run backward\n        self.optimizer.zero_grad()\n        loss.backward()\n\n        # Clip gradients\n        torch.nn.utils.clip_grad_norm(self.network.parameters(),\n                                      self.opt['grad_clipping'])\n\n        # Update parameters\n        self.optimizer.step()\n        self.updates += 1\n\n        # Reset any partially fixed parameters (e.g. rare words)\n        self.reset_parameters()\n\n    def predict(self, ex):\n        # Eval mode\n        self.network.eval()\n\n        # Transfer to GPU\n        if self.opt['cuda']:\n            inputs = [Variable(e.cuda(non_blocking=True), volatile=True)\n                      for e in ex[:5]]\n        else:\n            inputs = [Variable(e, volatile=True) for e in ex[:5]]\n\n        # Run forward\n        score_s, score_e = self.network(*inputs)\n\n        # Transfer to CPU/normal tensors for numpy ops\n        score_s = score_s.data.cpu()\n        score_e = score_e.data.cpu()\n\n        # Get argmax text spans\n        text = ex[-2]\n        spans = ex[-1]\n        predictions = []\n        pred_scores = []\n        max_len = self.opt['max_len'] or score_s.size(1)\n        for i in range(score_s.size(0)):\n            scores = torch.ger(score_s[i], score_e[i])\n            scores.triu_().tril_(max_len - 1)\n            scores = scores.numpy()\n            s_idx, e_idx = np.unravel_index(np.argmax(scores), scores.shape)\n            s_offset, e_offset = spans[i][s_idx][0], spans[i][e_idx][1]\n            predictions.append(text[i][s_offset:e_offset])\n            pred_scores.append(np.max(scores))\n\n        return predictions, pred_scores\n\n    def reset_parameters(self):\n        # Reset fixed embeddings to original value\n        if self.opt['tune_partial'] > 0:\n            offset = self.opt['tune_partial'] + 2\n            if offset < self.network.embedding.weight.data.size(0):\n                self.network.embedding.weight.data[offset:] \\\n                    = self.network.fixed_embedding\n\n    def save(self, filename):\n        params = {\n            'state_dict': {\n                'network': self.network.state_dict(),\n            },\n            'feature_dict': self.feature_dict,\n            'config': self.opt,\n        }\n        try:\n            torch.save(params, filename)\n        except BaseException:\n            logger.warn('[ WARN: Saving failed... continuing anyway. ]')\n\n    def cuda(self):\n        self.network.cuda()\n", "path": "parlai/agents/drqa/model.py"}]}