Repository: awslabs/gluonts

Issue:
"info" field is broken
Seems to have been introduced in cfe27298deb (worked fine before that)

## To Reproduce

```python
import numpy as np

from gluonts.model.simple_feedforward import SimpleFeedForwardEstimator
from gluonts.dataset.common import ListDataset
from gluonts.trainer import Trainer

dataset = ListDataset(
    data_iter=[{
        "target": np.random.normal(loc=100, scale=10, size=(10000)),
        "start": "2020-01-01 00:00:00",
        "info": {"some_key": [1, 2, 3]},
    }],
    freq="5min",
)

estimator = SimpleFeedForwardEstimator(
    freq="5min",
    prediction_length=4,
    context_length=100,
    trainer=Trainer(
        epochs=2, num_batches_per_epoch=3, batch_size=16, hybridize=False
    ),
)

predictor = estimator.train(dataset)
```

## Error message or code output

```
Traceback (most recent call last):
  File "/Users/stellalo/gluon-ts/issues/issue_info.py", line 25, in <module>
    predictor = estimator.train(dataset)
  File "/Users/stellalo/gluon-ts/src/gluonts/model/estimator.py", line 240, in train
    training_data, validation_data, num_workers, num_prefetch, **kwargs
  File "/Users/stellalo/gluon-ts/src/gluonts/model/estimator.py", line 219, in train_model
    validation_iter=validation_data_loader,
  File "/Users/stellalo/gluon-ts/src/gluonts/trainer/_base.py", line 303, in __call__
    epoch_loss = loop(epoch_no, train_iter)
  File "/Users/stellalo/gluon-ts/src/gluonts/trainer/_base.py", line 231, in loop
    for batch_no, data_entry in enumerate(it, start=1):
  File "/Users/stellalo/.virtualenvs/gluonts/lib/python3.7/site-packages/tqdm/std.py", line 1127, in __iter__
    for obj in iterable:
  File "/Users/stellalo/gluon-ts/src/gluonts/dataset/parallelized_loader.py", line 570, in same_process_iter
    single_process_ctx=self.ctx,
  File "/Users/stellalo/gluon-ts/src/gluonts/dataset/parallelized_loader.py", line 152, in default_batchify_fn
    for key in data[0].keys()
  File "/Users/stellalo/gluon-ts/src/gluonts/dataset/parallelized_loader.py", line 152, in <dictcomp>
    for key in data[0].keys()
  File "/Users/stellalo/gluon-ts/src/gluonts/dataset/parallelized_loader.py", line 133, in stack
    f"Invalid type of data: {type(data[0])} for argument loss_function."
TypeError: Invalid type of data: <class 'dict'> for argument loss_function.
```

## Environment
- Operating system:
- Python version:
- GluonTS version:

(Add as much information about your environment as possible, e.g. dependencies versions.)



Discussion:

Resolving patch:
diff --git a/src/gluonts/dataset/parallelized_loader.py b/src/gluonts/dataset/parallelized_loader.py
--- a/src/gluonts/dataset/parallelized_loader.py
+++ b/src/gluonts/dataset/parallelized_loader.py
@@ -126,12 +126,8 @@ def stack(
             stack(t, multi_processing, dtype, single_process_ctx)
             for t in zip(*data)
         )
-    elif isinstance(data[0], (pd.Timestamp, str, int, pathlib.PosixPath)):
-        return data
-    else:
-        raise TypeError(
-            f"Invalid type of data: {type(data[0])} for argument loss_function."
-        )
+
+    return data
 
 
 def default_batchify_fn(


Test patch:
diff --git a/test/model/test_item_id_info.py b/test/model/test_item_id_info.py
new file mode 100644
--- /dev/null
+++ b/test/model/test_item_id_info.py
@@ -0,0 +1,67 @@
+import pytest
+
+import numpy as np
+
+from gluonts.model.estimator import Estimator
+from gluonts.model.simple_feedforward import SimpleFeedForwardEstimator
+from gluonts.dataset.common import Dataset, ListDataset
+from gluonts.trainer import Trainer
+
+
+@pytest.mark.parametrize(
+    "dataset, estimator",
+    [
+        (
+            ListDataset(
+                data_iter=[
+                    {
+                        "item_id": "3",
+                        "target": np.random.normal(
+                            loc=100, scale=10, size=(100)
+                        ),
+                        "start": "2020-01-01 00:00:00",
+                        "info": {"some_key": [1, 2, 3]},
+                    },
+                    {
+                        "item_id": "2",
+                        "target": np.random.normal(
+                            loc=100, scale=10, size=(100)
+                        ),
+                        "start": "2020-01-01 00:00:00",
+                        "info": {"some_key": [2, 3, 4]},
+                    },
+                    {
+                        "item_id": "1",
+                        "target": np.random.normal(
+                            loc=100, scale=10, size=(100)
+                        ),
+                        "start": "2020-01-01 00:00:00",
+                        "info": {"some_key": [4, 5, 6]},
+                    },
+                ],
+                freq="5min",
+            ),
+            SimpleFeedForwardEstimator(
+                freq="5min",
+                prediction_length=4,
+                context_length=20,
+                trainer=Trainer(
+                    epochs=2,
+                    num_batches_per_epoch=2,
+                    batch_size=16,
+                    hybridize=False,
+                ),
+            ),
+        ),
+    ],
+)
+def test_item_id_info(dataset: Dataset, estimator: Estimator):
+    predictor = estimator.train(dataset)
+    forecasts = predictor.predict(dataset)
+    for data_entry, forecast in zip(dataset, forecasts):
+        assert (not "item_id" in data_entry) or data_entry[
+            "item_id"
+        ] == forecast.item_id
+        assert (not "info" in data_entry) or data_entry[
+            "info"
+        ] == forecast.info