python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# 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 glob
import shutil
import subprocess
from tqdm import tqdm
from pathlib import Path
def main():
impor... | av_hubert-main | avhubert/preparation/vox_manifest.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 transformers import BertModel, BertTokenizer
import torch
from typing import List, Optional, Tuple, Union
import to... | care-main | care_bert.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 re
import lexicon_filtering
import nltk
import string
from typing import List, Dict, Tuple
tokenizer = nltk.data.... | care-main | regex_pipeline.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 json
from functools import partial
import requests
import pandas as pd
import os
from typing import Dict, List
im... | care-main | download_posts.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 regex_pipeline
from typing import Dict, List
from collections import Counter
import pandas as pd
import utils
# ... | care-main | care_predict.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 Dict
# Clustering into seven affective responses.
CLUSTER_MAP = {
"disgusted": "angered",
"s... | care-main | utils.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 List, Tuple, Dict
# Map of keyword in the CARE lexicon to pattern combinations that are prohibited.
... | care-main | lexicon_filtering.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 setuptools import setup, find_packages
with open('README.md', 'r') as f:
long_description = f.read()
with ope... | access-main | setup.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 functools import wraps
import multiprocessing
import random
import re
from joblib import Parallel, delayed
import t... | access-main | access/preprocess.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 functools import wraps
from pathlib import Path
import shutil
import tempfile
from imohash import hashfile
from ac... | access-main | access/simplifiers.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 functools import lru_cache
import Levenshtein
import numpy as np
from access.resources.paths import FASTTEXT_EMBED... | access-main | access/feature_extraction.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 abc import ABC
from functools import wraps, lru_cache
import hashlib
from pathlib import Path
import dill as pickle
... | access-main | access/preprocessors.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 functools import lru_cache
import re
from string import punctuation
from nltk.tokenize.nist import NISTTokenizer
fr... | access-main | access/text.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 itertools import product
from pathlib import Path
REPO_DIR = Path(__file__).resolve().parent.parent.parent
EXP_DIR ... | access-main | access/resources/paths.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 hashlib
from pathlib import Path
from access.preprocess import get_parallel_file_pair_preprocessor
from access.pr... | access-main | access/resources/datasets.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 bz2
import gzip
import os
from pathlib import Path
import shutil
import sys
import tarfile
import tempfile
import ... | access-main | access/resources/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.
#
from glob import glob
import os
from pathlib import Path
import shutil
import tempfile
import numpy as np
from access.t... | access-main | access/resources/prepare.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 collections import defaultdict
from functools import lru_cache
import shutil
from nevergrad.instrumentation import ... | access-main | access/fairseq/main.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 collections import defaultdict
import os
from pathlib import Path
import random
import re
import shutil
import tempf... | access-main | access/fairseq/base.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 contextlib import contextmanager, AbstractContextManager
from fcntl import flock, LOCK_EX, LOCK_UN
import inspect
im... | access-main | access/utils/helpers.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.
#
# TODO: Move to utils/training.py
from functools import wraps
import time
def print_method_name(func):
'''Decorator... | access-main | access/utils/training.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 access.utils.helpers import harmonic_mean
# Tranforms take a value and cast it to a score between 0 and 1, the hig... | access-main | access/evaluation/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.
#
from easse.cli import evaluate_system_output
from access.preprocess import lowercase_file, to_lrb_rrb_file
from access.r... | access-main | access/evaluation/general.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 fileinput
from access.preprocessors import get_preprocessors
from access.resources.prepare import prepare_models
... | access-main | scripts/generate.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 access.fairseq.main import fairseq_train_and_evaluate
from access.resources.prepare import prepare_wikilarge, prepar... | access-main | scripts/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.
#
from access.evaluation.general import evaluate_simplifier_on_turkcorpus
from access.preprocessors import get_preprocessor... | access-main | scripts/evaluate.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 click
from covid19_spread.data.usa import us_recurring
@click.group()
def cli():
pass
REGION... | covid19_spread-main | recurring.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 click
from covid19_spread.data.usa.convert import main as us_convert, SOURCES as US_SOURCES
import ... | covid19_spread-main | prepare_data.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 setuptools import setup, find_packages
setup(
name="covid19_spread",
version="0.1",
py_mo... | covid19_spread-main | setup.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 copy
import click
import importlib
import itertools
import json
import pandas as pd
import os
impor... | covid19_spread-main | cv.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 covid19_spread.bar import BARCV
import yaml
from argparse import Namespace
import torch as th
class... | covid19_spread-main | tests/test_batched_bar_inference.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 cv
import pandas as pd
from click.testing import CliRunner
import pytest
class TestCV:
def tes... | covid19_spread-main | tests/test_cv.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 covid19_spread import load
import pandas as pd
import pytest
DATA_PATH_US_CSV = "covid19_spread/data... | covid19_spread-main | tests/test_load.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import pandas as pd
from datetime import timedelta
def load_ground_truth(path):
df... | covid19_spread-main | covid19_spread/metrics.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas as pd
from .cross_val import CV
from . import load
from datetime import timedelta
def simu... | covid19_spread-main | covid19_spread/naive.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import pandas as pd
from numpy.linalg import norm
import os
import re
from covid19_sprea... | covid19_spread-main | covid19_spread/common.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import pandas as pd
import warnings
from datetime import timedelta
impo... | covid19_spread-main | covid19_spread/bar.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas as pd
import torch as th
import yaml
from pathlib import Path
import json
import os
def loa... | covid19_spread-main | covid19_spread/load.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 typing import Dict, Any, List, Tuple
import pandas as pd
from datetime import timedelta
import torch a... | covid19_spread-main | covid19_spread/cross_val.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 click
class DefaultGroup(click.Group):
ignore_unknown_options = True
def __init__(self, ... | covid19_spread-main | covid19_spread/lib/click_lib.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import submitit
from submitit.slurm.slurm import SlurmExecutor, SlurmJob
from submitit... | covid19_spread-main | covid19_spread/lib/slurm_pool_executor.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 contextlib
import os
import copy
import sys
import typing as tp
@contextlib.contextmanager
def en... | covid19_spread-main | covid19_spread/lib/context_managers.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 os
import getpass
USER = getpass.getuser()
if os.path.exists(f"/checkpoint"):
FS = "/checkpoi... | covid19_spread-main | covid19_spread/lib/cluster.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 slack import WebClient
import os
import json
import warnings
def post_slack_message(channel, text):... | covid19_spread-main | covid19_spread/lib/slack.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))... | covid19_spread-main | covid19_spread/data/recurring.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 os
from covid19_spread.common import update_repo
import pandas
import re
import datetime
def get_... | covid19_spread-main | covid19_spread/data/usa/process_cases.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import pandas as pd
import torch as th
from os import listdir
from os.p... | covid19_spread-main | covid19_spread/data/usa/convert.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 os
from .. import recurring
import pandas
from ...lib.slack import post_slack_message
from datetime... | covid19_spread-main | covid19_spread/data/usa/us_recurring.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas as pd
from datetime import datetime
from covid19_spread.data.usa.process_cases import get_in... | covid19_spread-main | covid19_spread/data/usa/google/process_mobility.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas
from datetime import datetime
import os
from covid19_spread.data.usa.process_cases import get... | covid19_spread-main | covid19_spread/data/usa/google/process_open_data.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 .process_mobility import main as mobility_main
from .process_open_data import main as open_data_main
... | covid19_spread-main | covid19_spread/data/usa/google/__init__.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 numpy as np
import pandas as pd
from hdx.api.configuration import Configuration
from hdx.data.datas... | covid19_spread-main | covid19_spread/data/usa/fb/process_mobility.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 .process_mobility import main
def prepare():
main()
| covid19_spread-main | covid19_spread/data/usa/fb/__init__.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 .process_testing import main
def prepare():
main()
| covid19_spread-main | covid19_spread/data/usa/testing/__init__.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas as pd
from datetime import datetime
import os
from covid19_spread.data.usa.process_cases imp... | covid19_spread-main | covid19_spread/data/usa/testing/process_testing.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 os
import pandas as pd
import sys
from datetime import timedelta
from delphi_epidata import Epidata... | covid19_spread-main | covid19_spread/data/usa/symptom_survey/fetch.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 pandas as pd
import argparse
from datetime import datetime
import os
from covid19_spread.data.usa.p... | covid19_spread-main | covid19_spread/data/usa/symptom_survey/process_symptom_survey.py |
#!/usr/bin/env python3
# Copyright (c) 2021-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 covid19_spread.data.usa.symptom_survey.fetch import main as fetch, SIGNALS
from covid19_spread.data.us... | covid19_spread-main | covid19_spread/data/usa/symptom_survey/__init__.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.