python_code stringlengths 0 1.02M | repo_name stringlengths 9 48 | file_path stringlengths 5 114 |
|---|---|---|
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/eraser_multi_rc/eraser_multi_rc.py |
from __future__ import absolute_import, division, print_function
import csv
import os
import nlp
_CITATION = """\
@article{go2009twitter,
title={Twitter sentiment classification using distant supervision},
author={Go, Alec and Bhayani, Richa and Huang, Lei},
journal={CS224N project report, Stanford},
volume... | nlp-master | datasets/sentiment140/sentiment140.py |
"""TODO(wiqa): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(wiqa): BibTeX citation
_CITATION = """\
@article{wiqa,
author = {Niket Tandon and Bhavana Dalvi Mishra and Keisuke Sakaguchi and Antoine Bosselut and Peter Cla... | nlp-master | datasets/wiqa/wiqa.py |
"""TODO(cornell_movie_dialog): Add a description here."""
from __future__ import absolute_import, division, print_function
import ast
import csv
import os
import nlp
# TODO(cornell_movie_dialog): BibTeX citation
_CITATION = """\
@InProceedings{Danescu-Niculescu-Mizil+Lee:11a,
author={Cristian Danescu-Niculesc... | nlp-master | datasets/cornell_movie_dialog/cornell_movie_dialog.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/imdb/imdb.py |
"""TODO(mlqa): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(mlqa): BibTeX citation
_CITATION = """\
@article{lewis2019mlqa,
title={MLQA: Evaluating Cross-lingual Extractive Question Answering},
author={Lewis, Patrick and Ogu... | nlp-master | datasets/mlqa/mlqa.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/reddit/reddit.py |
"""TODO(race): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(race): BibTeX citation
_CITATION = """\
@article{lai2017large,
title={RACE: Large-scale ReAding Comprehension Dataset From Examinations},
author={Lai, Guokun an... | nlp-master | datasets/race/race.py |
"""TODO(coqa): Add a description here."""
from __future__ import absolute_import, division, print_function
import csv
import json
import os
import nlp
# TODO(coqa): BibTeX citation
_CITATION = """\
@InProceedings{SivaAndAl:Coca,
author = {Siva, Reddy and Danqi, Chen and Christopher D., Manning},
ti... | nlp-master | datasets/coqa/coqa.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/definite_pronoun_resolution/definite_pronoun_resolution.py |
"""TODO(fquad): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(fquad): BibTeX citation
_CITATION = """\
@ARTICLE{2020arXiv200206071
author = {Martin, d'Hoffschmidt and Maxime, Vidal and
Wacim, Belblidia and Tom, Br... | nlp-master | datasets/fquad/fquad.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/ted_multi/ted_multi.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/wikihow/wikihow.py |
# coding=utf-8
# Copyright 2020 HuggingFace NLP Authors.
#
# 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 l... | nlp-master | datasets/wnut_17/wnut_17.py |
"""TODO(wikitext): Add a description here."""
from __future__ import absolute_import, division, print_function
import os
import nlp
# TODO(wikitext): BibTeX citation
_CITATION = """\
@InProceedings{wikitext,
author={Stephen, Merity and Caiming ,Xiong and James, Bradbury and Richard Socher}
year={2016}
}
""... | nlp-master | datasets/wikitext/wikitext.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/opinosis/opinosis.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/para_crawl/para_crawl.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/c4/c4.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/c4/c4_utils.py |
"""TODO(quartz): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(quartz): BibTeX citation
_CITATION = """\
@InProceedings{quartz,
author = {Oyvind Tafjord and Matt Gardner and Kevin Lin and Peter Clark},
title = {"QUARTZ: An Op... | nlp-master | datasets/quartz/quartz.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/lm1b/lm1b.py |
"""TODO(hellaswag): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(hellaswag): BibTeX citation
_CITATION = """\
@inproceedings{zellers2019hellaswag,
title={HellaSwag: Can a Machine Really Finish Your Sentence?},
author={Ze... | nlp-master | datasets/hellaswag/hellaswag.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/reddit_tifu/reddit_tifu.py |
import json
import logging
import math
import nlp
_CITATION = """\
@ONLINE {wikidump,
author = {Wikimedia Foundation},
title = {Wikimedia Downloads},
url = {https://dumps.wikimedia.org}
}
"""
_DESCRIPTION = """\
Wikipedia version split into plain text snippets for dense semantic indexing.
"""
_LICE... | nlp-master | datasets/wiki_snippets/wiki_snippets.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/math_dataset/math_dataset.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/multi_news/multi_news.py |
"""TODO(hansards): Add a description here."""
from __future__ import absolute_import, division, print_function
import glob
import os
import nlp
# TODO(hansards): BibTeX citation
_CITATION = """
"""
# TODO(hansards):
_DESCRIPTION = """
This release contains 1.3 million pairs of aligned text chunks (sentences or sm... | nlp-master | datasets/hansards/hansards.py |
"""TODO(squad_es): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(squad_es): BibTeX citation
_CITATION = """\
@article{2016arXiv160605250R,
author = {Casimiro Pio , Carrino and Marta R. , Costa-jussa and Jose A. R. , Fono... | nlp-master | datasets/squad_es/squad_es.py |
"""TODO(scifact): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(scifact): BibTeX citation
_CITATION = """\
@inproceedings{scifact2020
title={ Fact or Fiction: Verifying Scientific Claims},
author={David, Wadden and Kyle, Lo ... | nlp-master | datasets/scifact/scifact.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/aeslc/aeslc.py |
from __future__ import absolute_import, division, print_function
import nlp
_DESCRIPTION = """\
"""
_URL = "https://www.gutenberg.org/files/2554/2554-h/2554-h.htm"
_DATA_URL = "https://raw.githubusercontent.com/patrickvonplaten/datasets/master/crime_and_punishment.txt"
class CrimeAndPunishConfig(nlp.BuilderConfig... | nlp-master | datasets/crime_and_punish/crime_and_punish.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/billsum/billsum.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/esnli/esnli.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace NLP Authors.
#
# 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... | nlp-master | datasets/cfq/cfq.py |
"""TODO(commonsense_qa): Add a description here."""
from __future__ import absolute_import, division, print_function
import json
import os
import nlp
# TODO(commonsense_qa): BibTeX citation
_CITATION = """\
@InProceedings{commonsense_QA,
title={COMMONSENSEQA: A Question Answering Challenge Targeting Commonsense Kn... | nlp-master | datasets/commonsense_qa/commonsense_qa.py |
import os
import tempfile
from unittest import TestCase
import numpy as np
import pyarrow as pa
from nlp.arrow_reader import BaseReader
from nlp.info import DatasetInfo
from nlp.splits import SplitDict, SplitInfo
class ReaderTester(BaseReader):
"""
Build a Dataset object out of Instruction instance(s).
... | nlp-master | tests/test_arrow_dataset.py |
nlp-master | tests/__init__.py | |
# coding=utf-8
# Copyright 2020 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | nlp-master | tests/test_dataset_common.py |
import os
import unittest
from distutils.util import strtobool
def parse_flag_from_env(key, default=False):
try:
value = os.environ[key]
except KeyError:
# KEY isn't set, default to `default`.
_value = default
else:
# KEY is set, convert it to True or False.
try:
... | nlp-master | tests/utils.py |
from unittest import TestCase
import pyarrow as pa
from nlp.arrow_reader import BaseReader
from nlp.info import DatasetInfo
from nlp.splits import SplitDict, SplitInfo
class ReaderTest(BaseReader):
"""
Build a Dataset object out of Instruction instance(s).
This reader is made for testing. It mocks file ... | nlp-master | tests/test_arrow_reader.py |
import os
import tempfile
from unittest import TestCase
import apache_beam as beam
import nlp
class DummyBeamDataset(nlp.BeamBasedBuilder):
"""Dummy beam dataset."""
def _info(self):
return nlp.DatasetInfo(
features=nlp.Features({"content": nlp.Value("string")}),
# No defaul... | nlp-master | tests/test_beam.py |
from unittest import TestCase
from nlp.utils.py_utils import (
flatten_nest_dict,
flatten_nested,
map_nested,
temporary_assignment,
zip_dict,
zip_nested,
)
class PyUtilsTest(TestCase):
def test_flatten_nest_dict(self):
d1 = {}
d2 = {"a": 1, "b": 2}
d3 = {"a": {"1":... | nlp-master | tests/utils/test_py_utils.py |
# coding=utf-8
# Copyright 2020 The HuggingFace Authors.
#
# 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 l... | nlp-master | src/nlp/arrow_dataset.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/naming.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/arrow_writer.py |
# flake8: noqa
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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/l... | nlp-master | src/nlp/__init__.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/arrow_reader.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/features.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/builder.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors
#
# 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 applicabl... | nlp-master | src/nlp/metric.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors.
#
# 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 applicab... | nlp-master | src/nlp/inspect.py |
# coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team.
#
# 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 a... | nlp-master | src/nlp/hf_api.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/splits.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/load.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/info.py |
nlp-master | src/nlp/metrics/__init__.py | |
nlp-master | src/nlp/datasets/__init__.py | |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/utils/version.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | nlp-master | src/nlp/utils/mock_download_manager.py |
import logging
import os
import pyarrow as pa
import pyarrow.parquet as pq
from apache_beam.io import filebasedsink
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.filesystems import FileSystems
from apache_beam.io.iobase import Write
from apache_beam.pipeline import Pipeline
from apache_bea... | nlp-master | src/nlp/utils/beam_utils.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/utils/__init__.py |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | nlp-master | src/nlp/utils/download_manager.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/utils/py_utils.py |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP Authors and the TensorFlow Datasets Authors.
#
# 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... | nlp-master | src/nlp/utils/tqdm_utils.py |
"""
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import gzip
import json
import logging
import os
import shutil
import sys
import tarfile
import tempfile
from contextlib import contextman... | nlp-master | src/nlp/utils/file_utils.py |
import logging
import os
from hashlib import sha256
from typing import Optional
logger = logging.getLogger(__name__)
class ChecksumVerificationException(Exception):
"""Exceptions during checksums verifications of downloaded files."""
class UnexpectedDownloadedFile(ChecksumVerificationException):
"""Some d... | nlp-master | src/nlp/utils/info_utils.py |
import logging
import os
from argparse import ArgumentParser
from nlp.commands import BaseTransformersCLICommand
from nlp.load import import_main_class, prepare_module
from nlp.utils import MockDownloadManager
logger = logging.getLogger(__name__)
def test_command_factory(args):
return DummyDataCommand(args.pat... | nlp-master | src/nlp/commands/dummy_data.py |
import os
import sys
from argparse import ArgumentParser
from getpass import getpass
from typing import List, Union
from requests.exceptions import HTTPError
from nlp.commands import BaseTransformersCLICommand
from nlp.hf_api import HfApi, HfFolder
UPLOAD_MAX_FILES = 15
class UserCommands(BaseTransformersCLIComma... | nlp-master | src/nlp/commands/user.py |
import os
from argparse import ArgumentParser
from shutil import copyfile
from typing import List
from nlp.builder import FORCE_REDOWNLOAD, HF_DATASETS_CACHE, REUSE_CACHE_IF_EXISTS, DatasetBuilder, DownloadConfig
from nlp.commands import BaseTransformersCLICommand
from nlp.info import DATASET_INFOS_DICT_FILE_NAME
from... | nlp-master | src/nlp/commands/run_beam.py |
import platform
from argparse import ArgumentParser
from nlp import __version__ as version
from nlp import is_tf_available, is_torch_available
from nlp.commands import BaseTransformersCLICommand
def info_command_factory(_):
return EnvironmentCommand()
class EnvironmentCommand(BaseTransformersCLICommand):
@... | nlp-master | src/nlp/commands/env.py |
from argparse import ArgumentParser
from nlp.commands import BaseTransformersCLICommand
def download_command_factory(args):
return DownloadCommand(args.model, args.cache_dir, args.force)
class DownloadCommand(BaseTransformersCLICommand):
@staticmethod
def register_subcommand(parser: ArgumentParser):
... | nlp-master | src/nlp/commands/download.py |
import os
import re
import shutil
from argparse import ArgumentParser, Namespace
from logging import getLogger
from nlp.commands import BaseTransformersCLICommand
HIGHLIGHT_MESSAGE_PRE = """<<<<<<< This should probably be modified because it mentions: """
HIGHLIGHT_MESSAGE_POST = """=======
>>>>>>>
"""
TO_HIGHLIGH... | nlp-master | src/nlp/commands/convert.py |
from abc import ABC, abstractmethod
from argparse import ArgumentParser
class BaseTransformersCLICommand(ABC):
@staticmethod
@abstractmethod
def register_subcommand(parser: ArgumentParser):
raise NotImplementedError()
@abstractmethod
def run(self):
raise NotImplementedError()
| nlp-master | src/nlp/commands/__init__.py |
import os
from argparse import ArgumentParser
from shutil import copyfile
from typing import List
from nlp.builder import FORCE_REDOWNLOAD, REUSE_CACHE_IF_EXISTS, DatasetBuilder, DownloadConfig
from nlp.commands import BaseTransformersCLICommand
from nlp.info import DATASET_INFOS_DICT_FILE_NAME
from nlp.load import im... | nlp-master | src/nlp/commands/test.py |
from setuptools import setup, find_packages
setup(
name = 'video-diffusion-pytorch',
packages = find_packages(exclude=[]),
version = '0.6.0',
license='MIT',
description = 'Video Diffusion - Pytorch',
long_description_content_type = 'text/markdown',
author = 'Phil Wang',
author_email = 'lucidrains@gmail... | video-diffusion-pytorch-main | setup.py |
from video_diffusion_pytorch.video_diffusion_pytorch import Unet3D, GaussianDiffusion, Trainer | video-diffusion-pytorch-main | video_diffusion_pytorch/__init__.py |
import math
import copy
import torch
from torch import nn, einsum
import torch.nn.functional as F
from functools import partial
from torch.utils import data
from pathlib import Path
from torch.optim import Adam
from torchvision import transforms as T, utils
from torch.cuda.amp import autocast, GradScaler
from PIL impo... | video-diffusion-pytorch-main | video_diffusion_pytorch/video_diffusion_pytorch.py |
import torch
from einops import rearrange
def exists(val):
return val is not None
# singleton globals
MODEL = None
TOKENIZER = None
BERT_MODEL_DIM = 768
def get_tokenizer():
global TOKENIZER
if not exists(TOKENIZER):
TOKENIZER = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', 'be... | video-diffusion-pytorch-main | video_diffusion_pytorch/text.py |
from setuptools import setup, find_packages
setup(
name = 'mlp-mixer-pytorch',
packages = find_packages(exclude=[]),
version = '0.1.1',
license='MIT',
description = 'MLP Mixer - Pytorch',
author = 'Phil Wang',
author_email = 'lucidrains@gmail.com',
url = 'https://github.com/lucidrains/mlp-mixer-pytorch... | mlp-mixer-pytorch-main | setup.py |
from mlp_mixer_pytorch.mlp_mixer_pytorch import MLPMixer
from mlp_mixer_pytorch.permutator import Permutator
| mlp-mixer-pytorch-main | mlp_mixer_pytorch/__init__.py |
from torch import nn
from functools import partial
from einops.layers.torch import Rearrange, Reduce
pair = lambda x: x if isinstance(x, tuple) else (x, x)
class PreNormResidual(nn.Module):
def __init__(self, dim, fn):
super().__init__()
self.fn = fn
self.norm = nn.LayerNorm(dim)
def ... | mlp-mixer-pytorch-main | mlp_mixer_pytorch/mlp_mixer_pytorch.py |
from torch import nn
from functools import partial
from einops.layers.torch import Rearrange, Reduce
class PreNormResidual(nn.Module):
def __init__(self, dim, fn):
super().__init__()
self.fn = fn
self.norm = nn.LayerNorm(dim)
def forward(self, x):
return self.fn(self.norm(x)) +... | mlp-mixer-pytorch-main | mlp_mixer_pytorch/permutator.py |
from setuptools import setup, find_packages
setup(
name = 'robotic-transformer-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.17',
license='MIT',
description = 'Robotic Transformer - Pytorch',
author = 'Phil Wang',
author_email = 'lucidrains@gmail.com',
long_description_content_type = '... | robotic-transformer-pytorch-main | setup.py |
import torch
import torch.nn.functional as F
from torch import nn, einsum
from typing import List, Optional, Callable, Tuple
from beartype import beartype
from einops import pack, unpack, repeat, reduce, rearrange
from einops.layers.torch import Rearrange, Reduce
from functools import partial
from classifier_free_g... | robotic-transformer-pytorch-main | robotic_transformer_pytorch/robotic_transformer_pytorch.py |
from robotic_transformer_pytorch.robotic_transformer_pytorch import RT1, TokenLearner, MaxViT
| robotic-transformer-pytorch-main | robotic_transformer_pytorch/__init__.py |
from setuptools import setup, find_packages
setup(
name = 'memory_compressed_attention',
packages = find_packages(),
version = '0.0.7',
license='MIT',
description = 'Memory-Compressed Self Attention',
long_description_content_type = 'text/markdown',
author = 'Phil Wang',
author_email = 'lucidrains@gmai... | memory-compressed-attention-master | setup.py |
from memory_compressed_attention.memory_compressed_attention import MemoryCompressedAttention
| memory-compressed-attention-master | memory_compressed_attention/__init__.py |
import torch
from torch import nn
import torch.nn.functional as F
# convolutional compression class
class ConvCompress(nn.Module):
def __init__(self, dim, ratio = 3, groups = 1):
super().__init__()
self.conv = nn.Conv1d(dim, dim, ratio, stride = ratio, groups = groups)
def forward(self, mem):... | memory-compressed-attention-master | memory_compressed_attention/memory_compressed_attention.py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pipenv install twine --dev
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = 'raveforce'
DESCRIPTION = 'An Ope... | RaveForce-main | setup.py |
from wasmer import engine, Store, Module, Instance, Memory, ImportObject, Function, FunctionType, Type
from wasmer_compiler_cranelift import Compiler
from urllib.request import urlopen
import numpy as np
import sys
import datetime
import struct, random
def make(code="", target=[], total_step=16, step_len=0.125, criter... | RaveForce-main | raveforce/__init__.py |
from setuptools import setup, find_packages
setup(
name = 'conformer',
packages = find_packages(),
version = '0.3.2',
license='MIT',
description = 'The convolutional module from the Conformer paper',
author = 'Phil Wang',
author_email = 'lucidrains@gmail.com',
url = 'https://github.com/lucidrains/confo... | conformer-master | setup.py |
from conformer.conformer import ConformerConvModule, ConformerBlock, Conformer
| conformer-master | conformer/__init__.py |
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange
from einops.layers.torch import Rearrange
# helper functions
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def calc_same_padding(kernel_size):
pad = ker... | conformer-master | conformer/conformer.py |
from tqdm import tqdm
import sidechainnet as scn
from ddpm_proteins.utils import get_msa_attention_embeddings, get_msa_transformer
# sidechainnet data
data = scn.load(
casp_version = 12,
thinning = 30,
with_pytorch = 'dataloaders',
batch_size = 1,
dynamic_batching = False
)
# constants
LENGTH_TH... | ddpm-proteins-main | cache.py |
from setuptools import setup, find_packages
setup(
name = 'ddpm-proteins',
packages = find_packages(),
version = '0.0.11',
license='MIT',
description = 'Denoising Diffusion Probabilistic Models - for Proteins - Pytorch',
author = 'Phil Wang',
author_email = 'lucidrains@gmail.com',
url = 'https://github... | ddpm-proteins-main | setup.py |
import os
import torch
import sidechainnet as scn
from PIL import Image
from random import randrange
import torch
import torch.nn.functional as F
from torch import optim
from ddpm_proteins import Unet, GaussianDiffusion
from ddpm_proteins.utils import save_heatmap, broadcat, get_msa_attention_embeddings, symmetrize,... | ddpm-proteins-main | train.py |
from ddpm_proteins.ddpm_proteins import GaussianDiffusion, Unet, Trainer
| ddpm-proteins-main | ddpm_proteins/__init__.py |
import os
from PIL import Image
import seaborn as sn
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from sidechainnet.utils.sequence import ProteinVocabulary
from einops import rearrange
# general functions
def exists(val):
return val is not None
def default(val, d):
return va... | ddpm-proteins-main | ddpm_proteins/utils.py |
import math
from math import log, pi
import copy
import torch
from torch import nn, einsum
import torch.nn.functional as F
from inspect import isfunction
from functools import partial
from torch.utils import data
from pathlib import Path
from torch.optim import Adam
from torchvision import transforms, utils
from PIL i... | ddpm-proteins-main | ddpm_proteins/ddpm_proteins.py |
from setuptools import setup
__VERSION__ = '0.0.3'
setup(name='adamod',
version=__VERSION__,
description='AdaMod optimization algorithm, build on PyTorch.',
long_description=open("README.md", encoding='utf-8').read(),
long_description_content_type="text/markdown",
keywords=['machine lear... | AdaMod-master | setup.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.