About concat_history in dataset.py
gicheonkang opened this issue · comments
Hi, concat_history flag in dataset.py is quite confusing.
I think if self.config.get("concat_history", True):
would be correct
not if self.config.get("concat_history", False):
.
Due to the code above, the dataloader returns the concatenated history if concat_history==False.
Hi! I am not quite sure if I understand, .get
method of builtin dict allows option to specify a "default" value if the key does not exist. Here if self.config.get("concat_history", False):
would simply default to NOT concatenating history if concat_history
does not exist in config dict. You can specify concat_history
as False and it will still skip concatenating history.
For example, try out this snippet:
>>> letters = {"a": 1, "b": 2}
>>> letters["c"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'c'
>>> letters.get("c", 3)
3
>>> letters["c"] = 4
>>> letters.get("c", 3)
4
Does this make sense? Let me know if you have further concerns.
Thank you so much. I'm deluding myself :)
Glad it helped!