Repository: mindsdb/lightwood

Issue:
Datasource does not process text properly
* Python version: 3.8.5
* Operating system: Ubuntu [20.04]
* Lightwood version: 0.60.0

Text no longer encodes properly; the issue arises in the creation of the DataSource. It seems like there is some information not passed along correctly to the distilbert encoder that isn't a problem for numeric/categorical. An easy dataset to check this out with is the wine_reviews dataset in the private benchmarks. 

Additionally - this was fine in 0.57.0

![Screenshot from 2021-02-15 15-05-27](https://user-images.githubusercontent.com/34254572/107989047-5d41ab00-6f9f-11eb-9127-075ad8e0be54.png)

![Screenshot from 2021-02-15 15-16-16](https://user-images.githubusercontent.com/34254572/107989850-1eacf000-6fa1-11eb-899f-0d1cde5641a0.png)







Discussion:

Resolving patch:
diff --git a/lightwood/__about__.py b/lightwood/__about__.py
--- a/lightwood/__about__.py
+++ b/lightwood/__about__.py
@@ -1,6 +1,6 @@
 __title__ = 'lightwood'
 __package_name__ = 'mindsdb'
-__version__ = '0.60.0'
+__version__ = '0.60.1'
 __description__ = "Lightwood's goal is to make it very simple for developers to use the power of artificial neural networks in their projects."
 __email__ = "jorge@mindsdb.com"
 __author__ = 'MindsDB Inc'
diff --git a/lightwood/api/data_source.py b/lightwood/api/data_source.py
--- a/lightwood/api/data_source.py
+++ b/lightwood/api/data_source.py
@@ -368,6 +368,7 @@ def _prepare_encoders(self):
         encoders = {}
         input_encoder_training_data = {'targets': [], 'previous': []}
 
+        # handle time series previous target columns
         previous_cols = []
         for config in self.config['input_features']:
             column_name = config['name']
@@ -386,16 +387,31 @@ def _prepare_encoders(self):
                 config['additional_info']['normalizers'] = col_info['normalizers']
                 config['additional_info']['group_combinations'] = col_info['group_combinations']
 
+        # train output encoders (except for time-series related)
+        for config in self.config['output_features']:
+            if config['type'] not in ColumnDataTypes.TIME_SERIES:
+                column_name = config['name']
+                column_data = self.get_column_original_data(column_name)
+                encoder_instance = self._prepare_column_encoder(config, is_target=True)
+
+                input_encoder_training_data['targets'].append({
+                    'encoded_output': encoder_instance.encode(column_data),
+                    'unencoded_output': column_data,
+                    'output_encoder': encoder_instance,
+                    'output_type': config['type']
+                })
+
+                encoders[column_name] = encoder_instance
+
+        # train input encoders
         for config in self.config['input_features']:
             column_name = config['name']
             encoder_instance = self._prepare_column_encoder(config,
                                                             is_target=False,
                                                             training_data=input_encoder_training_data)
-
             encoders[column_name] = encoder_instance
 
             if column_name not in previous_cols:
-                # add dependency on '__mdb_ts_previous_' column (for now singular, plural later on)
                 if config['type'] == ColumnDataTypes.TIME_SERIES and len(input_encoder_training_data['previous']) > 0:
                     for d in input_encoder_training_data['previous']:
                         try:
@@ -404,36 +420,20 @@ def _prepare_encoders(self):
                         except KeyError:
                             config['depends_on_column'] = [d['name']]
 
+        # train time series output encoder
         for config in self.config['output_features']:
             column_name = config['name']
-            column_data = self.get_column_original_data(column_name)
 
-            prev_col = [c for c in self.config['input_features'] if c['name'] == f'__mdb_ts_previous_{column_name}']
+            prev_col = [c for c in self.config['input_features'] if
+                        c['name'] == f'__mdb_ts_previous_{column_name}']
             if prev_col:
                 # 0-indexed as we know it can only be one
                 config['depends_on_column'] = [prev_col[0]['name']]
                 config['encoder_attrs']['normalizers'] = prev_col[0]['additional_info']['normalizers']
-                config['encoder_attrs']['group_combinations'] = prev_col[0]['additional_info']['group_combinations']
-                group_info = config['group_info']
-            else:
-                group_info = None
+                config['encoder_attrs']['group_combinations'] = prev_col[0]['additional_info'][
+                    'group_combinations']
 
             encoder_instance = self._prepare_column_encoder(config, is_target=True)
-
-            if 'extra_data' not in inspect.signature(encoder_instance.encode).parameters:
-                encoded_output = encoder_instance.encode(column_data)
-            else:
-                # wrap group_info in a list of dicts to conform to get_encoded_column_data call convention
-                extra_data = [{'group_info': group_info}]
-                encoded_output = encoder_instance.encode(column_data, extra_data=extra_data)
-
-            input_encoder_training_data['targets'].append({
-                'encoded_output': encoded_output,
-                'unencoded_output': column_data,
-                'output_encoder': encoder_instance,
-                'output_type': config['type']
-            })
-
             encoders[column_name] = encoder_instance
 
         return encoders


Test patch: