We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
What is "'Chainer' object has no attribute 'infer'
2018-03-04 14:09:23,638 (util.py:64 WorkerThread2) ERROR - TeleBot: "AttributeError occurred, args=("'Chainer' object has no attribute 'infer'",)
Traceback (most recent call last):
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py", line 58, in run
    task(*args, **kwargs)
  File "/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py", line 48, in handle_inference
    pred = model.infer(context)
AttributeError: 'Chainer' object has no attribute 'infer'
"
2018-03-04 14:09:23.638 ERROR in 'TeleBot'['util'] at line 64: AttributeError occurred, args=("'Chainer' object has no attribute 'infer'",)
Traceback (most recent call last):
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py", line 58, in run
    task(*args, **kwargs)
  File "/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py", line 48, in handle_inference
    pred = model.infer(context)
AttributeError: 'Chainer' object has no attribute 'infer'

Traceback (most recent call last):
  File "deep.py", line 60, in <module>
    main()
  File "deep.py", line 56, in main
    interact_model_by_telegram(pipeline_config_path, token)
  File "/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py", line 58, in interact_model_by_telegram
    init_bot_for_model(token, model)
  File "/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py", line 52, in init_bot_for_model
    bot.polling()
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/__init__.py", line 264, in polling
    self.__threaded_polling(none_stop, interval, timeout)
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/__init__.py", line 288, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py", line 107, in raise_exceptions
    six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py", line 58, in run
    task(*args, **kwargs)
  File "/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py", line 48, in handle_inference
    pred = model.infer(context)
AttributeError: 'Chainer' object has no attribute 'infer'

Telegram interface bug
Alexander Seliverstov, [04.03.18 15:20]
/start

jhfirufoiug_bot, [04.03.18 15:20]
Welcome to DeepPavlov inference bot!

Alexander Seliverstov, [04.03.18 15:20]
Hi

jhfirufoiug_bot, [04.03.18 15:20]
['Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?']

Alexander Seliverstov, [04.03.18 15:20]
I want cheap russian food

jhfirufoiug_bot, [04.03.18 15:20]
['Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?']

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `telegram_utils/telegram_ui.py`
Content:
```
1 """
2 Copyright 2017 Neural Networks and Deep Learning lab, MIPT
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8     http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 """
16 import telebot
17 
18 from deeppavlov.core.common.file import read_json
19 from deeppavlov.core.commands.infer import build_model_from_config
20 
21 
22 def init_bot_for_model(token, model):
23     bot = telebot.TeleBot(token)
24 
25     model_name = type(model).__name__
26     models_info = read_json('../telegram_utils/models_info.json')
27     model_info = models_info[model_name] if model_name in models_info else models_info['@default']
28 
29     @bot.message_handler(commands=['start'])
30     def send_start_message(message):
31         chat_id = message.chat.id
32         out_message = model_info['start_message']
33         if hasattr(model, 'reset'):
34             model.reset()
35         bot.send_message(chat_id, out_message)
36 
37     @bot.message_handler(commands=['help'])
38     def send_help_message(message):
39         chat_id = message.chat.id
40         out_message = model_info['help_message']
41         bot.send_message(chat_id, out_message)
42 
43     @bot.message_handler()
44     def handle_inference(message):
45         chat_id = message.chat.id
46         context = message.text
47 
48         pred = model.infer(context)
49         reply_message = str(pred)
50         bot.send_message(chat_id, reply_message)
51 
52     bot.polling()
53 
54 
55 def interact_model_by_telegram(config_path, token):
56     config = read_json(config_path)
57     model = build_model_from_config(config)
58     init_bot_for_model(token, model)
59
```
--- 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/telegram_utils/telegram_ui.py b/telegram_utils/telegram_ui.py
--- a/telegram_utils/telegram_ui.py
+++ b/telegram_utils/telegram_ui.py
@@ -45,8 +45,8 @@
         chat_id = message.chat.id
         context = message.text
 
-        pred = model.infer(context)
-        reply_message = str(pred)
+        pred = model([context])
+        reply_message = str(pred[0])
         bot.send_message(chat_id, reply_message)
 
     bot.polling()

