repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
transformers
transformers-main/tests/repo_utils/test_check_copies.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
11,236
52.509524
119
py
transformers
transformers-main/tests/repo_utils/test_check_dummies.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
4,658
35.685039
116
py
transformers
transformers-main/tests/repo_utils/test_tests_fetcher.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
38,536
45.939099
169
py
transformers
transformers-main/tests/optimization/test_optimization.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 requir...
6,830
35.529412
108
py
transformers
transformers-main/tests/sagemaker/conftest.py
# we define a fixture function below and it will be "used" by # referencing its name from tests import os import pytest from attr import dataclass os.environ["AWS_DEFAULT_REGION"] = "us-east-1" # defaults region @dataclass class SageMakerTestEnvironment: framework: str role = "arn:aws:iam::558105141721:r...
2,188
32.676923
148
py
transformers
transformers-main/tests/sagemaker/test_single_node_gpu.py
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import HuggingFace...
3,553
36.020833
117
py
transformers
transformers-main/tests/sagemaker/test_multi_node_data_parallel.py
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface imp...
4,253
37.672727
118
py
transformers
transformers-main/tests/sagemaker/test_multi_node_model_parallel.py
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface imp...
4,519
35.747967
117
py
transformers
transformers-main/tests/sagemaker/scripts/pytorch/run_ddp.py
import json import logging import os import subprocess from argparse import ArgumentParser logger = logging.getLogger(__name__) def parse_args(): parser = ArgumentParser() parsed, unknown = parser.parse_known_args() for arg in unknown: if arg.startswith(("-", "--")): parser.add_argum...
1,468
26.716981
102
py
transformers
transformers-main/tests/sagemaker/scripts/tensorflow/run_tf.py
import argparse import logging import sys import time import tensorflow as tf from datasets import load_dataset from transformers import AutoTokenizer, TFAutoModelForSequenceClassification if __name__ == "__main__": parser = argparse.ArgumentParser() # Hyperparameters sent by the client are passed as comma...
3,689
39.549451
112
py
transformers
transformers-main/tests/sagemaker/scripts/tensorflow/run_tf_dist.py
import argparse import logging import os import sys import time import tensorflow as tf from datasets import load_dataset from tqdm import tqdm from transformers import AutoTokenizer, TFAutoModelForSequenceClassification from transformers.utils import is_sagemaker_dp_enabled if os.environ.get("SDP_ENABLED") or is_s...
7,323
37.145833
110
py
transformers
transformers-main/tests/extended/test_trainer_ext.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
15,114
38.361979
119
py
transformers
transformers-main/tests/benchmark/test_benchmark.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
10,646
39.177358
91
py
transformers
transformers-main/tests/utils/test_image_utils.py
# coding=utf-8 # Copyright 2021 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...
27,697
44.184339
119
py
transformers
transformers-main/tests/utils/test_cli.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...
3,897
41.369565
130
py
transformers
transformers-main/tests/utils/test_generic.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...
7,223
34.940299
114
py
transformers
transformers-main/tests/utils/test_doc_samples.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...
4,407
37.330435
105
py
transformers
transformers-main/tests/utils/test_modeling_tf_core.py
# coding=utf-8 # Copyright 2019 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...
18,657
43.636364
119
py
transformers
transformers-main/tests/utils/test_activations.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
2,569
33.266667
88
py
transformers
transformers-main/tests/utils/test_file_utils.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
5,544
40.380597
117
py
transformers
transformers-main/tests/utils/test_offline.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
7,692
36.164251
112
py
transformers
transformers-main/tests/utils/test_skip_decorators.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...
3,519
28.090909
98
py
transformers
transformers-main/tests/utils/test_add_new_model_like.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
57,190
35.92124
118
py
transformers
transformers-main/tests/pipelines/test_pipelines_document_question_answering.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
13,383
35.172973
122
py
transformers
transformers-main/tests/pipelines/test_pipelines_visual_question_answering.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
4,124
34.560345
117
py
transformers
transformers-main/tests/pipelines/test_pipelines_translation.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
7,079
39.227273
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_text2text_generation.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
4,815
36.625
109
py
transformers
transformers-main/tests/pipelines/test_pipelines_summarization.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
9,020
56.826923
146
py
transformers
transformers-main/tests/pipelines/test_pipelines_object_detection.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
11,726
41.48913
120
py
transformers
transformers-main/tests/pipelines/test_pipelines_feature_extraction.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
20,797
95.287037
3,143
py
transformers
transformers-main/tests/pipelines/test_pipelines_zero_shot_object_detection.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
9,788
41.56087
118
py
transformers
transformers-main/tests/pipelines/test_pipelines_conversational.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
17,390
42.261194
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_zero_shot_image_classification.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
9,367
37.55144
120
py
transformers
transformers-main/tests/pipelines/test_pipelines_text_classification.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
8,485
41.643216
117
py
transformers
transformers-main/tests/pipelines/test_pipelines_zero_shot_audio_classification.py
# Copyright 2023 The HuggingFace Team. All rights reserved. # # 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...
3,401
34.810526
112
py
transformers
transformers-main/tests/pipelines/test_pipelines_token_classification.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
41,746
42.62278
197
py
transformers
transformers-main/tests/pipelines/test_pipelines_depth_estimation.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
4,056
33.974138
106
py
transformers
transformers-main/tests/pipelines/test_pipelines_automatic_speech_recognition.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
57,703
42.81473
205
py
transformers
transformers-main/tests/pipelines/test_pipelines_image_segmentation.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
27,418
37.241283
121
py
transformers
transformers-main/tests/pipelines/test_pipelines_image_classification.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
8,289
36.342342
106
py
transformers
transformers-main/tests/pipelines/test_pipelines_zero_shot.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
15,704
49.99026
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_text_generation.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
14,124
38.236111
138
py
transformers
transformers-main/tests/pipelines/test_pipelines_mask_generation.py
# Copyright 2023 The HuggingFace Team. All rights reserved. # # 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...
6,783
41.136646
113
py
transformers
transformers-main/tests/pipelines/test_pipelines_table_question_answering.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
30,800
44.766716
118
py
transformers
transformers-main/tests/pipelines/test_pipelines_image_to_text.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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...
9,296
35.458824
150
py
transformers
transformers-main/tests/pipelines/test_pipelines_fill_mask.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
19,065
43.44289
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_question_answering.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
26,872
52.213861
3,558
py
transformers
transformers-main/tests/pipelines/test_pipelines_common.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
32,117
35.706286
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_video_classification.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
3,485
34.212121
119
py
transformers
transformers-main/tests/pipelines/test_pipelines_audio_classification.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
4,678
33.404412
115
py
transformers
transformers-main/tests/generation/test_beam_search.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
25,124
42.468858
119
py
transformers
transformers-main/tests/generation/test_streamers.py
# coding=utf-8 # Copyright 2023 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
5,952
47.398374
118
py
transformers
transformers-main/tests/generation/test_tf_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
14,953
42.725146
119
py
transformers
transformers-main/tests/generation/test_stopping_criteria.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
3,595
31.690909
98
py
transformers
transformers-main/tests/generation/test_flax_logits_process.py
# coding=utf-8 # Copyright 2021 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
12,704
40.930693
122
py
transformers
transformers-main/tests/generation/test_flax_utils.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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...
12,163
38.11254
107
py
transformers
transformers-main/tests/generation/test_framework_agnostic.py
""" Framework agnostic tests for generate()-related methods. """ import numpy as np from transformers import AutoTokenizer from transformers.testing_utils import slow, torch_device class GenerationIntegrationTestsMixin: # To be populated by the child classes framework_dependent_parameters = { "AutoM...
32,298
45.878084
119
py
transformers
transformers-main/tests/generation/test_beam_constraints.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
4,428
37.181034
118
py
transformers
transformers-main/tests/generation/test_logits_process.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
32,338
42.524899
122
py
transformers
transformers-main/tests/generation/test_utils.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
123,025
43.222142
198
py
transformers
transformers-main/tests/bnb/test_4bit.py
# coding=utf-8 # Copyright 2022 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
19,142
38.147239
125
py
transformers
transformers-main/tests/bnb/test_mixed_int8.py
# coding=utf-8 # Copyright 2022 The HuggingFace Team 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
31,292
38.812977
125
py
transformers
transformers-main/utils/update_tiny_models.py
# coding=utf-8 # Copyright 2023 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 applicable...
7,272
35.18408
119
py
transformers
transformers-main/utils/tests_fetcher.py
# coding=utf-8 # Copyright 2021 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 applicable...
36,418
40.574201
120
py
transformers
transformers-main/utils/print_env.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2020 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 # # Unles...
1,723
28.724138
86
py
transformers
transformers-main/utils/create_dummy_models.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # 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 r...
67,548
42.834523
120
py
transformers
transformers-main/utils/check_copies.py
# coding=utf-8 # Copyright 2020 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 applicable...
23,859
40.067126
126
py
transformers
transformers-main/utils/check_inits.py
# coding=utf-8 # Copyright 2020 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 applicable...
12,878
41.088235
117
py
transformers
transformers-main/utils/check_model_tester.py
# coding=utf-8 # Copyright 2023 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 applicable...
2,598
39.609375
120
py
transformers
transformers-main/utils/past_ci_versions.py
import argparse import os past_versions_testing = { "pytorch": { "1.13": { "torch": "1.13.1", "torchvision": "0.14.1", "torchaudio": "0.13.1", "python": 3.9, "cuda": "cu116", "install": ( "python3 -m pip install --no-c...
4,995
38.338583
114
py
transformers
transformers-main/utils/notification_service.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
41,883
39.545983
119
py
transformers
transformers-main/utils/add_pipeline_model_mapping_to_test.py
# coding=utf-8 # Copyright 2023 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 applicable...
13,870
40.038462
117
py
transformers
transformers-main/utils/check_repo.py
# coding=utf-8 # Copyright 2020 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 applicable...
48,398
41.492537
128
py
transformers
transformers-main/utils/update_metadata.py
# coding=utf-8 # Copyright 2021 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 applicable...
12,459
42.114187
118
py
transformers
transformers-main/utils/check_dummies.py
# coding=utf-8 # Copyright 2020 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 applicable...
6,221
35.816568
118
py
transformers
transformers-main/utils/check_table.py
# coding=utf-8 # Copyright 2020 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 applicable...
7,490
40.159341
116
py
transformers
transformers-main/utils/test_module/custom_modeling.py
import torch from transformers import PreTrainedModel from .custom_configuration import CustomConfig, NoSuperInitConfig class CustomModel(PreTrainedModel): config_class = CustomConfig def __init__(self, config): super().__init__(config) self.linear = torch.nn.Linear(config.hidden_size, conf...
772
21.735294
77
py
tiny-faces-pytorch
tiny-faces-pytorch-master/main.py
import argparse import os import os.path as osp import torch from torch import optim from torchvision import transforms import trainer from datasets import get_dataloader from models.loss import DetectionCriterion from models.model import DetectionModel def arguments(): parser = argparse.ArgumentParser() p...
3,338
33.78125
92
py
tiny-faces-pytorch
tiny-faces-pytorch-master/evaluate.py
import argparse import json import os import os.path as osp import numpy as np import torch from PIL import Image from torch.utils import data from torchvision import transforms from tqdm import tqdm import trainer from datasets import get_dataloader from datasets.wider_face import WIDERFace from models.model import ...
3,789
31.393162
83
py
tiny-faces-pytorch
tiny-faces-pytorch-master/trainer.py
from pathlib import Path import numpy as np import torch from torch.nn import functional as nnfunc from torchvision import transforms from models.utils import get_bboxes from utils.nms import nms def print_state(idx, epoch, size, loss_cls, loss_reg): if epoch >= 0: message = "Epoch: [{0}][{1}/{2}]\t".fo...
4,459
29.972222
89
py
tiny-faces-pytorch
tiny-faces-pytorch-master/models/loss.py
import numpy as np import torch from torch import nn from .utils import balance_sampling class AvgMeter: def __init__(self): self.average = 0 self.num_averaged = 0 def update(self, loss, size): n = self.num_averaged m = n + size self.average = ((n * self.average) + fl...
3,298
32.663265
91
py
tiny-faces-pytorch
tiny-faces-pytorch-master/models/model.py
import numpy as np import torch from torch import nn from torchvision.models import resnet50, resnet101 class DetectionModel(nn.Module): """ Hybrid Model from Tiny Faces paper """ def __init__(self, base_model=resnet101, num_templates=1, num_objects=1): super().__init__() # 4 is for t...
3,496
32.304762
97
py
tiny-faces-pytorch
tiny-faces-pytorch-master/datasets/processor.py
import numpy as np from copy import deepcopy from utils.visualize import draw_bounding_box, render_and_save_bboxes, visualize_bboxes from utils.nms import nms from utils.metrics import rect_dist from utils.dense_overlap import compute_dense_overlap import logging logger = logging.getLogger("detector") class DataPr...
12,457
39.448052
115
py
tiny-faces-pytorch
tiny-faces-pytorch-master/datasets/__init__.py
import numpy as np import os import os.path as osp import json from utils.cluster import compute_kmedoids from .wider_face import WIDERFace from torch.utils import data def get_dataloader(datapath, args, num_templates=25, template_file="templates.json", img_transforms=None, train...
1,585
38.65
100
py
tiny-faces-pytorch
tiny-faces-pytorch-master/datasets/wider_face.py
from pathlib import Path import numpy as np import torch from PIL import Image from torch.utils.data import dataset from torchvision import transforms from utils import visualize from .processor import DataProcessor class WIDERFace(dataset.Dataset): """The WIDERFace dataset is generated using MATLAB, so a ...
8,229
34.938865
96
py
TSCP2
TSCP2-main/src/main.py
import sys import numpy as np import argparse import os import tensorflow as tf import matplotlib.pyplot as plt # dataset import TSCP2 as cp2 import losses as ls from utils.DataHelper import load_dataset from utils.estimate_CPD import estimate_CPs parser = argparse.ArgumentParser(description='interface of running expe...
6,984
43.775641
173
py
TSCP2
TSCP2-main/src/losses.py
from tensorflow.keras import backend as K import tensorflow as tf import numpy as np cosine_sim_1d = tf.keras.losses.CosineSimilarity(axis=1, reduction=tf.keras.losses.Reduction.NONE) cosine_sim_2d = tf.keras.losses.CosineSimilarity(axis=2, reduction=tf.keras.losses.Reduction.NONE) def _cosine_simililarity_dim1(x, y)...
8,998
36.032922
161
py
TSCP2
TSCP2-main/src/TSCP2.py
import os from tensorflow.keras.layers import * from tensorflow.keras.models import * from tqdm import tqdm import tensorflow as tf from tcn import TCN import numpy as np import losses as ls from utils.usc_ds_helper import ts_samples #@tf.function def train_step(xis, xjs, amodel, optimizer, criterion, temperature, s...
4,665
41.036036
176
py
DG-Font
DG-Font-main/main.py
import argparse import warnings from datetime import datetime from glob import glob from shutil import copyfile from collections import OrderedDict import torch.nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.multiprocessing as mp import...
17,653
43.024938
1,912
py
DG-Font
DG-Font-main/functions/modulated_deform_conv_func.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function from __future__ import division import math import torch from torch import nn from torch.autograd import Function from torch.nn.modules.utils import _pair from torch.autograd.function import once_differentiable import D...
2,484
42.596491
83
py
DG-Font
DG-Font-main/tools/utils.py
import os import torch class Logger(object): def __init__(self, log_dir): self.last = None def scalar_summary(self, tag, value, step): if self.last and self.last['step'] != step: print(self.last) self.last = None if self.last is None: self.last = {'...
1,968
25.608108
88
py
DG-Font
DG-Font-main/tools/ops.py
from torch import autograd import torch import torch.distributed as dist from torch.nn import functional as F def compute_grad_gp(d_out, x_in, is_patch=False): batch_size = x_in.size(0) grad_dout = autograd.grad( outputs=d_out.sum() if not is_patch else d_out.mean(), inputs=x_in, create_graph=...
4,639
28.367089
97
py
DG-Font
DG-Font-main/modules/modulated_deform_conv.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function from __future__ import division import torch import math from torch import nn from torch.nn import init from torch.nn.modules.utils import _pair from functions.modulated_deform_conv_func import ModulatedDeformConvFuncti...
5,186
44.902655
119
py
DG-Font
DG-Font-main/models/guidingNet.py
from torch import nn import torch.nn.functional as F try: from models.blocks import Conv2dBlock, FRN except: from blocks import Conv2dBlock, FRN cfg = { 'vgg11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'vgg13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, ...
2,977
31.725275
120
py
DG-Font
DG-Font-main/models/discriminator.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import torch.nn.init as init import math try: from models.blocks import FRN, ActFirstResBlk except: from blocks import FRN, ActFirstResBlk class Discriminator(nn.Module): """Discriminator: (image x, domain y) -> (logit...
3,132
34.202247
87
py
DG-Font
DG-Font-main/models/inception.py
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models try: from torchvision.models.utils import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url # Inception weights ported to Pytorch from # http://do...
11,623
36.376206
126
py
DG-Font
DG-Font-main/models/generator.py
from torch import nn import torch import torch.nn.functional as F import torch.nn.init as init import scipy.io as io import math import numpy as np try: from models.blocks import LinearBlock, Conv2dBlock, ResBlocks except: from blocks import LinearBlock, Conv2dBlock, ResBlocks import sys sys.path.append('..')...
7,688
38.229592
168
py
DG-Font
DG-Font-main/models/blocks.py
import torch import torch.nn.functional as F from torch import nn class ResBlocks(nn.Module): def __init__(self, num_blocks, dim, norm, act, pad_type, use_sn=False): super(ResBlocks, self).__init__() self.model = nn.ModuleList() for i in range(num_blocks): self.model.append(Res...
7,518
33.64977
118
py
DG-Font
DG-Font-main/datasets/custom_dataset.py
import torch.utils.data as data from PIL import Image import os import os.path import sys def has_file_allowed_extension(filename, extensions): """Checks if a file is an allowed extension. Args: filename (string): path to a file extensions (iterable of strings): extensions to consider (lowe...
9,235
33.207407
131
py
DG-Font
DG-Font-main/datasets/datasetgetter.py
import torch from torchvision.datasets import ImageFolder import os import torchvision.transforms as transforms from datasets.custom_dataset import ImageFolerRemap, CrossdomainFolder class Compose(object): def __init__(self, tf): self.tf = tf def __call__(self, img): for t in self.tf: ...
2,435
27.325581
91
py