我正在使用 Glunts 来实现深度状态估计器。我想从它内置的 mxnet 框架转换为 ONNX 框架。为此,我试图将我的 Representable Block Predictor 对象转换为符号块预测器,以便可以导出模型。我目前正在尝试将我的训练 ListDataset 传递给符号块预测器。
- 我目前正在像这样构建我的 ListDataset:
indices = pd.date_range(start = "2018-12-31", end = "2021-11-30",freq='M')
for time_series in target:
train_time_series_dicts.append([{"item_id": item_id,"target": train_target,"start":start_train,"feat_static_cat": [ts_volume]})
test_time_series_dicts.append({"item_id": item_id,"target": test_target,"start": start_test,"feat_static_cat": [ts_volume])
train_df = train_time_series_dicts
train_ds = ListDataset(train_time_series_dicts,freq='M')
#print(train_ds)
test_df = test_time_series_dicts
test_ds = ListDataset(test_time_series_dicts,freq='M')
在我运行我的试验并生成一个预测器对象之后,我试图提取符号文件和参数 json 文件。为了提取符号对象,我尝试了:
predictor.as_symbol_block_predictor(dataset=[train_ds])
错误消息:我收到错误“ListDataset”对象没有属性“副本”。这是跟踪:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-34-e4ce394c1306> in <module>
----> 1 predictor.as_symbol_block_predictor(dataset=[train_ds])
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/mx/model/predictor.py in as_symbol_block_predictor(self, batch, dataset)
337 stack_fn=partial(batchify, ctx=self.ctx, dtype=self.dtype),
338 )
--> 339 batch = next(iter(data_loader))
340
341 with self.ctx:
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __iter__(self)
101
102 def __iter__(self) -> Iterator[DataEntry]:
--> 103 yield from self.transformation(
104 self.base_dataset, is_train=self.is_train
105 )
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/dataset/loader.py in __call__(self, data, is_train)
136
137 def __call__(self, data, is_train):
--> 138 yield from batcher(data, self.batch_size)
139
140
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/itertools.py in get_batch()
62
63 def get_batch():
---> 64 return list(itertools.islice(it, batch_size))
65
66 # has an empty list so that we have a 2D array for sure
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
174 ) -> Iterator:
175 num_idle_transforms = 0
--> 176 for data_entry in data_it:
177 num_idle_transforms += 1
178 for result in self.flatmap_transform(data_entry.copy(), is_train):
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
121 self, data_it: Iterable[DataEntry], is_train: bool
122 ) -> Iterator:
--> 123 for data_entry in data_it:
124 try:
125 yield self.map_transform(data_entry.copy(), is_train)
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
125 yield self.map_transform(data_entry.copy(), is_train)
126 except Exception as e:
--> 127 raise e
128
129 @abc.abstractmethod
/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/gluonts/transform/_base.py in __call__(self, data_it, is_train)
123 for data_entry in data_it:
124 try:
--> 125 yield self.map_transform(data_entry.copy(), is_train)
126 except Exception as e:
127 raise e
AttributeError: 'ListDataset' object has no attribute 'copy'