We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
emotion_detection/utils.py代码错误
utils.py第62行：seq_len = max_seq_len  是缩进错误吧？应该包括在else内，否则seq_len不能表示sequence的真实长度

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `PaddleNLP/emotion_detection/utils.py`
Content:
```
1 #   Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """
15 EmoTect utilities.
16 """
17 from __future__ import absolute_import
18 from __future__ import division
19 from __future__ import print_function
20 
21 import io
22 import os
23 import sys
24 import six
25 import random
26 
27 import paddle
28 import paddle.fluid as fluid
29 import numpy as np
30 
31 
32 def init_checkpoint(exe, init_checkpoint_path, main_program):
33     """
34     Init CheckPoint
35     """
36 
37     fluid.load(main_program, init_checkpoint_path, exe)
38 
39 
40 def word2id(word_dict, query):
41     """
42     Convert word sequence into id list
43     """
44     unk_id = len(word_dict)
45     wids = [
46         word_dict[w] if w in word_dict else unk_id
47         for w in query.strip().split(" ")
48     ]
49     return wids
50 
51 
52 def pad_wid(wids, max_seq_len=128, pad_id=0):
53     """
54     Padding data to max_seq_len
55     """
56     seq_len = len(wids)
57     if seq_len < max_seq_len:
58         for i in range(max_seq_len - seq_len):
59             wids.append(pad_id)
60     else:
61         wids = wids[:max_seq_len]
62     seq_len = max_seq_len
63     return wids, seq_len
64 
65 
66 def data_reader(file_path, word_dict, num_examples, phrase, epoch, max_seq_len):
67     """
68     Data reader, which convert word sequence into id list
69     """
70     all_data = []
71     with io.open(file_path, "r", encoding='utf8') as fin:
72         for line in fin:
73             if line.startswith("label"):
74                 continue
75             if phrase == "infer":
76                 cols = line.strip().split("\t")
77                 query = cols[-1] if len(cols) != -1 else cols[0]
78                 wids = word2id(word_dict, query)
79                 wids, seq_len = pad_wid(wids, max_seq_len)
80                 all_data.append((wids, seq_len))
81             else:
82                 cols = line.strip().split("\t")
83                 if len(cols) != 2:
84                     sys.stderr.write("[NOTICE] Error Format Line!")
85                     continue
86                 label = int(cols[0])
87                 query = cols[1].strip()
88                 wids = word2id(word_dict, query)
89                 wids, seq_len = pad_wid(wids, max_seq_len)
90                 all_data.append((wids, label, seq_len))
91     num_examples[phrase] = len(all_data)
92 
93     if phrase == "infer":
94 
95         def reader():
96             """
97             Infer reader function
98             """
99             for wids, seq_len in all_data:
100                 yield wids, seq_len
101 
102         return reader
103 
104     def reader():
105         """
106         Reader function
107         """
108         for idx in range(epoch):
109             if phrase == "train" and 'ce_mode' not in os.environ:
110                 random.shuffle(all_data)
111             for wids, label, seq_len in all_data:
112                 yield wids, label, seq_len
113 
114     return reader
115 
116 
117 def load_vocab(file_path):
118     """
119     load the given vocabulary
120     """
121     vocab = {}
122     with io.open(file_path, 'r', encoding='utf8') as fin:
123         wid = 0
124         for line in fin:
125             if line.strip() not in vocab:
126                 vocab[line.strip()] = wid
127                 wid += 1
128     vocab["<unk>"] = len(vocab)
129     return vocab
130 
131 
132 def print_arguments(args):
133     """
134     print arguments
135     """
136     print('-----------  Configuration Arguments -----------')
137     for arg, value in sorted(six.iteritems(vars(args))):
138         print('%s: %s' % (arg, value))
139     print('------------------------------------------------')
140 
141 
142 def query2ids(vocab_path, query):
143     """
144     Convert query to id list according to the given vocab
145     """
146     vocab = load_vocab(vocab_path)
147     wids = word2id(vocab, query)
148     return wids
149
```
--- 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/PaddleNLP/emotion_detection/utils.py b/PaddleNLP/emotion_detection/utils.py
--- a/PaddleNLP/emotion_detection/utils.py
+++ b/PaddleNLP/emotion_detection/utils.py
@@ -59,7 +59,7 @@
             wids.append(pad_id)
     else:
         wids = wids[:max_seq_len]
-    seq_len = max_seq_len
+        seq_len = max_seq_len
     return wids, seq_len

