Ex 2: model files and forward signature #70
-
Hi, in the provided model code files (e.g. Maybe I misunderstand something, but shouldn't we access values via |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, I understand you confusion! The structure of query['tokens']['tokens'] is due how the IrTripleDatasetReader and the IrTupleDatasetReader (in data_loading.py) read in the textfields for the query_tokens, doc_pos_tokens and doc_neg_tokens. For each of the query, doc_pos, doc_neg it reads in a TextField (https://docs.allennlp.org/main/api/data/fields/text_field/) which is defined as TextFieldTensors = Dict[str, Dict[str, torch.Tensor]]. The given structure is correct and works with the predefined dataloaders, so in order to complete the missing parts, I would advise you to load a small example of data and look at the structure how it is read in. Does that answer your question? Best, |
Beta Was this translation helpful? Give feedback.
Hi, I understand you confusion! The structure of query['tokens']['tokens'] is due how the IrTripleDatasetReader and the IrTupleDatasetReader (in data_loading.py) read in the textfields for the query_tokens, doc_pos_tokens and doc_neg_tokens. For each of the query, doc_pos, doc_neg it reads in a TextField (https://docs.allennlp.org/main/api/data/fields/text_field/) which is defined as TextFieldTensors = Dict[str, Dict[str, torch.Tensor]].
The given structure is correct and works with the predefined dataloaders, so in order to complete the missing parts, I would advise you to load a small example of data and look at the structure how it is read in.
Does that answer your question?
Best,
Sophia