{"golden_diff": "diff --git a/telegram_utils/telegram_ui.py b/telegram_utils/telegram_ui.py\n--- a/telegram_utils/telegram_ui.py\n+++ b/telegram_utils/telegram_ui.py\n@@ -45,8 +45,8 @@\n         chat_id = message.chat.id\n         context = message.text\n \n-        pred = model.infer(context)\n-        reply_message = str(pred)\n+        pred = model([context])\n+        reply_message = str(pred[0])\n         bot.send_message(chat_id, reply_message)\n \n     bot.polling()\n", "issue": "What is \"'Chainer' object has no attribute 'infer'\n2018-03-04 14:09:23,638 (util.py:64 WorkerThread2) ERROR - TeleBot: \"AttributeError occurred, args=(\"'Chainer' object has no attribute 'infer'\",)\r\nTraceback (most recent call last):\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py\", line 58, in run\r\n    task(*args, **kwargs)\r\n  File \"/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py\", line 48, in handle_inference\r\n    pred = model.infer(context)\r\nAttributeError: 'Chainer' object has no attribute 'infer'\r\n\"\r\n2018-03-04 14:09:23.638 ERROR in 'TeleBot'['util'] at line 64: AttributeError occurred, args=(\"'Chainer' object has no attribute 'infer'\",)\r\nTraceback (most recent call last):\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py\", line 58, in run\r\n    task(*args, **kwargs)\r\n  File \"/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py\", line 48, in handle_inference\r\n    pred = model.infer(context)\r\nAttributeError: 'Chainer' object has no attribute 'infer'\r\n\r\nTraceback (most recent call last):\r\n  File \"deep.py\", line 60, in <module>\r\n    main()\r\n  File \"deep.py\", line 56, in main\r\n    interact_model_by_telegram(pipeline_config_path, token)\r\n  File \"/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py\", line 58, in interact_model_by_telegram\r\n    init_bot_for_model(token, model)\r\n  File \"/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py\", line 52, in init_bot_for_model\r\n    bot.polling()\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/__init__.py\", line 264, in polling\r\n    self.__threaded_polling(none_stop, interval, timeout)\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/__init__.py\", line 288, in __threaded_polling\r\n    self.worker_pool.raise_exceptions()\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py\", line 107, in raise_exceptions\r\n    six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/six.py\", line 693, in reraise\r\n    raise value\r\n  File \"/Users/developer/DeepPavlov/lib/python3.6/site-packages/telebot/util.py\", line 58, in run\r\n    task(*args, **kwargs)\r\n  File \"/Users/developer/Project/DeepPavlov/telegram_utils/telegram_ui.py\", line 48, in handle_inference\r\n    pred = model.infer(context)\r\nAttributeError: 'Chainer' object has no attribute 'infer'\r\n\nTelegram interface bug\nAlexander Seliverstov, [04.03.18 15:20]\r\n/start\r\n\r\njhfirufoiug_bot, [04.03.18 15:20]\r\nWelcome to DeepPavlov inference bot!\r\n\r\nAlexander Seliverstov, [04.03.18 15:20]\r\nHi\r\n\r\njhfirufoiug_bot, [04.03.18 15:20]\r\n['Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?']\r\n\r\nAlexander Seliverstov, [04.03.18 15:20]\r\nI want cheap russian food\r\n\r\njhfirufoiug_bot, [04.03.18 15:20]\r\n['Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?', 'Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?']\n", "before_files": [{"content": "\"\"\"\nCopyright 2017 Neural Networks and Deep Learning lab, MIPT\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\"\"\"\nimport telebot\n\nfrom deeppavlov.core.common.file import read_json\nfrom deeppavlov.core.commands.infer import build_model_from_config\n\n\ndef init_bot_for_model(token, model):\n    bot = telebot.TeleBot(token)\n\n    model_name = type(model).__name__\n    models_info = read_json('../telegram_utils/models_info.json')\n    model_info = models_info[model_name] if model_name in models_info else models_info['@default']\n\n    @bot.message_handler(commands=['start'])\n    def send_start_message(message):\n        chat_id = message.chat.id\n        out_message = model_info['start_message']\n        if hasattr(model, 'reset'):\n            model.reset()\n        bot.send_message(chat_id, out_message)\n\n    @bot.message_handler(commands=['help'])\n    def send_help_message(message):\n        chat_id = message.chat.id\n        out_message = model_info['help_message']\n        bot.send_message(chat_id, out_message)\n\n    @bot.message_handler()\n    def handle_inference(message):\n        chat_id = message.chat.id\n        context = message.text\n\n        pred = model.infer(context)\n        reply_message = str(pred)\n        bot.send_message(chat_id, reply_message)\n\n    bot.polling()\n\n\ndef interact_model_by_telegram(config_path, token):\n    config = read_json(config_path)\n    model = build_model_from_config(config)\n    init_bot_for_model(token, model)\n", "path": "telegram_utils/telegram_ui.py"}], "after_files": [{"content": "\"\"\"\nCopyright 2017 Neural Networks and Deep Learning lab, MIPT\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\"\"\"\nimport telebot\n\nfrom deeppavlov.core.common.file import read_json\nfrom deeppavlov.core.commands.infer import build_model_from_config\n\n\ndef init_bot_for_model(token, model):\n    bot = telebot.TeleBot(token)\n\n    model_name = type(model).__name__\n    models_info = read_json('../telegram_utils/models_info.json')\n    model_info = models_info[model_name] if model_name in models_info else models_info['@default']\n\n    @bot.message_handler(commands=['start'])\n    def send_start_message(message):\n        chat_id = message.chat.id\n        out_message = model_info['start_message']\n        if hasattr(model, 'reset'):\n            model.reset()\n        bot.send_message(chat_id, out_message)\n\n    @bot.message_handler(commands=['help'])\n    def send_help_message(message):\n        chat_id = message.chat.id\n        out_message = model_info['help_message']\n        bot.send_message(chat_id, out_message)\n\n    @bot.message_handler()\n    def handle_inference(message):\n        chat_id = message.chat.id\n        context = message.text\n\n        pred = model([context])\n        reply_message = str(pred[0])\n        bot.send_message(chat_id, reply_message)\n\n    bot.polling()\n\n\ndef interact_model_by_telegram(config_path, token):\n    config = read_json(config_path)\n    model = build_model_from_config(config)\n    init_bot_for_model(token, model)\n", "path": "telegram_utils/telegram_ui.py"}]}