def opt_to_kwargs(opt):
    """Get kwargs for seq2seq from opt."""
    kwargs = {}
    for k in ['mem_size', 'time_features', 'position_encoding', 'hops']:
        if k in opt:
            kwargs[k] = opt[k]
    return kwargs
