Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Vit deit #195

Closed
wants to merge 19 commits into from
Closed

Vit deit #195

wants to merge 19 commits into from

Conversation

growlix
Copy link
Contributor

@growlix growlix commented Feb 20, 2021

Let's do SSL with vision transformers!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 20, 2021
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@prigoyal
Copy link
Contributor

@growlix , the PR is almost good to go, some CPU tests failures that should be resolved https://app.circleci.com/pipelines/github/facebookresearch/vissl/681/workflows/fc2b7619-69f6-498e-985b-f3c6f623ecb7/jobs/1352

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@prigoyal
Copy link
Contributor

@growlix there's one error on internal tests.

Traceback (most recent call last):
  File "<string>", line 38, in <module>
  File "<string>", line 36, in __run
  File "/usr/local/fbcode/platform007/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/fbcode/platform007/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/__fb_test_main__.py", line 1033, in <module>
    sys.exit(main(sys.argv))
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/__fb_test_main__.py", line 1029, in main
    return MainProgram(sys.argv).run()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/__fb_test_main__.py", line 842, in run
    test_suite = self.load_tests()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/__fb_test_main__.py", line 825, in load_tests
    suite = loader.load_all()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/__fb_test_main__.py", line 589, in load_all
    __import__(module_name, level=0)
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/deeplearning/projects/ssl_framework/tests/test_losses.py", line 16, in <module>
    from vissl.trainer.train_task import SelfSupervisionTask
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/trainer/__init__.py", line 4, in <module>
    from vissl.oss.trainer import SelfSupervisionTrainer
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/oss/trainer/__init__.py", line 4, in <module>
    import vissl.data.collators  # NOQA
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/data/__init__.py", line 17, in <module>
    from vissl.oss.data import (
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/oss/data/__init__.py", line 17, in <module>
    from vissl.data.ssl_dataset import GenericSSLDataset
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/data/ssl_dataset.py", line 10, in <module>
    from vissl.data.ssl_transforms import get_transform
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/data/ssl_transforms/__init__.py", line 12, in <module>
    import_all_modules(FILE_ROOT, "vissl.data.ssl_transforms")
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/classy_vision/generic/registry_utils.py", line 20, in import_all_modules
    importlib.import_module(module_name)
  File "/usr/local/fbcode/platform007/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/vissl/data/ssl_transforms/rand_auto_aug.py", line 128, in <module>
    class AutoAugment(ClassyTransform):
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/deeplearning/projects/ssl_framework/tests/test_losses#binary,link-tree/classy_vision/dataset/transforms/__init__.py", line 103, in register_transform_cls
    name
ValueError: AutoAugment has existed in torchvision.transforms, Please change the name!

@prigoyal
Copy link
Contributor

similarly one more

	Traceback (most recent call last):
	  File "fblearner/flow/core/utilities.py", line 210, in get_all_flow_objects_of_type
	    module = importlib.import_module(module_name)
	  File "/usr/local/fbcode/platform007/lib/python3.7/importlib/__init__.py", line 127, in import_module
	    return _bootstrap._gcd_import(name[level:], package, level)
	  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
	  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
	  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
	  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
	  File "<frozen importlib._bootstrap_external>", line 767, in exec_module
	  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
	  File "fblearner/flow/projects/vision/ssl_framework/self_supervision_workflow.py", line 27, in <module>
	    from ssl_framework_tools.nearest_neighbor_test import main as knn_main
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/ssl_framework_tools/nearest_neighbor_test.py", line 14, in <module>
	    from vissl.utils.distributed_launcher import launch_distributed
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/utils/distributed_launcher.py", line 15, in <module>
	    from vissl.engines.extract_features import extract_main
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/engines/__init__.py", line 4, in <module>
	    from vissl.engines.extract_features import extract_main  # noqa
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/engines/extract_features.py", line 5, in <module>
	    from vissl.trainer import SelfSupervisionTrainer
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/trainer/__init__.py", line 4, in <module>
	    from vissl.oss.trainer import SelfSupervisionTrainer
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/oss/trainer/__init__.py", line 5, in <module>
	    import vissl.data.ssl_transforms  # NOQA
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/data/__init__.py", line 17, in <module>
	    from vissl.oss.data import (
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/oss/data/__init__.py", line 17, in <module>
	    from vissl.data.ssl_dataset import GenericSSLDataset
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/data/ssl_dataset.py", line 10, in <module>
	    from vissl.data.ssl_transforms import get_transform
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/data/ssl_transforms/__init__.py", line 12, in <module>
	    import_all_modules(FILE_ROOT, "vissl.data.ssl_transforms")
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/classy_vision/generic/registry_utils.py", line 20, in import_all_modules
	    importlib.import_module(module_name)
	  File "/usr/local/fbcode/platform007/lib/python3.7/importlib/__init__.py", line 127, in import_module
	    return _bootstrap._gcd_import(name[level:], package, level)
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/vissl/data/ssl_transforms/rand_auto_aug.py", line 73, in <module>
	    class RandAugment(ClassyTransform):
	  File "/dev/shm/uid-30041/4d4560ca-seed-nspid4026533891-ns-4026533862/classy_vision/dataset/transforms/__init__.py", line 99, in register_transform_cls
	    raise ValueError("Cannot register duplicate transform ({})".format(name))
	ValueError: Cannot register duplicate transform (RandAugment)

…VisslAutoAugment because of name conflict issues
@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@growlix has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@growlix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@growlix merged this pull request in 4cffc1c.

@prigoyal
Copy link
Contributor

congratulations on this major milestone @growlix !!! and kudos for all the hard work!!! It's a great contribution to the research community and extremely awesome/high-quality work!!

@prigoyal prigoyal deleted the vit_deit branch March 2, 2021 00:52
facebook-github-bot pushed a commit that referenced this pull request Jan 10, 2022
Summary:
Make sure that KNN can be applied with big models such as FSDP models on big datasets:
- Allow the feature extraction to be done separately from KNN (for faster HP search for KNN)
- Allow disabling CUDA for the KNN computation, using RAM instead, to fit bigger features
- Provide a different KNN implementation that is more memory friendly and avoids loading all features at the same time

Rationale for memory optimisations: for features of size 30K, on a dataset such as Places205 with 2.5M images, the total memory required to load the features is 30K * 2.5M * 4 bytes = 280GB memory.

Pull Request resolved: fairinternal/ssl_scaling#195

Reviewed By: iseessel

Differential Revision: D31938434

Pulled By: QuentinDuval

fbshipit-source-id: fc0434e687bfd965e4e8984571b96f4368ecbcd5
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants