[🐛BUG] [field_name] == FeatureType.TOKEN: KeyError: 'class'
See original GitHub issueHi I have been trying to run the GRU4recF model, but encounter an error. Let me know what additional info I can give to understand the issue and resolve it. Thanks!
(base) C:\Users\Administrator\RecBole>python run_recbole.py --model=GRU4RecF --dataset=OfekMetaData --config_files=OfekMetaData.yaml
20 Jan 20:30 INFO General Hyper Parameters:
gpu_id=0
use_gpu=True
seed=2020
state=INFO
reproducibility=True
data_path=dataset/OfekMetaData\OfekMetaData
Training Hyper Parameters:
checkpoint_dir=saved
epochs=300
train_batch_size=2048
learner=adam
learning_rate=0.001
training_neg_sample_num=1
eval_step=1
stopping_step=10
Evaluation Hyper Parameters:
eval_setting=TO_LS,full
group_by_user=True
split_ratio=[0.8, 0.1, 0.1]
leave_one_num=2
real_time_process=True
metrics=['Recall', 'MRR', 'NDCG', 'Hit', 'Precision']
topk=[5]
valid_metric=MRR@5
eval_batch_size=4096
Dataset Hyper Parameters:
field_separator=
seq_separator=
USER_ID_FIELD=session_id
ITEM_ID_FIELD=item_id
RATING_FIELD=rating
LABEL_FIELD=label
threshold=None
NEG_PREFIX=neg_
load_col={'inter': ['session_id', 'item_id', 'timestamp'], 'user': ['session_id', 'PatientLocationID', 'GenderID', 'AgeGroup', 'JobGroup']}
unload_col=None
additional_feat_suffix=None
max_user_inter_num=None
min_user_inter_num=0
max_item_inter_num=None
min_item_inter_num=0
lowest_val=None
highest_val=None
equal_val=None
not_equal_val=None
drop_filter_field=True
fields_in_same_space=None
fill_nan=True
preload_weight=None
drop_preload_weight=True
normalize_field=None
normalize_all=True
ITEM_LIST_LENGTH_FIELD=item_length
LIST_SUFFIX=_list
MAX_ITEM_LIST_LENGTH=50
POSITION_FIELD=position_id
HEAD_ENTITY_ID_FIELD=head_id
TAIL_ENTITY_ID_FIELD=tail_id
RELATION_ID_FIELD=relation_id
ENTITY_ID_FIELD=entity_id
20 Jan 20:31 INFO OfekMetaData
The number of users: 2145929
Average actions of users: 3.7118747693305645
The number of items: 46
Average actions of items: 177009.24444444446
The number of inters: 7965416
The sparsity of the dataset: 91.93071078347398%
Remain Fields: ['item_id', 'timestamp', 'session_id', 'JobGroup', 'PatientLocationID', 'GenderID', 'AgeGroup']
20 Jan 20:31 INFO Build [ModelType.SEQUENTIAL] DataLoader for [train] with format [InputType.POINTWISE]
20 Jan 20:31 INFO Evaluation Setting:
Group by session_id
Ordering: {'strategy': 'by', 'field': ['timestamp'], 'ascending': True}
Splitting: {'strategy': 'loo', 'leave_one_num': 2}
Negative Sampling: {'strategy': 'by', 'distribution': 'uniform', 'by': 1}
20 Jan 20:31 INFO batch_size = [[2048]], shuffle = [True]
20 Jan 20:31 INFO Build [ModelType.SEQUENTIAL] DataLoader for [evaluation] with format [InputType.POINTWISE]
20 Jan 20:31 INFO Evaluation Setting:
Group by session_id
Ordering: {'strategy': 'by', 'field': ['timestamp'], 'ascending': True}
Splitting: {'strategy': 'loo', 'leave_one_num': 2}
Negative Sampling: {'strategy': 'full', 'distribution': 'uniform'}
20 Jan 20:31 INFO batch_size = [[4096, 4096]], shuffle = [False]
Traceback (most recent call last):
File "run_recbole.py", line 25, in <module>
run_recbole(model=args.model, dataset=args.dataset, config_file_list=config_file_list)
File "C:\Users\Administrator\RecBole\recbole\quick_start\quick_start.py", line 45, in run_recbole
model = get_model(config['model'])(config, train_data).to(config['device'])
File "C:\Users\Administrator\RecBole\recbole\model\sequential_recommender\gru4recf.py", line 60, in __init__
self.pooling_mode, self.device)
File "C:\Users\Administrator\RecBole\recbole\model\layers.py", line 810, in __init__
self.get_fields_name_dim()
File "C:\Users\Administrator\RecBole\recbole\model\layers.py", line 569, in get_fields_name_dim
if self.dataset.field2type[field_name] == FeatureType.TOKEN:
KeyError: 'class'
(base) C:\Users\Administrator\RecBole>
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
KeyError: "Key 'field_name' not found in 'ModelForm'. Choices ...
The fields exist in the model and are also added in the form class, but I'm still getting the following error : KeyError:...
Read more >pyTenable error - KeyError: 'token'
I'm beginning to use the Security Center API using pyTenable. I was able to run a few basic scripts to begin testing pyTenable's...
Read more >Solved: KeyError when working with fields - Esri Community
Solved: I get KeyError: 5 error when running my script tool. ... DeleteField_management(in_table, field.name) .
Read more >Data Interoperability FME - Python Exception <KeyError>: u ...
I do see an example of the Python Exception : u'hasZ' error but it appears fixed in FME2016. Of course, this could easily...
Read more >Python KeyError Exceptions and How to Handle Them
You will also be able to find all the information you need to determine where the error is coming from by looking at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mayaKaplansky I supposed you would like to implement session-based recommendation with user features, right?
If so, there is no such model that utilized user features for session-based recommendation in RecBole.
I think I have replied on the issue “Get a prediction” with one possibility: you first learned the session representation (just like GRU4RecF with no user features), and then combine it (the embedding encoding the sequence of the items in a session) with user representations (e.g., sum, concatenation or others. If you have multiple features, you can also design a MLP or more complicated architecture). If you would like to find some models with user features for reference, please refer to context-aware models, e.g., deep & wide (however, it seemed to be not explicitly with user features: it accepted general features, including user features).
For this purpose, you should make two attempts:
Thanks! How can I figure out from documentation which model supports user features?