python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# Copyright (c) 2019-present, Facebook, Inc. # 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 re import tokenize import typing as tp from io import BytesIO import black # type: ignore from codegen_sources.preproc...
CodeGen-main
codegen_sources/preprocessing/lang_processors/python_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 re from pathlib import Path from .java_processor import JAVA_CHAR2TOKEN, JAVA_TOKEN2CHAR from .tokenization_utils import...
CodeGen-main
codegen_sources/preprocessing/lang_processors/rust_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 re from .lang_processor import LangProcessor, NEWLINE_TOK IR_LANGUAGE_NAME = "ir" class IRProcessor(LangProcessor): ...
CodeGen-main
codegen_sources/preprocessing/lang_processors/ir_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 .lang_processor import LangProcessor as LangProcessor # for explicit reimport from .tree_sitter_processor import TREE_SIT...
CodeGen-main
codegen_sources/preprocessing/lang_processors/__init__.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 re import uuid import logging import itertools import dataclasses import typing as tp from pathlib import Path from io im...
CodeGen-main
codegen_sources/preprocessing/lang_processors/python_tree_sitter_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 random import re import subprocess import uuid from pathlib import Path import typing as tp import codegen_sources from ...
CodeGen-main
codegen_sources/preprocessing/lang_processors/java_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 typing as tp from codegen_sources.model.src.data.dictionary import ( OBF, OBFS, ) def obfuscation_tokens(rais...
CodeGen-main
codegen_sources/preprocessing/lang_processors/utils.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 abc import ABC import typing as tp NEWLINE_TOK = "NEW_LINE" # different name to avoid confusions by the tokenizer clas...
CodeGen-main
codegen_sources/preprocessing/lang_processors/lang_processor.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 re from pathlib import Path from .java_processor import JAVA_CHAR2TOKEN, JAVA_TOKEN2CHAR from .tokenization_utils import...
CodeGen-main
codegen_sources/preprocessing/lang_processors/go_processor.py
CodeGen-main
codegen_sources/test_generation/__init__.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/select_java_inputs.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/utils.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 sys import argparse import pickle from concurrent.futures.process import ProcessPoolExecutor from itertools import repeat...
CodeGen-main
codegen_sources/test_generation/compute_test_results.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 math import os import sys import subprocess import typing as tp from concurrent.futures.thread import ThreadPoolExecutor ...
CodeGen-main
codegen_sources/test_generation/create_tests.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 argparse import fastBPE import torch from pathlib import Path import pandas as pd INITIAL_CACHE_FOLDER = "initial_cach...
CodeGen-main
codegen_sources/test_generation/create_data_for_online_st.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 sys import argparse from itertools import repeat from logging import getLogger from pathlib import Path import pandas as...
CodeGen-main
codegen_sources/test_generation/compute_transcoder_translations.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/select_successful_tests.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/evosuite_translator.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/evosuite_to_python.py
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/__init__.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/evosuite_to_cpp.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 difflib from pathlib import Path from codegen_sources.preprocessing.lang_processors.python_processor import apply_black ...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/test_utils.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 .test_utils import read_inputs, translation_testing from ..evosuite_to_python import EvosuiteToPython ARRAYS = ["integer_...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/test_evosuite_to_python_translator.py
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/__init__.py
# Copyright (c) 2019-present, Facebook, Inc. # 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 .test_utils import read_inputs, translation_testing from ..evosuite_to_cpp import EvosuiteToCpp ARRAYS = ["integer_array_...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/test_evosuite_to_cpp_translator.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_9167f62308cfc555ab31a6e4dcdcc95ca2bdcab48016d16bd5b42146ef1977eb( unittest.TestCase ): def test0(self): float0 = ...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/floats.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_196a45f8932c033f06f6a086488b268404e77353d16c9bc6407a417f237da6db( unittest.TestCase ): def test3(self): int0 = f_...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/integer_array_casting.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_db35bde703321c750c7134d5769b704c9ab7f9841c6654abb814683a361f9de1( unittest.TestCase ): def test0(self): arrayList...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/java_list.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_4819651a89a417bce7b2158d1101004f26892e6022f6d1e6348175e23666ec38( unittest.TestCase ): def test0(self): double0 =...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/doubles.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_c2a773c670339b0d7be430a133f7f597ae56ad8ebb7f7209c0fe9edbd248fd04( unittest.TestCase ): def test2(self): boolean0 ...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/strings_null_casting.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class CLASS_27c05c7602b81c3bcf7ac99abf940ebc4c909da67935bb59bc30e51ac3933ace( unittest.TestCase ): def test1(self): string0 =...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/strings.py
import numpy as np import math from math import * import collections from collections import * import heapq import itertools import random import sys import unittest # TOFILL class PERMUTE_TWO_ARRAYS_SUM_EVERY_PAIR_GREATER_EQUAL_K(unittest.TestCase): def test0(self): integerArray0 = [None] * 2 i...
CodeGen-main
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/integer_array_check.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 setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.set...
dadaptation-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 math from typing import TYPE_CHECKING, Any, Callable, Optional import torch import torch.optim import pdb import...
dadaptation-main
dadaptation/dadapt_adam.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 .dadapt_adagrad import DAdaptAdaGrad from .dadapt_adam import DAdaptAdam from .dadapt_sgd import DAdaptSGD from .da...
dadaptation-main
dadaptation/__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 torch import torch.optim import pdb import math import logging import torch.distributed as dist class DAdaptSGD(...
dadaptation-main
dadaptation/dadapt_sgd.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 math from typing import TYPE_CHECKING, Any, Callable, Optional import torch import torch.optim import pdb import...
dadaptation-main
dadaptation/dadapt_adagrad.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 typing import Tuple, Optional, Callable import torch from torch.optim.optimizer import Optimizer import torch.dist...
dadaptation-main
dadaptation/dadapt_lion.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 typing import TYPE_CHECKING, Any import torch import torch.optim if TYPE_CHECKING: from torch.optim.optimizer...
dadaptation-main
dadaptation/dadapt_adan.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 .dadapt_adan_ip import DAdaptAdanIP from .dadapt_adam_preprint import DAdaptAdamPreprint
dadaptation-main
dadaptation/experimental/__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 math from typing import TYPE_CHECKING, Any, Callable, Optional import torch import torch.optim import pdb import...
dadaptation-main
dadaptation/experimental/dadapt_adan_ip.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 math from typing import TYPE_CHECKING, Any, Callable, Optional import torch import torch.optim import pdb import...
dadaptation-main
dadaptation/experimental/dadapt_adam_preprint.py
# Copyright (c) Facebook, Inc. and its 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 sys sys.path.insert(0, './pytorch-seq2seq/') from seq2seq.models import EncoderRNN from seq2seq.loss import Perpl...
brica-master
train.py
# Copyright (c) Facebook, Inc. and its 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 numpy as np import random from torch.distributions import Categorical import torch.nn.functional as F from seq2se...
brica-master
t2s/sampling_decoder.py
# Copyright (c) Facebook, Inc. and its 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 as nn import torch.nn.functional as F class Seq2seq(nn.Module): def __init__(self, enc...
brica-master
t2s/s2s.py
# Copyright (c) Facebook, Inc. and its 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 itertools import random import json def repeat_explode(input, input_length, n_times): """ >...
brica-master
t2s/util.py
# Copyright (c) Facebook, Inc. and its 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 as nn class T2S(nn.Module): def __init__(self, A1, A2): super(T2S, self).__ini...
brica-master
t2s/t2s.py
# Copyright (c) Facebook, Inc. and its 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 .s2s import Seq2seq from .t2s import T2S from .util import dump_agent from .sampling_decoder import SamplingDecoderR...
brica-master
t2s/__init__.py
# Copyright (c) Facebook, Inc. and its 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 .poly_evaluator import PolyEvaluator
brica-master
t2s/evaluator/__init__.py
# Copyright (c) Facebook, Inc. and its 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 __future__ import print_function, division from ..util import repeat_explode, pretrain_explode from seq2seq.loss im...
brica-master
t2s/evaluator/poly_evaluator.py
# Copyright (c) Facebook, Inc. and its 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 .mirror_trainer import MirrorTrainer
brica-master
t2s/trainer/__init__.py
# Copyright (c) Facebook, Inc. and its 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 __future__ import division import torch from seq2seq.loss import NLLLoss from ..evaluator import PolyEvaluator fro...
brica-master
t2s/trainer/mirror_trainer.py
# Copyright (c) Facebook, Inc. and its 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. # class EarlyStopping_NoImprovement(object): def __init__(self, min_delta=1e-5, patie...
brica-master
t2s/trainer/early_stopping.py
# # Copyright 2017- IBM Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
brica-master
t2s/trainer/supervised_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import find_packages, setup requirements = [ "torch", "gpytorch", "botorch>=0.6", "s...
bo_pr-main
setup.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from typing import List, Optional, Tuple import torch from statsmodels.distribut...
bo_pr-main
discrete_mixed_bo/model_utils.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Methods for optimizing acquisition functions. This is a copy of botorch.optim.optimize.py that uses the custom ...
bo_pr-main
discrete_mixed_bo/optimize.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Utilities for running experiments.""" from collections import OrderedDict from copy import deepcopy from itertools...
bo_pr-main
discrete_mixed_bo/experiment_utils.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" A wrapper classes around AquisitionFunctions to modify inputs and outputs. """ from __future__ import annotatio...
bo_pr-main
discrete_mixed_bo/wrapper.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Candidate generation utilities. This is a copy of botorch.gen.py that uses finite differences when specified. "...
bo_pr-main
discrete_mixed_bo/gen.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Utilities for random fourier features. """ import torch from botorch.models import ModelListGP, MultiTaskGP fro...
bo_pr-main
discrete_mixed_bo/rffs.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Straight Through Estimators. """ import torch from torch import Tensor from torch.autograd import Function from...
bo_pr-main
discrete_mixed_bo/ste.py
#!/usr/bin/env python3 # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
bo_pr-main
discrete_mixed_bo/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Run one replication. """ import gc from time import time from typing import Callable, Dict, List, Optional impo...
bo_pr-main
discrete_mixed_bo/run_one_replication.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" A copy of botorch.optim.initializers that support vector-valued sigma for the sample_around_best heuristic. Ref...
bo_pr-main
discrete_mixed_bo/initializers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from abc import abstractmethod from dataclasses import dataclass from typing import Callable, Dict, List, Optional i...
bo_pr-main
discrete_mixed_bo/input.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, List, Optional import numpy as np import torch from botorch.models.kernels import Categoric...
bo_pr-main
discrete_mixed_bo/kernels.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Trust Region Utilities. """ import math from dataclasses import dataclass import torch @dataclass class Turbo...
bo_pr-main
discrete_mixed_bo/trust_region.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Probabilistic Reparameterization (with gradients) using Monte Carlo estimators. """ from abc import ABC, abstra...
bo_pr-main
discrete_mixed_bo/probabilistic_reparameterization.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Problems with only binary variables. """ from typing import Optional import numpy as np import torch from torch ...
bo_pr-main
discrete_mixed_bo/problems/binary.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import pickle import random import sys from itertools import product from logging import Lo...
bo_pr-main
discrete_mixed_bo/problems/nashpobench2.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Problems mixed integer continuous search spaces. References .. [Hansen2019] N. Hansen, D. Brockhoff, O. Mer...
bo_pr-main
discrete_mixed_bo/problems/coco_mixed_integer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Problems with only binary variables. """ from collections import OrderedDict from typing import Optional import ...
bo_pr-main
discrete_mixed_bo/problems/pest.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Environmental model calibration problem from: https://github.com/aryandeshwal/HyBO/blob/master/experiments/test_f...
bo_pr-main
discrete_mixed_bo/problems/environmental.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
bo_pr-main
discrete_mixed_bo/problems/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ 3-Objective Electrospun Oil Sorbent optimization problem References .. [Wang2020] B. Wang, J. Cai, C. Liu, ...
bo_pr-main
discrete_mixed_bo/problems/oil_sorbent.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Welded Beam problem from https://link.springer.com/content/pdf/10.1007/s00158-018-2182-1.pdf """ from copy import...
bo_pr-main
discrete_mixed_bo/problems/welded_beam.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from math import exp, log from typing import Dict, Optional import numpy as np import pandas as pd import ...
bo_pr-main
discrete_mixed_bo/problems/xgboost_hp.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from typing import Any, Dict, Optional, Tuple import gpytorch.settings as gpt_settings import numpy as np ...
bo_pr-main
discrete_mixed_bo/problems/chemistry.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Optional, Tuple import numpy as np import torch from sklearn.svm import SVR from torc...
bo_pr-main
discrete_mixed_bo/problems/svm.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Problems with only binary variables. """ from math import pi from typing import Optional, Tuple import numpy as ...
bo_pr-main
discrete_mixed_bo/problems/re_problems.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict from typing import Dict, List, Optional import torch from botorch.test_functions...
bo_pr-main
discrete_mixed_bo/problems/base.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Tuple, Union import numpy as np """ Problem formulation for the RF Coverage and Capacity Optim...
bo_pr-main
discrete_mixed_bo/problems/cco/problem_formulation.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
bo_pr-main
discrete_mixed_bo/problems/cco/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import bisect import glob import logging import os import re from dataclasses import dataclass from typing import An...
bo_pr-main
discrete_mixed_bo/problems/cco/simulated_rsrp.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Coverage and Capacity optimization for Cell networks. Code from: https://github.com/Ryandry1st/CCO-in-ORAN/tree/m...
bo_pr-main
discrete_mixed_bo/problems/cco/cco.py
#!/usr/bin/env python3 # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
bo_pr-main
experiments/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" The main script for running a single replication. """ import errno import json import os import sys from typing ...
bo_pr-main
experiments/main.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. from configs import Config ########### running ########### # torchrun --nproc_per_node=8 main.py <config> def eval_yfcc15m_in1k_mocob16(): return Config( output_dir="yfcc15m_in1k_mocob16", eval=True, resume="chec...
CiT-main
run_configs.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. import os import inspect from collections import OrderedDict class Config: dataset = "yfcc15m_tag" root = "data/yfcc15m" metadata = "data/yfcc15m/yfcc15m_w_tag.pkl" # data adaptation val_task = "imagenet" max_sample ...
CiT-main
configs.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. import torch from transformers import VisionTextDualEncoderModel class CiTCLIPVisionTextDualEncoderModel(VisionTextDualEncoderModel): '''a hf model wrapper to support forward with either or both image/text. note that HF impl. uses a...
CiT-main
models_citclip.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. # -------------------------------------------------------- # A script to run multinode training with submitit. # ----------...
CiT-main
submitit_citclip.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. # -------------------------------------------------------- # References: # DeiT: https://github.com/facebookresearch/deit #...
CiT-main
engine.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. """ pre-configed sweeps. """ import json class alltask_5k_mr005: batch_size = [1536], "bsz" max_update = [5000], "s" refilter = [100], "refilter" prefilter = [0.45], "" min_ratio = [0.05], "r" sublist = [True], "" ...
CiT-main
sweeps.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. # Copyright (c) Meta Platforms, Inc. All Rights Reserved import torch import torch.nn as nn import torch.nn.functional as ...
CiT-main
losses.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. # -------------------------------------------------------- # References: # DeiT: https://github.com/facebookresearch/deit #...
CiT-main
main.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. """ pre-configed trainable weights. """ pre_projection_weights = ['logit_scale', 'visual_projection.weight', 'text_projection.weight'] # TODO: unify layer selection for all models. pre_vision_trainable_weights = { "moco": { "hea...
CiT-main
weights.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. # -------------------------------------------------------- # References: # DeiT: https://github.com/facebookresearch/deit #...
CiT-main
util/misc.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. # Copyright (c) Meta Platforms, Inc. All Rights Reserved import math def adjust_step_learning_rate(optimizer, step, lr, ...
CiT-main
util/lr_sched.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. import torch from transformers import ( PreTrainedModel, PretrainedConfig, AutoConfig, AutoModel, ) from transformers.modeling_outputs import BaseModelOutputWithPooling import timm assert timm.__version__ >= "0.4.12", "make ...
CiT-main
hfmodels/augreg.py