Transformers4Rec
Transformers4Rec copied to clipboard
[BUG] `cannot pickle 'mappingproxy' object` when using `TabularFeatures` `create_categorical`
Bug description
I have a bug just creating a schema programmatically. Can you help me on this?
thx
Steps/Code to reproduce bug
import merlin_standard_lib as msl
from merlin_standard_lib import Schema
from transformers4rec.torch.features.tabular import TabularFeatures
features_schema = Schema([msl.ColumnSchema.create_categorical("language", num_items=149),]
)
a = TabularFeatures.from_schema(
features_schema,
)
I have TypeError: cannot pickle 'mappingproxy' object
coming from
│ /home/mdenadai/miniconda3/envs/gnn/lib/python3.9/site-packages/transformers4rec/torch/features/t │
│ abular.py:175 in from_schema │
│ │
│ 172 │ │ │ │ │ **kwargs, │
│ 173 │ │ │ │ ) │
│ 174 │ │ │ else: │
│ ❱ 175 │ │ │ │ maybe_continuous_module = cls.CONTINUOUS_MODULE_CLASS.from_schema( │
│ 176 │ │ │ │ │ schema, tags=continuous_tags, **kwargs │
│ 177 │ │ │ │ ) │
│ 178 │ │ if categorical_tags: │
│ │
│ /home/mdenadai/miniconda3/envs/gnn/lib/python3.9/site-packages/transformers4rec/torch/tabular/ba │
│ se.py:190 in from_schema │
│ │
│ 187 │ │ ------- │
│ 188 │ │ Optional[TabularModule] │
│ 189 │ │ """ │
│ ❱ 190 │ │ schema_copy = deepcopy(schema) │
│ 191 │ │ if tags: │
│ 192 │ │ │ schema_copy = schema_copy.select_by_tag(tags)
This happens even when I just do:
import deepcopy
import merlin_standard_lib as msl
from merlin_standard_lib import Schema
from transformers4rec.torch.features.tabular import TabularFeatures
deepcopy(Schema([msl.ColumnSchema.create_categorical("language", num_items=149),]))
Environment details
- Transformers4Rec version: 23.6.0
- Platform: unix
- Python version: 3.9