{"golden_diff": "diff --git a/PaddleNLP/emotion_detection/utils.py b/PaddleNLP/emotion_detection/utils.py\n--- a/PaddleNLP/emotion_detection/utils.py\n+++ b/PaddleNLP/emotion_detection/utils.py\n@@ -59,7 +59,7 @@\n             wids.append(pad_id)\n     else:\n         wids = wids[:max_seq_len]\n-    seq_len = max_seq_len\n+        seq_len = max_seq_len\n     return wids, seq_len\n", "issue": "emotion_detection/utils.py\u4ee3\u7801\u9519\u8bef\nutils.py\u7b2c62\u884c\uff1aseq_len = max_seq_len  \u662f\u7f29\u8fdb\u9519\u8bef\u5427\uff1f\u5e94\u8be5\u5305\u62ec\u5728else\u5185\uff0c\u5426\u5219seq_len\u4e0d\u80fd\u8868\u793asequence\u7684\u771f\u5b9e\u957f\u5ea6\n", "before_files": [{"content": "#   Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nEmoTect utilities.\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport io\nimport os\nimport sys\nimport six\nimport random\n\nimport paddle\nimport paddle.fluid as fluid\nimport numpy as np\n\n\ndef init_checkpoint(exe, init_checkpoint_path, main_program):\n    \"\"\"\n    Init CheckPoint\n    \"\"\"\n\n    fluid.load(main_program, init_checkpoint_path, exe)\n\n\ndef word2id(word_dict, query):\n    \"\"\"\n    Convert word sequence into id list\n    \"\"\"\n    unk_id = len(word_dict)\n    wids = [\n        word_dict[w] if w in word_dict else unk_id\n        for w in query.strip().split(\" \")\n    ]\n    return wids\n\n\ndef pad_wid(wids, max_seq_len=128, pad_id=0):\n    \"\"\"\n    Padding data to max_seq_len\n    \"\"\"\n    seq_len = len(wids)\n    if seq_len < max_seq_len:\n        for i in range(max_seq_len - seq_len):\n            wids.append(pad_id)\n    else:\n        wids = wids[:max_seq_len]\n    seq_len = max_seq_len\n    return wids, seq_len\n\n\ndef data_reader(file_path, word_dict, num_examples, phrase, epoch, max_seq_len):\n    \"\"\"\n    Data reader, which convert word sequence into id list\n    \"\"\"\n    all_data = []\n    with io.open(file_path, \"r\", encoding='utf8') as fin:\n        for line in fin:\n            if line.startswith(\"label\"):\n                continue\n            if phrase == \"infer\":\n                cols = line.strip().split(\"\\t\")\n                query = cols[-1] if len(cols) != -1 else cols[0]\n                wids = word2id(word_dict, query)\n                wids, seq_len = pad_wid(wids, max_seq_len)\n                all_data.append((wids, seq_len))\n            else:\n                cols = line.strip().split(\"\\t\")\n                if len(cols) != 2:\n                    sys.stderr.write(\"[NOTICE] Error Format Line!\")\n                    continue\n                label = int(cols[0])\n                query = cols[1].strip()\n                wids = word2id(word_dict, query)\n                wids, seq_len = pad_wid(wids, max_seq_len)\n                all_data.append((wids, label, seq_len))\n    num_examples[phrase] = len(all_data)\n\n    if phrase == \"infer\":\n\n        def reader():\n            \"\"\"\n            Infer reader function\n            \"\"\"\n            for wids, seq_len in all_data:\n                yield wids, seq_len\n\n        return reader\n\n    def reader():\n        \"\"\"\n        Reader function\n        \"\"\"\n        for idx in range(epoch):\n            if phrase == \"train\" and 'ce_mode' not in os.environ:\n                random.shuffle(all_data)\n            for wids, label, seq_len in all_data:\n                yield wids, label, seq_len\n\n    return reader\n\n\ndef load_vocab(file_path):\n    \"\"\"\n    load the given vocabulary\n    \"\"\"\n    vocab = {}\n    with io.open(file_path, 'r', encoding='utf8') as fin:\n        wid = 0\n        for line in fin:\n            if line.strip() not in vocab:\n                vocab[line.strip()] = wid\n                wid += 1\n    vocab[\"<unk>\"] = len(vocab)\n    return vocab\n\n\ndef print_arguments(args):\n    \"\"\"\n    print arguments\n    \"\"\"\n    print('-----------  Configuration Arguments -----------')\n    for arg, value in sorted(six.iteritems(vars(args))):\n        print('%s: %s' % (arg, value))\n    print('------------------------------------------------')\n\n\ndef query2ids(vocab_path, query):\n    \"\"\"\n    Convert query to id list according to the given vocab\n    \"\"\"\n    vocab = load_vocab(vocab_path)\n    wids = word2id(vocab, query)\n    return wids\n", "path": "PaddleNLP/emotion_detection/utils.py"}], "after_files": [{"content": "#   Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nEmoTect utilities.\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport io\nimport os\nimport sys\nimport six\nimport random\n\nimport paddle\nimport paddle.fluid as fluid\nimport numpy as np\n\n\ndef init_checkpoint(exe, init_checkpoint_path, main_program):\n    \"\"\"\n    Init CheckPoint\n    \"\"\"\n\n    fluid.load(main_program, init_checkpoint_path, exe)\n\n\ndef word2id(word_dict, query):\n    \"\"\"\n    Convert word sequence into id list\n    \"\"\"\n    unk_id = len(word_dict)\n    wids = [\n        word_dict[w] if w in word_dict else unk_id\n        for w in query.strip().split(\" \")\n    ]\n    return wids\n\n\ndef pad_wid(wids, max_seq_len=128, pad_id=0):\n    \"\"\"\n    Padding data to max_seq_len\n    \"\"\"\n    seq_len = len(wids)\n    if seq_len < max_seq_len:\n        for i in range(max_seq_len - seq_len):\n            wids.append(pad_id)\n    else:\n        wids = wids[:max_seq_len]\n        seq_len = max_seq_len\n    return wids, seq_len\n\n\ndef data_reader(file_path, word_dict, num_examples, phrase, epoch, max_seq_len):\n    \"\"\"\n    Data reader, which convert word sequence into id list\n    \"\"\"\n    all_data = []\n    with io.open(file_path, \"r\", encoding='utf8') as fin:\n        for line in fin:\n            if line.startswith(\"label\"):\n                continue\n            if phrase == \"infer\":\n                cols = line.strip().split(\"\\t\")\n                query = cols[-1] if len(cols) != -1 else cols[0]\n                wids = word2id(word_dict, query)\n                wids, seq_len = pad_wid(wids, max_seq_len)\n                all_data.append((wids, seq_len))\n            else:\n                cols = line.strip().split(\"\\t\")\n                if len(cols) != 2:\n                    sys.stderr.write(\"[NOTICE] Error Format Line!\")\n                    continue\n                label = int(cols[0])\n                query = cols[1].strip()\n                wids = word2id(word_dict, query)\n                wids, seq_len = pad_wid(wids, max_seq_len)\n                all_data.append((wids, label, seq_len))\n    num_examples[phrase] = len(all_data)\n\n    if phrase == \"infer\":\n\n        def reader():\n            \"\"\"\n            Infer reader function\n            \"\"\"\n            for wids, seq_len in all_data:\n                yield wids, seq_len\n\n        return reader\n\n    def reader():\n        \"\"\"\n        Reader function\n        \"\"\"\n        for idx in range(epoch):\n            if phrase == \"train\" and 'ce_mode' not in os.environ:\n                random.shuffle(all_data)\n            for wids, label, seq_len in all_data:\n                yield wids, label, seq_len\n\n    return reader\n\n\ndef load_vocab(file_path):\n    \"\"\"\n    load the given vocabulary\n    \"\"\"\n    vocab = {}\n    with io.open(file_path, 'r', encoding='utf8') as fin:\n        wid = 0\n        for line in fin:\n            if line.strip() not in vocab:\n                vocab[line.strip()] = wid\n                wid += 1\n    vocab[\"<unk>\"] = len(vocab)\n    return vocab\n\n\ndef print_arguments(args):\n    \"\"\"\n    print arguments\n    \"\"\"\n    print('-----------  Configuration Arguments -----------')\n    for arg, value in sorted(six.iteritems(vars(args))):\n        print('%s: %s' % (arg, value))\n    print('------------------------------------------------')\n\n\ndef query2ids(vocab_path, query):\n    \"\"\"\n    Convert query to id list according to the given vocab\n    \"\"\"\n    vocab = load_vocab(vocab_path)\n    wids = word2id(vocab, query)\n    return wids\n", "path": "PaddleNLP/emotion_detection/utils.py"}]}