python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import logging from dataclasses import dataclass fro...
canife-main
FLSim/flsim/optimizers/async_aggregators.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc import copy from dataclasses import datac...
canife-main
FLSim/flsim/optimizers/optimizer_scheduler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc import logging from dataclasses import da...
canife-main
FLSim/flsim/optimizers/sync_aggregators.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random from dataclasses import dataclass from typing import List import numpy as...
canife-main
FLSim/flsim/optimizers/tests/test_async_aggregator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest from flsim.common.pytest_helper import assertEqual, assertTrue from flsim....
canife-main
FLSim/flsim/optimizers/tests/test_optimizer_factories.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/optimizers/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math import pytest from flsim.common.pytest_helper import assertEqual from flsim...
canife-main
FLSim/flsim/optimizers/tests/test_lamb_optimizer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest from flsim.common.pytest_helper import assertAlmostEqual, assertEqual from...
canife-main
FLSim/flsim/optimizers/tests/test_lars_optimizer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch from flsim.common.pytest_helper import assertEqual, assertTrue from flsim.o...
canife-main
FLSim/flsim/optimizers/tests/test_optimizer_scheduler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Union from flsim.optimizers.async_aggregators import ( ...
canife-main
FLSim/flsim/optimizers/tests/test_optimizer_utils.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import logging import math from dataclasses import d...
canife-main
FLSim/flsim/trainers/async_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import logging import math import random from datacl...
canife-main
FLSim/flsim/trainers/sync_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import copy import math import random import sys fro...
canife-main
FLSim/flsim/trainers/canary_sync_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore from .async_trainer import AsyncTrainer...
canife-main
FLSim/flsim/trainers/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc import logging import sys from dataclasse...
canife-main
FLSim/flsim/trainers/trainer_base.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from dataclasses import dataclass from typing import...
canife-main
FLSim/flsim/trainers/private_sync_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List import numpy as np import pytest import torch from f...
canife-main
FLSim/flsim/trainers/tests/test_async_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/trainers/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from typing import Tuple import numpy as np import torch from flsim.common....
canife-main
FLSim/flsim/trainers/tests/test_async_trainer_weights.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import json import math from typing import List import flsim.configs # noq...
canife-main
FLSim/flsim/trainers/tests/test_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from enum import Enum from typing import Union import numpy as np import torch from fls...
canife-main
FLSim/flsim/trainers/tests/test_fedbuff.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import NamedTuple EPS = 1e-10 class Timeline(NamedTuple): """ A...
canife-main
FLSim/flsim/common/timeline.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import logging from queue import PriorityQueue from typing import Optional from flsim.c...
canife-main
FLSim/flsim/common/training_simulator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """Utils class to fine tune a global model on client's train set then set the personaliz...
canife-main
FLSim/flsim/common/fine_tuner.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore # @manual from .timeout_simulator impo...
canife-main
FLSim/flsim/common/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import List, Tuple import numpy as np from flsim.clients.async_c...
canife-main
FLSim/flsim/common/training_event_handler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import logging import sys LOGGING_LEVEL: int = logging.INFO # If this flag is true log...
canife-main
FLSim/flsim/common/logger.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from enum import Enum from typing import List, Tuple class DiversityMetricType(Enum): gradien...
canife-main
FLSim/flsim/common/diversity_metrics.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """Contains helpers for Python PyTest tests. There is a list of helper utilities missin...
canife-main
FLSim/flsim/common/pytest_helper.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc from dataclasses import dataclass from ty...
canife-main
FLSim/flsim/common/timeout_simulator.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import math import random from flsim.common.diversity_metrics import ( DiversityMetrics, D...
canife-main
FLSim/flsim/common/tests/test_diversity_metrics.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from flsim.common.pytest_helper import ( assertAlmostEqual, assertEqual, ass...
canife-main
FLSim/flsim/common/tests/test_round_timeline.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/common/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from flsim.common.pytest_helper import ( assertAlmos...
canife-main
FLSim/flsim/common/tests/test_timeout_simulator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch from flsim.clients.base_client import ClientConfig from flsim.common.fine_t...
canife-main
FLSim/flsim/common/tests/test_fine_tuner.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List import pytest from flsim.clients.async_client import AsyncClien...
canife-main
FLSim/flsim/common/tests/test_training_event_handler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from typing import List, Tuple, Type import numpy as np import pytest impor...
canife-main
FLSim/flsim/common/tests/test_training_simulator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # The base hydra configs for different components of FLSim are defined # in their respec...
canife-main
FLSim/flsim/configs/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/configs/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import flsim.configs # noqa from flsim.common.pytest_helper import assertRaises from fl...
canife-main
FLSim/flsim/configs/tests/test_config_validation.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import copy from dataclasses import dataclass from t...
canife-main
FLSim/flsim/active_user_selectors/diverse_user_selector.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore # @manual from .diverse_user_selector ...
canife-main
FLSim/flsim/active_user_selectors/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc import copy import math from dataclasses ...
canife-main
FLSim/flsim/active_user_selectors/simple_user_selector.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/active_user_selectors/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from collections import Counter import torch from flsim.active_user_selecto...
canife-main
FLSim/flsim/active_user_selectors/tests/test_active_user_selector.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from collections import Counter import torch from flsim.active_user_selecto...
canife-main
FLSim/flsim/active_user_selectors/tests/test_diverse_user_selector.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore from .data_sharder import ( Broadca...
canife-main
FLSim/flsim/data/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc import random from collections import def...
canife-main
FLSim/flsim/data/data_sharder.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any, Dict # see https://fb.workplace.com/groups/fbcode/pe...
canife-main
FLSim/flsim/data/csv_dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from abc import ABC, abstractmethod from typing impo...
canife-main
FLSim/flsim/data/data_provider.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Iterable, Optional, Type import torch from flsim.data.data_shar...
canife-main
FLSim/flsim/data/dataset_data_loader.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import pkg_resources import pytest import torch from flsim...
canife-main
FLSim/flsim/data/tests/test_dataset_dataloader_with_batch.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/data/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math import random import string import torch from flsim.common.pytest_helper im...
canife-main
FLSim/flsim/data/tests/test_data_sharder.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from enum import IntEnum import torch import torch.nn as nn from flsim.utils.distribute...
canife-main
FLSim/flsim/servers/aggregator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from dataclasses import dataclass from typing import...
canife-main
FLSim/flsim/servers/sync_dp_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore # @manual from .sync_dp_servers import...
canife-main
FLSim/flsim/servers/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc from dataclasses import dataclass from ty...
canife-main
FLSim/flsim/servers/sync_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from dataclasses import dataclass from typing import...
canife-main
FLSim/flsim/servers/sync_secagg_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from typing import List import numpy as np import pyt...
canife-main
FLSim/flsim/servers/tests/test_sync_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/servers/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from tempfile import mkstemp import pytest import torch.distributed as dist import tor...
canife-main
FLSim/flsim/servers/tests/test_aggregator.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from flsim.channels.message import Message from flsim.common.pytest_helper import assert...
canife-main
FLSim/flsim/servers/tests/test_sync_secagg_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import itertools import math from tempfile import mkstemp from unittest.mock import Magi...
canife-main
FLSim/flsim/servers/tests/test_sync_dp_servers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from dataclasses import dataclass from enum import I...
canife-main
FLSim/flsim/reducers/weighted_dp_round_reducer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore # @manual from .base_round_reducer imp...
canife-main
FLSim/flsim/reducers/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """ This file defines the concept of a base round aggregator for a federated learning se...
canife-main
FLSim/flsim/reducers/base_round_reducer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from dataclasses import dataclass from itertools imp...
canife-main
FLSim/flsim/reducers/dp_round_reducer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass from tempfile import mkstemp from typing i...
canife-main
FLSim/flsim/reducers/tests/test_round_reducer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/reducers/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any, Iterable class IFLDataLoader(abc.ABC): @abc.abs...
canife-main
FLSim/flsim/interfaces/data_loader.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/interfaces/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from enum import Enum, auto from typing import Any, Dict, List, Optional, Tup...
canife-main
FLSim/flsim/interfaces/metrics_reporter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any import torch.nn as nn from flsim.interfaces.batch_met...
canife-main
FLSim/flsim/interfaces/model.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from dataclasses import dataclass from omegaconf import MISSING from torch.u...
canife-main
FLSim/flsim/interfaces/dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any, List import torch class IFLBatchMetrics(abc.ABC): ...
canife-main
FLSim/flsim/interfaces/batch_metrics.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from collections import OrderedDict from dataclasses...
canife-main
FLSim/flsim/channels/scalar_quantization_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from collections import OrderedDict from dataclasses...
canife-main
FLSim/flsim/channels/half_precision_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import math from collections import OrderedDict from...
canife-main
FLSim/flsim/channels/product_quantization_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from hydra.core.config_store import ConfigStore from .base_channel import FLChannelConf...
canife-main
FLSim/flsim/channels/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from copy import deepcopy from dataclasses import dataclass, field from typing import Op...
canife-main
FLSim/flsim/channels/message.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import abc from dataclasses import dataclass from ty...
canife-main
FLSim/flsim/channels/base_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from enum import Enum, auto from flsim.utils.fl.stats import RandomVariableStatsTracker...
canife-main
FLSim/flsim/channels/communication_stats.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from collections import OrderedDict from dataclasses...
canife-main
FLSim/flsim/channels/sparse_mask_channel.py
canife-main
FLSim/flsim/channels/pq_utils/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math import torch from sklearn.cluster import KMeans class PQ: """ Qua...
canife-main
FLSim/flsim/channels/pq_utils/pq.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Type import pytest from flsim.channels.base_channel import FLChannel...
canife-main
FLSim/flsim/channels/tests/test_identity_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Type import pytest from flsim.channels.communication_stats import Ch...
canife-main
FLSim/flsim/channels/tests/test_scalar_quantization_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
canife-main
FLSim/flsim/channels/tests/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Type import pytest from flsim.channels.communication_stats import Ch...
canife-main
FLSim/flsim/channels/tests/test_half_precision_channel.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import OrderedDict, Type import pytest import torch from flsim.channels.bas...
canife-main
FLSim/flsim/channels/tests/test_sparse_mask_channel.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from setuptools import find_packages, setup setup( name="cotracker", version="1.0", install_requires=[], ...
co-tracker-main
setup.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import random import torch import signal import socket import sys import json import numpy as np import argpars...
co-tracker-main
train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch dependencies = ["torch", "einops", "timm", "tqdm"] _COTRACKER_URL = ( "https://dl.fbaipublicfiles.com/c...
co-tracker-main
hubconf.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import cv2 import torch import argparse import numpy as np from PIL import Image from cotracker.utils.visualize...
co-tracker-main
demo.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn.functional as F from tqdm import tqdm from cotracker.models.core.cotracker.cotracker import ...
co-tracker-main
cotracker/predictor.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree.
co-tracker-main
cotracker/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import io import glob import torch import pickle import numpy as np import mediapy as media from PIL import Ima...
co-tracker-main
cotracker/datasets/tap_vid_datasets.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import torch import imageio import numpy as np from cotracker.datasets.utils import CoTrackerData from torchvi...
co-tracker-main
cotracker/datasets/kubric_movif_dataset.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import numpy as np import os import json import imageio import cv2 from enum import Enum from cotracker.da...
co-tracker-main
cotracker/datasets/badja_dataset.py