python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
import logging
import os.path as osp
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
from torchvision import transforms
from torchvision.datasets.folder import defaul... | collaborative_image_understanding-main | src/dataset_utils.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import os.path as osp
from typing import List
import pandas as pd
import requests
from tqdm import tqdm
logger = logging.getLogger(__name__)
class DataHelper:
def __init__(self, is_debug: bool, is_... | collaborative_image_understanding-main | src/data_utils.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import os.path as osp
import time
from glob import glob
import hydra
import pandas as pd
import torch
from hydra.utils import get_original_cwd
from omegaconf import DictConfig, OmegaConf
from sklearn.metr... | collaborative_image_understanding-main | src/main_extract_embeddings.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import time
import os.path as osp
import hydra
import pytorch_lightning as pl
import torch
from hydra.utils import get_original_cwd
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import... | collaborative_image_understanding-main | src/train_model_with_cf_pretraining.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import os.path as osp
import time
from itertools import chain
import hydra
import numpy as np
import pandas as pd
from omegaconf import DictConfig
from sklearn.model_selection import train_test_split
from... | collaborative_image_understanding-main | src/main_process_labels_movielens.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import os.path as osp
import time
import cornac
import hydra
import pandas as pd
import torch
from cornac.eval_methods import RatioSplit
from cornac.metrics import AUC, MAP
from omegaconf import DictConfi... | collaborative_image_understanding-main | src/main_train_recommender.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os.path as osp
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from cornac.data import Reader
from cornac.models import VAECF
from cornac.models.re... | collaborative_image_understanding-main | src/recommender_utils.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import time
import hydra
import pytorch_lightning as pl
import torch
from hydra.utils import get_original_cwd
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import loggers as pl_logger... | collaborative_image_understanding-main | src/main_train_model.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import os
import os.path as osp
import hydra
import numpy as np
import pandas as pd
import scipy
from hydra.utils import get_original_cwd
from omegaconf import DictConfig, OmegaConf
from scipy.stats import ttest_re... | collaborative_image_understanding-main | src/eval_utils.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... | Aria_data_tools-main | src/setup.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... | Aria_data_tools-main | src/python/tutorials/DataProvider_ImageTimeline.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... | Aria_data_tools-main | src/python/tutorials/Sensors.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_hesbo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run benchmarks for Ensemble BO.
Requires installing EBO from https://github.com/zi-w/Ensemble-Bayesian-Optimization.
"""
import os
import... | ContextualBO-main | park_abr/run_park_ebo.py |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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
import numpy as np
import park
from ax.utils.common.logger import get_logger
NUM_RUNS... | ContextualBO-main | park_abr/fb_abr_problem.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run benchmarks for Add-GP-UCB.
Requires installing dragonfly-opt from pip. The experiments here used version
0.1.4.
"""
import cma
impor... | ContextualBO-main | park_abr/run_park_add_ucb.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_rembo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_sac.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run benchmarks for CMAES.
Requires installing cma from pip. The experiments here used version 2.7.0.
"""
import cma
import time
import j... | ContextualBO-main | park_abr/run_park_cma_es.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_alebo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_standard_bo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_non_contextual.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import json
import numpy as np
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbri... | ContextualBO-main | park_abr/run_park_lcea.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Run benchmarks for TuRBO.
Requires installing turbo from https://github.com/uber-research/TuRBO.
"""
import turbo
import time
import jso... | ContextualBO-main | park_abr/run_park_turbo.py |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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 Any, Dict, List, Optional, Type
import torch
from ax.core.data import Data
from ax.core.experiment ... | ContextualBO-main | park_abr/cbo_generation_strategy.py |
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
from park.envs import make
| ContextualBO-main | park_abr/park/__init__.py |
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
from park import logger
# Env-related abstractions
class Env(object):
"""
The main park class. The interface follows OpenAI gym
https://gym.openai.com, which encapsulates an environment with
arbitrary behind-th... | ContextualBO-main | park_abr/park/core.py |
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
import logging
def debug(msg):
logging.debug(msg)
def info(msg):
logging.info(msg)
def warn(msg):
logging.warning(msg)
def error(msg):
logging.error(msg)
def exception(msg, *args, **kwargs):
logging... | ContextualBO-main | park_abr/park/logger.py |
import numpy as np
from park import core, logger
from park.spaces.rng import np_random
class Box(core.Space):
"""
A box in R^n.
I.e., each coordinate is bounded.
Example usage:
self.action_space = spaces.Box(low=-10, high=10, shape=(1,))
"""
def __init__(self, low=None, high=None, struct=... | ContextualBO-main | park_abr/park/spaces/box.py |
import numpy as np
"""
Separate the random number generator from the environment.
This is used for all random sample in the space native methods.
We expect new algorithms to have their own rngs.
"""
np_random = np.random.RandomState()
np_random.seed(42)
| ContextualBO-main | park_abr/park/spaces/rng.py |
import numpy as np
from park import core
from park.spaces.rng import np_random
class Discrete(core.Space):
"""
{0,1,...,n-1}
Example usage:
self.observation_space = spaces.Discrete(2)
"""
def __init__(self, n):
self.n = n
core.Space.__init__(self, "tensor_int64", (), np.int64)... | ContextualBO-main | park_abr/park/spaces/discrete.py |
from park.spaces.box import Box
from park.spaces.discrete import Discrete
| ContextualBO-main | park_abr/park/spaces/__init__.py |
import numpy as np
def np_random(seed=42):
if not (isinstance(seed, int) and seed >= 0):
raise ValueError("Seed must be a non-negative integer.")
rng = np.random.RandomState()
rng.seed(seed)
return rng
| ContextualBO-main | park_abr/park/utils/seeding.py |
import os
def create_folder_if_not_exists(folder_path):
if not os.path.exists(folder_path):
os.makedirs(folder_path)
| ContextualBO-main | park_abr/park/utils/misc.py |
import networkx as nx
import numpy as np
class DirectedGraph(object):
def __init__(self, node_features=None, edge_features=None):
self.graph = nx.DiGraph()
if node_features is not None:
self.update_nodes(node_features)
if edge_features is not None:
self.update_edges... | ContextualBO-main | park_abr/park/utils/directed_graph.py |
def print_red(s):
print("\033[91m" + s + "\033[0m")
def print_orange(s):
print("\033[93m" + s + "\033[0m")
def print_green(s):
print("\033[92m" + s + "\033[0m")
def print_blue(s):
print("\034[92m" + s + "\033[0m")
| ContextualBO-main | park_abr/park/utils/colorful_print.py |
ContextualBO-main | park_abr/park/utils/__init__.py | |
from collections import OrderedDict
class OrderedSet(object):
def __init__(self, contents=()):
self.set = OrderedDict((c, None) for c in contents)
def __contains__(self, item):
return item in self.set
def __iter__(self):
return iter(self.set.keys())
def __len__(self):
... | ContextualBO-main | park_abr/park/utils/ordered_set.py |
# Format follows OpenAI gym https://gym.openai.com
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
def load(entry_point):
import pkg_resources # takes ~400ms to load, so we import it lazily
entry_point = pkg_resources.EntryPoint.parse("x={}".format(entry_point))
... | ContextualBO-main | park_abr/park/envs/registration.py |
# Format follows OpenAI gym https://gym.openai.com
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
from park.envs.registration import make, register
register(env_id="abr_sim_fb", entry_point="park.envs.abr_sim:ABRSimFBEnv")
| ContextualBO-main | park_abr/park/envs/__init__.py |
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
from collections import deque
import numpy as np
from ax.utils.common.logger import get_logger
from park import core, logger, spaces
from park.envs.abr_sim.trace_loader import (
get_chunk_time,
load_chunk_sizes,
loa... | ContextualBO-main | park_abr/park/envs/abr_sim/abr.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# A modification of the adaptive video streaming environment in https://github.com/park-project/park
from park.envs.abr_sim.abr_fb import ABRS... | ContextualBO-main | park_abr/park/envs/abr_sim/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# A modification of the adaptive video streaming environment in https://github.com/park-project/park
from collections import deque
import num... | ContextualBO-main | park_abr/park/envs/abr_sim/abr_fb.py |
# Folk of the adaptive video streaming environment in https://github.com/park-project/park
import os
import numpy as np
import park
def get_chunk_time(trace, t_idx):
if t_idx == len(trace[0]) - 1:
return 1 # bandwidth last for 1 second
else:
return trace[0][t_idx + 1] - trace[0][t_idx]
de... | ContextualBO-main | park_abr/park/envs/abr_sim/trace_loader.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# A modification of the adaptive video streaming environment in https://github.com/park-project/park
import json
import park
def get_chunk_... | ContextualBO-main | park_abr/park/envs/abr_sim/fb_trace_loader.py |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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 numpy as np
from ax.modelbridge.factory import get_GPEI, get_sobol
from ax.modelbridge.generation_... | ContextualBO-main | benchmarks/run_synthetic_benchmarks_agg_reward.py |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import json
from typing import Any, Dict, List, Optional
import numpy as np
from ax.core.parameter im... | ContextualBO-main | benchmarks/run_synthetic_benchmarks_multioutput_reward.py |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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 abc import ABC
from typing import Dict, List
import numpy as np
import torch
from ax.models.random.s... | ContextualBO-main | benchmarks/synthetic_problems.py |
# Copyright (c) Facebook, Inc. and its 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 Any, Dict, Optional
import numpy as np
from synthetic_problems import (
Branin1DEmbedding,
Branin2DBase,
Hartm... | ContextualBO-main | benchmarks/get_synthetic_problem.py |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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 Any, Dict, List, Optional, Type
import torch
from ax.core.data import Data
from ax.core.experiment... | ContextualBO-main | benchmarks/cbo_generation_strategy.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 scipy.spatial.transform import Rotation as R
import os
from glob import glob
from tqdm import tqdm
import scipy.io as sio
i... | 3D-Vision-and-Touch-main | data_loaders.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 torch
import time
import sys
sys.path.insert(0, "../")
from pytorch3d.loss import chamfer_distance as c... | 3D-Vision-and-Touch-main | utils.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 os
from tqdm import tqdm
interval = 1300
commands_to_run = []
for i in range(200):
commands_to_run ... | 3D-Vision-and-Touch-main | touch_charts/submit.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 os
import submitit
import argparse
import produce_sheets
parser = argparse.ArgumentParser()
parser.add_argument('--seed... | 3D-Vision-and-Touch-main | touch_charts/runner.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.nn as nn
import torch
import torch.nn.functional as F
# implemented from:
# https://github.com/MicrosoftLearning/d... | 3D-Vision-and-Touch-main | touch_charts/models.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 models
import os
import torch
import numpy as np
import torch.optim as optim
from torch.utils.data import DataLoader
from... | 3D-Vision-and-Touch-main | touch_charts/produce_sheets.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 models
from torch.utils.tensorboard import SummaryWriter
import torch
import numpy as np
import torch.optim as optim
impo... | 3D-Vision-and-Touch-main | touch_charts/recon.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 .chamfer_distance import ChamferDistance
| 3D-Vision-and-Touch-main | third_party_code/__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.
import torch
from torch.utils.cpp_extension import load
cd = load(name="cd",
sources=["../third_party_code/chamfer_dist... | 3D-Vision-and-Touch-main | third_party_code/chamfer_distance.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 os
from tqdm import tqdm
def call(command):
os.system(command)
param_namer = {'--seed': 'seed', '--n... | 3D-Vision-and-Touch-main | vision_charts/submit.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 os
import submitit
import argparse
import recon
parser = argparse.ArgumentParser()
parser.add_argument('--seed', type=i... | 3D-Vision-and-Touch-main | vision_charts/runner.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.nn as nn
import torch
import numpy as np
from torch.nn.parameter import Parameter
import torch.nn.functional as F
i... | 3D-Vision-and-Touch-main | vision_charts/models.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 os
import models
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch.autograd import Vari... | 3D-Vision-and-Touch-main | vision_charts/recon.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
# coding: utf-8
"""Dataset Loader for Memory Dialogs.
Author(s): noctli, skottur
(c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
"""
import json
import logging
import os
import pickle
import re
from itertools import cha... | comet_memory_dialog-main | models/gpt2_mm/dataset_memory.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import copy
import json
import logging
import random
import time
from argparse import ArgumentParser
from itertools import chain
import os
from pprint import pformat
import numpy as np
import torch
import torch.nn.functional as F
import tqdm
... | comet_memory_dialog-main | models/gpt2_mm/generate.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from transformers import *
import math
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
def gelu(x):
return (
0.5
* x
* (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch... | comet_memory_dialog-main | models/gpt2_mm/VideoGPT2.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
# coding: utf-8
# author: noctli
import json
import pickle
from itertools import chain
import numpy as np
import torch
import torch.utils.data
from torch.utils.data import Dataset
# from train import SPECIAL_TOKENS, MODEL_INPUTS, PADDED_INPUT... | comet_memory_dialog-main | models/gpt2_mm/dataset.py |
# Copyright (c) 2019-present, HuggingFace Inc.
# 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.
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
import json
import logging
import math
import os
f... | comet_memory_dialog-main | models/gpt2_mm/train.py |
#! /usr/bin/env python
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Create API and MM-DST result JSONS from model result file.
Author(s): Satwik Kottur
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import collections
import copy
... | comet_memory_dialog-main | models/gpt2_mm/utils/create_result_jsons.py |
#! /usr/bin/env python
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Extract BUTD features for memories.
Author(s): Satwik Kottur
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import base64
import json
import os
import pickle
im... | comet_memory_dialog-main | models/gpt2_mm/utils/extract_memory_features.py |
#! /usr/bin/env python
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Preprocess the memory dialog dataset.
Author(s): Satwik Kottur
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import json
import os
MM_CONTEXT = "<MM>"
START_AP... | comet_memory_dialog-main | models/gpt2_mm/utils/preprocess_memory_dataset.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#!/usr/bin/env python3
"""
Script for converting the main SIMMC datasets (.JSON format)
into the line-by-line stringified format (and back).
The reformatted data is used as input for the GPT-2 based
DST model baseline.
"""
import ... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/utils/convert.py |
#!/usr/bin/env python3
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "Lic... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/run_language_modeling.py |
#!/usr/bin/env python3
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Scripts for converting the main SIMMC datasets (.JSON format)
into the line-by-line stringified format (and back).
The reformatted data is used as input for the GPT-2 based
DST model baseline.
"""
from gpt... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/preprocess_input.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#!/usr/bin/env python3
"""
Scripts for evaluating the GPT-2 DST model predictions.
First, we parse the line-by-line stringified format into responses
and compute BLEU score.
"""
import argparse
import json
from gpt2_dst.utils.convert ... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/evaluate_response.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#! /usr/bin/env python
"""
Gets the best model given all the checkpoints.
Author(s): Satwik Kottur
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import re
def main(args):
f... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/get_best_model.py |
#!/usr/bin/env python3
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#
# Licensed under the Apache Lice... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/run_generation.py |
#!/usr/bin/env python3
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Scripts for evaluating the GPT-2 DST model predictions.
First, we parse the line-by-line stringified format into responses
and compute BLEU score.
"""
import argparse
import ast
import copy
import json
import... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/reformat_dst_response_outputs.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
#!/usr/bin/env python3
"""
Scripts for evaluating the GPT-2 DST model predictions.
First, we parse the line-by-line stringified format into
the structured DST output.
We then run the main DST Evaluation script to get results.
"""... | comet_memory_dialog-main | models/gpt2_text/gpt2_dst/scripts/evaluate.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
Script evaluates response generation using GT responses.
Expected JSON format:
[
"dialog_id": <dialog_id>,
"predictions": [
{
"turn_id": <turn_id>,
"response": <str; model output>,
}
...... | comet_memory_dialog-main | models/gpt2_text/utils/response_evaluation.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
# !/usr/bin/env python3
"""
Util functions for evaluating the DST model predictions.
The script includes a main function which takes
the original JSON data file and the predicted model output file
(in the same format), and outputs ... | comet_memory_dialog-main | models/gpt2_text/utils/evaluate_dst.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
"""
Description: merges the synthetically generated dialogs (.json, .p)
and the tab-separated Appen annotations (.txt)
to putput the merged dialogs in both .json and .p formats
"""
import os
import json
import... | comet_memory_dialog-main | dialog_simulator/merge_synth_and_appen.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import random
import numpy as np
from typing import List, Tuple
from SimulatorBase import SimulatorBase
from constants import GoalType, DialogAct, GoalMemoryRefType
from Data import MemoryDialog, Goal, GoalParameter, Fram... | comet_memory_dialog-main | dialog_simulator/UserSimulator.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from constants import API_CALL_TYPE, TurnSpeaker, DialogAct
from Data import Turn, Frame, ActAttributes, MemoryDialog, APIResponse, APIRequest
from typing import Dict, Tuple
import sys
sys.path.append("/Users/shanemoon/w... | comet_memory_dialog-main | dialog_simulator/MemoryDialogModel.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import json, random, traceback, os
from typing import List, Tuple
from constants import TurnSpeaker, DialogAct, API_STATUS
from Data import Dialog, MemoryDialog, MemoryGraph, Turn, Goal
from UserSimulator import PilotUser... | comet_memory_dialog-main | dialog_simulator/MemoryDialogSimulator.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import random
import json
from MemoryDialogModel import PilotMemoryDialogModel
from Data import MemoryGraph, MemoryDialog, Turn
from MemoryServiceAPI import MemoryServiceAPI
import sys
sys.path.append("/Users/shanemoon/... | comet_memory_dialog-main | dialog_simulator/InteractiveDialogHandler.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
"""
Merges multiple batches of SIMMC 2.0 files into one,
and also outputs train, dev, devtest, and test sets.
"""
import os
import json
import csv
import random
import pickle
import numpy as np
from utils import l... | comet_memory_dialog-main | dialog_simulator/get_user_utterances.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from enum import Enum
class GoalType(Enum):
UNKNOWN = "unknown"
SEARCH = "search"
REFINE_SEARCH = "refine_search"
GET_RELATED = "get_related"
GET_INFO = "get_info"
GET_AGGREGATED_INFO = "get_aggr... | comet_memory_dialog-main | dialog_simulator/constants.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from constants import API_CALL_TYPE, TurnSpeaker, DialogAct
from Data import Turn, Frame, ActAttributes, MemoryDialog, APIResponse, APIRequest
from typing import Dict, Tuple
class DummyMemoryDialogModel(MemoryDialogModel... | comet_memory_dialog-main | dialog_simulator/DummyMemoryDialogModel.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
"""
Merges multiple batches of SIMMC 2.0 files into one,
and also outputs train, dev, devtest, and test sets.
"""
import os
import json
import csv
import random
import pickle
import numpy as np
from utils import l... | comet_memory_dialog-main | dialog_simulator/merge_data_json.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from constants import visual_slots, all_slots
import random
random.seed(0)
def build_parameter_ontology(memory_graph, metadata, domain=None, ontology=None):
if ontology is None:
ontology = {
"v... | comet_memory_dialog-main | dialog_simulator/utils.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import random
from typing import List, Tuple
from SimulatorBase import SimulatorBase
from constants import GoalType, DialogAct, API_STATUS, API_CALL_TYPE
from Data import (
MemoryDialog,
Goal,
Frame,
ActAt... | comet_memory_dialog-main | dialog_simulator/AssistantSimulator.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import os
import copy
import json
import csv
import random
import pickle
from MemoryDialogSimulator import MemoryDialogSimulator
from UserSimulator import PilotUserSimulator
from AssistantSimulator import PilotAssistantSi... | comet_memory_dialog-main | dialog_simulator/main.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import random
from constants import (
GoalType,
GoalMemoryRefType,
numeric_slots,
non_visual_slots,
visual_slots,
all_slots,
)
from Data import Goal, GoalParameter, MemoryTime
from utils import wei... | comet_memory_dialog-main | dialog_simulator/GoalGenerator.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from Data import MemoryDialog, Goal, Frame
from typing import List
class SimulatorBase:
def register_memory_service_api(self, memory_service_api):
self.memory_service_api = memory_service_api
def fit_go... | comet_memory_dialog-main | dialog_simulator/SimulatorBase.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
from __future__ import annotations
from constants import GoalType, GoalMemoryRefType, DialogAct
from utils import str_memories, int_memory_ids, get_slot_values_simple_from_json
import pickle
from datetime import datetime
... | comet_memory_dialog-main | dialog_simulator/Data.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#!/usr/bin/env python3
import random
from typing import Dict, Tuple
from Data import APIRequest, APIResponse, MemoryTime, MemoryLocation
from constants import API_CALL_TYPE, API_STATUS, GoalType
from utils import str_memory
from datetime import... | comet_memory_dialog-main | dialog_simulator/MemoryServiceAPI.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
from setuptools import setup, find_packages
setup(name='cmr', version='1.0', packages=find_packages()) | CMR-main | setup.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# %%
import json
import argparse
import pandas as pd
from argparse import Namespace
import numpy as np
import glob, os
from pandas.core import base
os.chdir("/private/home/yuchenlin/SemanticDebugger")
base_dir = "experiments/results/qa/"
... | CMR-main | experiments/report_results.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
import pandas as pd
import os
import glob
from io import StringIO
import altair as alt
from torch import clamp
from cmr.notebooks.draw_utils import draw_grouped_bars
# os.chdir()
# os.makedirs("csvs/", exist_ok=True)
# result_files = []
al... | CMR-main | experiments/bakcup/report_all_settings.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.