python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
import json import numpy as np import random from os.path import isfile, isdir from os.path import join as pjoin import torch from torch.utils.data import Dataset ######### # Node typing: checking the type of a specific sub-tree (dict value) ######### def is_span(val): try: a, (b, c) = val return...
craftassist-master
acl2020_submission/model_training_code/utils_caip.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.optim import Adam, Adagrad from transformers.modeling_bert import BertModel, BertOnlyMLMHead from utils_caip import * # -------------------------- # Transformer-based decoder module for sequence ans span prediction, computes the loss # --...
craftassist-master
acl2020_submission/model_training_code/utils_parsing.py
import json import math import pickle import torch from transformers import AutoModel, AutoTokenizer, BertConfig from utils_parsing import * from utils_caip import * from train_model import * class TTADBertModel(object): def __init__(self, model_dir, data_dir, model_name="caip_test_model"): model_name ...
craftassist-master
acl2020_submission/model_training_code/query_model.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 numpy as np import scipy from scipy.optimize import Bounds, LinearConstraint, minimize, SR1 import pdb import math i...
adaptive_scheduling-main
solve_gradient_seq.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 numpy as np import scipy from scipy.optimize import Bounds, LinearConstraint, minimize, SR1 import pdb import math i...
adaptive_scheduling-main
solve_gradient_simple.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 numpy as np import scipy from scipy.optimize import Bounds, LinearConstraint, minimize, SR1 import pdb import mat...
adaptive_scheduling-main
solve_bound.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 import logging from typing import TYPE_CHECKING, Any, Callable, Optional import torch import torch.optim impor...
adaptive_scheduling-main
adagrad_flex.py
# 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 import platform import re import sys from glob import glob from pybind11.setup_helpers import build_ext, Pybind11Extension from s...
beanmachine-main
setup.py
# 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. # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # ...
beanmachine-main
website/sphinx/conf.py
# 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 json import re import shutil import uuid import warnings from pathlib import Path from typing import Any, Dict, List, Tuple, Union i...
beanmachine-main
website/scripts/convert_ipynb_to_mdx.py
# 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 unittest import beanmachine.ppl as bm import torch.distributions as dist from torch import tensor class ToplevelSmokeTest(unittest...
beanmachine-main
tests/ppl/smoke_test.py
# 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 beanmachine.ppl as bm import pytest import torch.distributions as dist @pytest.fixture(autouse=True) def fix_random_seed(): """...
beanmachine-main
tests/ppl/conftest.py
beanmachine-main
tests/ppl/__init__.py
# 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 beanmachine.ppl as bm import pytest import torch from beanmachine.ppl.experimental.torch_jit_backend import get_backend, TorchJITBac...
beanmachine-main
tests/ppl/experimental/torch_jit_backend_test.py
beanmachine-main
tests/ppl/experimental/__init__.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.split_rule import ( CompositeRules, Dimen...
beanmachine-main
tests/ppl/experimental/bart/bart_split_rule_test.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.scalar_samplers import ( NoiseStandardDeviatio...
beanmachine-main
tests/ppl/experimental/bart/bart_scalar_sampler_test.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.exceptions import ( GrowError, PruneErro...
beanmachine-main
tests/ppl/experimental/bart/bart_tree_test.py
# 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 copy import deepcopy import pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.exceptions import ( ...
beanmachine-main
tests/ppl/experimental/bart/bart_node_test.py
beanmachine-main
tests/ppl/experimental/bart/__init__.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.exceptions import ( PruneError, ) from beanm...
beanmachine-main
tests/ppl/experimental/bart/bart_tree_proposer_test.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.bart_model import ( LeafMean, ) from beanmach...
beanmachine-main
tests/ppl/experimental/bart/xbart_grow_from_root_proposer_test.py
# 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 pytest import torch from beanmachine.ppl.experimental.causal_inference.models.bart.bart_model import ( BART, XBART, ) @pyt...
beanmachine-main
tests/ppl/experimental/bart/bart_model_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist from beanmachine.ppl.experimental.gp import ( ...
beanmachine-main
tests/ppl/experimental/gp/models_test.py
# 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 import unittest import beanmachine.ppl as bm import gpytorch import torch from beanmachine.ppl.experimental.gp import ( bm_...
beanmachine-main
tests/ppl/experimental/gp/inference_test.py
beanmachine-main
tests/ppl/experimental/gp/__init__.py
# 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 pytest import torch.distributions as dist from beanmachine.ppl.world.utils import get_default_transforms, initialize_value def test...
beanmachine-main
tests/ppl/world/utils_test.py
# 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 beanmachine.ppl as bm import torch import torch.distributions as dist from beanmachine.ppl.world import World class SampleModel: ...
beanmachine-main
tests/ppl/world/world_test.py
beanmachine-main
tests/ppl/world/__init__.py
# 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 pytest import torch import torch.distributions as dist from beanmachine.ppl.world.initialize_fn import init_from_prior, init_to_unifo...
beanmachine-main
tests/ppl/world/initialize_fn_test.py
# 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 pytest import torch import torch.distributions as dist from beanmachine.ppl.world.variable import Variable def test_log_prob(): ...
beanmachine-main
tests/ppl/world/variable_test.py
# 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 unittest import torch from beanmachine.ppl.utils import tensorops class TensorOpsTest(unittest.TestCase): def test_gradients(s...
beanmachine-main
tests/ppl/utils/tensorops_test.py
# 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 unittest from beanmachine.ppl.utils.set_of_tensors import SetOfTensors from torch import tensor class SetOfTensorsTest(unittest.Te...
beanmachine-main
tests/ppl/utils/set_of_tensors_test.py
# 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 unittest from beanmachine.ppl.utils.multidictionary import MultiDictionary class MultiDictionaryTest(unittest.TestCase): def t...
beanmachine-main
tests/ppl/utils/multidictionary_test.py
beanmachine-main
tests/ppl/utils/__init__.py
# 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. """Tests for Graph from graph.py""" import unittest from beanmachine.ppl.utils.graph import Graph class SimpleNode(object): name: str...
beanmachine-main
tests/ppl/utils/graph_test.py
# 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. """Tests for item_counter.py""" import unittest from beanmachine.ppl.utils.item_counter import ItemCounter class ItemCounterTest(unittest...
beanmachine-main
tests/ppl/utils/item_counter_test.py
# 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. """Tests for print_tree from treeprinter.py""" import unittest from beanmachine.ppl.utils.treeprinter import print_tree class TreePrinter...
beanmachine-main
tests/ppl/utils/treeprinter_test.py
# 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. """Tests for memoize.py""" import unittest from beanmachine.ppl.utils.memoize import memoize count1 = 0 def fib(n): global count1 ...
beanmachine-main
tests/ppl/utils/memoize_test.py
# 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. """Tests for partition functions from equivalence.py""" import unittest from typing import Any, Iterable from beanmachine.ppl.utils.equival...
beanmachine-main
tests/ppl/utils/equivalence_test.py
# 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. """Tests for print_graph from dotbuilder.py""" import unittest from typing import Any, Dict from beanmachine.ppl.utils.dotbuilder import Do...
beanmachine-main
tests/ppl/utils/dotbuilder_test.py
beanmachine-main
tests/ppl/testlib/__init__.py
# 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. """Tests for hypothesis_testing.py""" import unittest from beanmachine.ppl.testlib.hypothesis_testing import ( inverse_chi2_cdf, in...
beanmachine-main
tests/ppl/testlib/hypothesis_testing_test.py
# 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 pickle import unittest import warnings import beanmachine.ppl as bm import torch import torch.distributions as dist import torch.uti...
beanmachine-main
tests/ppl/model/rv_identifier_test.py
beanmachine-main
tests/ppl/model/__init__.py
beanmachine-main
tests/ppl/diagnostics/__init__.py
# 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 unittest from typing import Dict import beanmachine.ppl as bm import beanmachine.ppl.diagnostics.common_statistics as common_statist...
beanmachine-main
tests/ppl/diagnostics/diagnostics_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_newtonian_monte_carlo_conjugate_test_nightly.py
# 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 pickle import unittest import beanmachine.ppl as bm import numpy as np import torch import torch.distributions as dist import xarray...
beanmachine-main
tests/ppl/inference/monte_carlo_samples_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_uniform_mh_conjugate_test_nightly.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_random_walk_adaptive_conjugate_test_nightly.py
# 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 beanmachine.ppl as bm import torch import torch.distributions as dist class SampleModel: @bm.random_variable def foo(self):...
beanmachine-main
tests/ppl/inference/single_site_ancestral_mh_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_no_u_turn_conjugate_test_nightly.py
# 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 beanmachine.ppl as bm import torch import torch.distributions as dist @bm.random_variable def foo(): return dist.Normal(0.0, 1....
beanmachine-main
tests/ppl/inference/utils_test.py
# 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 warnings import beanmachine.ppl as bm import pytest import torch import torch.distributions as dist class SampleModel: @bm.ran...
beanmachine-main
tests/ppl/inference/nnc_test.py
# 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 import sys import beanmachine.ppl as bm import pytest import torch import torch.distributions as dist from beanmachine.ppl.infe...
beanmachine-main
tests/ppl/inference/inference_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist class SingleSiteUniformMetropolisHastingsTes...
beanmachine-main
tests/ppl/inference/single_site_uniform_mh_test.py
# 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 itertools from typing import Optional import beanmachine.ppl as bm import numpy import pytest import scipy.stats import torch import...
beanmachine-main
tests/ppl/inference/vi_test.py
# 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 Optional import beanmachine.ppl as bm import pytest import torch import torch.distributions as dist from beanmachine.ppl...
beanmachine-main
tests/ppl/inference/vi_gpu_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist from beanmachine.ppl.examples.conjugate_models...
beanmachine-main
tests/ppl/inference/single_site_random_walk_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist class IntegrationTest(unittest.TestCase): ...
beanmachine-main
tests/ppl/inference/inference_integration_test_nightly.py
# 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 Counter from unittest.mock import patch import beanmachine.ppl as bm import pytest import torch import torch.distri...
beanmachine-main
tests/ppl/inference/compositional_infer_test.py
beanmachine-main
tests/ppl/inference/__init__.py
# 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 beanmachine.ppl as bm import torch import torch.distributions as dist class SampleModel: @bm.random_variable def foo(self):...
beanmachine-main
tests/ppl/inference/sampler_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_random_walk_conjugate_test_nightly.py
# 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 warnings import beanmachine.ppl as bm import pytest import torch import torch.distributions as dist @bm.random_variable def f(): ...
beanmachine-main
tests/ppl/inference/inference_error_reporting_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist class PredictiveTest(unittest.TestCase): ...
beanmachine-main
tests/ppl/inference/predictive_test.py
# 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 unittest from sys import float_info import torch.distributions as dist from beanmachine.ppl.testlib.hypothesis_testing import ( ...
beanmachine-main
tests/ppl/inference/hypothesis_testing_nightly.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist from beanmachine.ppl.inference import SingleS...
beanmachine-main
tests/ppl/inference/single_site_newtonian_monte_carlo_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_hamiltonian_monte_carlo_conjugate_test_nightly.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTests class SingleSi...
beanmachine-main
tests/ppl/inference/single_site_ancestral_mh_conjugate_test_nightly.py
# 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 unittest from beanmachine.ppl.inference.compositional_infer import CompositionalInference from beanmachine.ppl.testlib.abstract_conj...
beanmachine-main
tests/ppl/inference/compositional_infer_conjugate_test_nightly.py
# 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 beanmachine.ppl as bm import pytest import torch import torch.distributions as dist from beanmachine.ppl.inference.proposer.hmc_propo...
beanmachine-main
tests/ppl/inference/proposer/hmc_proposer_test.py
# 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. """Unit test for NormalEig class""" import unittest import torch from beanmachine.ppl.inference.proposer.normal_eig import NormalEig from t...
beanmachine-main
tests/ppl/inference/proposer/normal_eig_test.py
# 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 torch from beanmachine.ppl.inference.proposer.utils import DictToVecConverter def test_dict_to_vec_conversion(): d = {"a": torc...
beanmachine-main
tests/ppl/inference/proposer/utils_test.py
beanmachine-main
tests/ppl/inference/proposer/__init__.py
# 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 beanmachine.ppl as bm import pytest import torch import torch.distributions as dist from beanmachine.ppl.inference.proposer.nuts_prop...
beanmachine-main
tests/ppl/inference/proposer/nuts_proposer_test.py
# 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 warnings import beanmachine.ppl as bm import numpy as np import pytest import torch import torch.distributions as dist from beanmach...
beanmachine-main
tests/ppl/inference/proposer/hmc_utils_test.py
# 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 unittest import torch import torch.distributions as dist from beanmachine import ppl as bm from beanmachine.ppl.inference.proposer.n...
beanmachine-main
tests/ppl/inference/proposer/nmc/single_site_simplex_newtonian_monte_carlo_proposer_test.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.distributions as dist from beanmachine.ppl.inference.proposer.nmc im...
beanmachine-main
tests/ppl/inference/proposer/nmc/single_site_half_space_newtonian_monte_carlo_proposer_test.py
beanmachine-main
tests/ppl/inference/proposer/nmc/__init__.py
# 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 unittest import beanmachine.ppl as bm import torch import torch.autograd import torch.distributions as dist from beanmachine.ppl.inf...
beanmachine-main
tests/ppl/inference/proposer/nmc/single_site_real_space_newtonian_monte_carlo_proposer_test.py
# 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. """Tests for fix_problems.py""" import unittest from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder from beanmachine.ppl.c...
beanmachine-main
tests/ppl/compiler/fix_problems_test.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. # BM -> BMG compiler index tests import unittest import beanmachine.ppl as bm from beanmachine.ppl.inference.bmg_in...
beanmachine-main
tests/ppl/compiler/index_test.py
# 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. """End-to-end test for tutorial on GMM with Poisson number of components""" # This file is a manual replica of the Bento tutorial with the s...
beanmachine-main
tests/ppl/compiler/tutorial_GMM_with_2_dimensions_and_4_components_test.py
# 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. """Compare original and conjugate prior transformed Beta-Bernoulli model""" import unittest import beanmachine.ppl as bm from beanmachi...
beanmachine-main
tests/ppl/compiler/fix_beta_bernoulli_basic_test.py
# 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 platform import re import unittest import beanmachine.graph as graph import beanmachine.ppl as bm import beanmachine.ppl.compiler.pe...
beanmachine-main
tests/ppl/compiler/perf_report_test.py
# 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. """End-to-end test of realistic coin flip model""" import unittest import beanmachine.ppl as bm from beanmachine.ppl.inference.bmg_inferenc...
beanmachine-main
tests/ppl/compiler/coin_flip_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.inference.bmg_inference import BMGInference from torch.distributions impo...
beanmachine-main
tests/ppl/compiler/log_prob_test.py
# 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. """Tests for poisson distribution""" import unittest import beanmachine.ppl as bm from beanmachine.ppl.inference import BMGInference from...
beanmachine-main
tests/ppl/compiler/distribution_poisson_test.py
# 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. """A basic unit test for the Python interface of the BMG C++ Graph.infer method""" import unittest import beanmachine.ppl as bm from beanma...
beanmachine-main
tests/ppl/compiler/bmg_infer_interface_test.py
# 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. """End-to-end test for an example use of the normal distribution""" import logging import unittest import beanmachine.ppl as bm import tor...
beanmachine-main
tests/ppl/compiler/distribution_half_normal_test.py
# 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. """End-to-end test for an example use of the normal distribution""" import logging import unittest import beanmachine.ppl as bm import tor...
beanmachine-main
tests/ppl/compiler/distribution_normal_test.py
# 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. """Tests for ast_tools.py""" import ast import unittest import beanmachine.ppl.compiler.ast_tools as ast_tools class ASTToolsTest(unittes...
beanmachine-main
tests/ppl/compiler/ast_tools_test.py
# 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. """End-to-end test for 1D GMM with K > 2 number of components""" import logging import unittest # Comments after imports suggest alternati...
beanmachine-main
tests/ppl/compiler/tutorial_GMM_with_1_dimensions_and_4_components_test.py
# 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 unittest from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder from beanmachine.ppl.compiler.gen_bmg_cpp import to_bm...
beanmachine-main
tests/ppl/compiler/column_index_test.py
# 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 unittest import beanmachine.ppl.compiler.bmg_types as bt import torch from beanmachine.ppl.compiler.bm_graph_builder import BMGraphB...
beanmachine-main
tests/ppl/compiler/lattice_typer_test.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. # Suppose we have a mixture of k normal distributions each with standard # deviation equal to 1, but different means...
beanmachine-main
tests/ppl/compiler/gaussian_mixture_model_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.inference.bmg_inference import BMGInference from torch.distributions impo...
beanmachine-main
tests/ppl/compiler/to_probability_test.py
# 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 unittest import beanmachine.ppl as bm from beanmachine.ppl.compiler.copy_and_replace import copy_and_replace from beanmachine.ppl.c...
beanmachine-main
tests/ppl/compiler/devectorizer_transformer_test.py