Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'learn2learn has no attribute FusedNWayKShots' #1

Open
fyancy opened this issue Nov 26, 2021 · 0 comments
Open

module 'learn2learn has no attribute FusedNWayKShots' #1

fyancy opened this issue Nov 26, 2021 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@fyancy
Copy link
Owner

fyancy commented Nov 26, 2021

This may be caused by the Version incompatibility of learn2learn. Our codes support learn2learn with version >= 0.1.5, and the original codes are:

tasks = l2l.data.TaskDataset(dataset, task_transforms=[
            l2l.data.transforms.FusedNWaysKShots(dataset, new_ways, 2 * shots, filter_labels=filter_labels),
            l2l.data.transforms.LoadData(dataset),
            # l2l.data.transforms.RemapLabels(dataset, shuffle=label_shuffle_per_task),
            l2l.data.transforms.RemapLabels(dataset, shuffle=True),
            # do not keep the original labels, use (0 ,..., n-1);
            # if shuffle=True, to shuffle labels at each task.
            l2l.data.transforms.ConsecutiveLabels(dataset),
            # re-order samples and make their original labels as (0 ,..., n-1).
        ], num_tasks=num_tasks)

FusedNWaysKShots is just an Efficient implementation of FilterLabels, NWays, and KShots. To avoid the above error, you can update your learn2learn package (>=0.1.5) or directly use the codes as follows.

tasks = l2l.data.TaskDataset(dataset, task_transforms=[
        l2l.data.transforms.NWays(dataset, new_ways),
        l2l.data.transforms.KShots(dataset, 2 * shots),
        l2l.data.transforms.FilterLabels(dataset, filter_labels),
        l2l.data.transforms.LoadData(dataset),
        l2l.data.transforms.RemapLabels(dataset),
        l2l.data.transforms.ConsecutiveLabels(dataset),
    ], num_tasks=num_tasks)

For more details, you can refer to my blog: 初探元学习库learn2learn or the official documents of learn2learn.

GOOD LUCK to you guys.

@fyancy fyancy added bug Something isn't working enhancement New feature or request labels Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant