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 |
|---|---|---|---|---|---|---|
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 25,199 | 43.919786 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 17,820 | 43.002469 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,525 | 33.135135 | 88 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 4,803 | 41.140351 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 4,615 | 36.836066 | 102 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 51,104 | 37.052867 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,555 | 35.343164 | 122 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,121 | 37.166667 | 117 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,105 | 39.605714 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,841 | 37.125984 | 109 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 8,262 | 58.021429 | 146 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 10,929 | 43.430894 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,762 | 96.023364 | 3,143 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 11,062 | 42.214844 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,118 | 43.580729 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,070 | 38.43913 | 109 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,037 | 41.983957 | 116 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 34,454 | 41.121027 | 197 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,060 | 36.601852 | 117 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 37,842 | 42.397936 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 22,069 | 37.719298 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,321 | 36.827273 | 113 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,256 | 50.543919 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 11,734 | 38.64527 | 133 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,314 | 44.586466 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 5,699 | 34.185185 | 150 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 18,146 | 44.029777 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,201 | 53.136364 | 3,558 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 40,432 | 37.952794 | 153 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,075 | 33.252101 | 113 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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,723 | 41.13245 | 122 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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,613 | 31.854545 | 98 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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... | 137,645 | 43.938296 | 198 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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... | 11,601 | 38.063973 | 106 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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... | 23,485 | 41.241007 | 122 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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,065 | 42.745201 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/tests/generation/test_generation_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,445 | 37.327586 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 30,047 | 40.502762 | 120 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 39,157 | 41.748908 | 123 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,176 | 39.948763 | 126 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,480 | 40.465116 | 115 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/utils/past_ci_versions.py | import argparse
import os
past_versions_testing = {
"pytorch": {
"1.11": {
"torch": "1.11.0",
"torchvision": "0.12.0",
"torchaudio": "0.11.0",
"python": 3.9,
"cuda": "cu113",
"install": (
"python3 -m pip install --no-c... | 5,270 | 36.119718 | 116 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 36,143 | 38.329706 | 119 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 33,237 | 40.340796 | 120 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,352 | 41.892361 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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,262 | 35.841176 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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... | 9,802 | 41.072961 | 118 | py |
FlexGen | FlexGen-main/benchmark/third_party/transformers/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 |
FlexGen | FlexGen-main/benchmark/hf_ds/hf_opt.py | """
Run OPT with huggingface or deepspeed.
Usage:
deepspeed --num_gpus 1 hf_opt.py --model facebook/opt-1.3b --batch-size 16 --use-deepspeed --cpu-offload
Reference:
https://github.com/huggingface/transformers-bloom-inference/tree/main/bloom-inference-scripts
"""
import argparse
import multiprocessing as mp
import o... | 13,218 | 35.315934 | 104 | py |
nlxgpt | nlxgpt-main/vcr.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyc... | 22,118 | 38.218085 | 120 | py |
nlxgpt | nlxgpt-main/pretrain.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyco... | 13,639 | 37.971429 | 125 | py |
nlxgpt | nlxgpt-main/esnlive.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyc... | 18,682 | 38.835821 | 132 | py |
nlxgpt | nlxgpt-main/vqaX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyco... | 20,473 | 39.542574 | 132 | py |
nlxgpt | nlxgpt-main/esnlive_concepts.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyc... | 19,204 | 36.954545 | 124 | py |
nlxgpt | nlxgpt-main/actX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from transformers import GPT2Tokenizer, AutoConfig
from transformers import AdamW, get_linear_schedule_with_warmup
import json
from cococaption.pyco... | 19,308 | 38.486708 | 125 | py |
nlxgpt | nlxgpt-main/retrieval_attack/ra_esnlive.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
from transformers import GPT2LMHeadModel, GPT2Tokenizer, AutoConfig
from sentence_transformers import SentenceTransformer
import json
import clip
from PIL import Image
device = torch.device("cuda" if torch.cu... | 11,812 | 35.459877 | 197 | py |
nlxgpt | nlxgpt-main/retrieval_attack/ra_vqaX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
from transformers import GPT2LMHeadModel, GPT2Tokenizer, AutoConfig
from sentence_transformers import SentenceTransformer
import json
import clip
from PIL import Image
device = torch.device("cuda" if torch.cu... | 10,609 | 37.165468 | 197 | py |
nlxgpt | nlxgpt-main/retrieval_attack/ra_actX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
from transformers import GPT2LMHeadModel, GPT2Tokenizer, AutoConfig
from sentence_transformers import SentenceTransformer
import json
import clip
from PIL import Image
device = torch.device("cuda" if torch.cu... | 9,184 | 38.252137 | 197 | py |
nlxgpt | nlxgpt-main/models/gpt_vcr.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss
from transformers import GPT2PreTrainedModel
from transformers.activations import ACT2FN
from transformers.modeling_outputs import (BaseModelOutputWithPastAndCrossAttentions,CausalLMOutputWithCrossAttentions,)
from transformers.modeling_utils impo... | 20,893 | 38.422642 | 132 | py |
nlxgpt | nlxgpt-main/models/gpt.py | import torch
import torch.utils.checkpoint
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from transformers import GPT2PreTrainedModel
from transformers.activations import ACT2FN
from transformers.modeling_outputs import (BaseModelOutputWithPastAndCrossAttentions,CausalLMOutp... | 20,466 | 38.511583 | 132 | py |
nlxgpt | nlxgpt-main/models/clip_vit.py | import clip
import torch
import torch.nn as nn
class ImageEncoder(nn.Module):
def __init__(self, device):
super(ImageEncoder, self).__init__()
self.encoder, _ = clip.load("ViT-B/16", device=device) # loads already in eval mode
def forward(self, x):
"""
Expects a tens... | 1,312 | 44.275862 | 197 | py |
nlxgpt | nlxgpt-main/explain_predict/ep_actX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
from transformers import DistilBertTokenizer, AutoConfig, DistilBertPreTrainedModel, DistilBertModel
from torch.nn import BCEWithLogitsLoss
from transformers.modeling_outputs import Sequence... | 13,162 | 35.768156 | 125 | py |
nlxgpt | nlxgpt-main/explain_predict/ep_vqaX.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
from transformers import DistilBertTokenizer, AutoConfig, DistilBertPreTrainedModel, DistilBertModel
from torch.nn import BCEWithLogitsLoss
from transformers.modeling_outputs import SequenceC... | 13,733 | 34.672727 | 125 | py |
nlxgpt | nlxgpt-main/explain_predict/ep_esnlive.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.utils.data import Dataset
from transformers import DistilBertTokenizer, AutoConfig, DistilBertPreTrainedModel, DistilBertModel
from torch.nn import CrossEntropyLoss
from transformers.modeling_outputs import SequenceC... | 12,945 | 35.778409 | 125 | py |
nlxgpt | nlxgpt-main/utils/eval_utils.py | import torch
import torch.nn.functional as F
def top_filtering(logits, top_k=0., top_p=0.9, threshold=-float('Inf'), filter_value=-float('Inf')):
""" Filter a distribution of logits using top-k, top-p (nucleus) and/or threshold filtering
Args:
logits: logits distribution shape (vocabulary size)... | 2,132 | 51.02439 | 119 | py |
nlxgpt | nlxgpt-main/utils/vcr_filter.py | import json
import torch
from bert_score import score
from cococaption.pycocotools.coco import COCO
from cococaption.pycocoevalcap.eval import COCOEvalCap
annotations_path = 'nle_data/VCR/vcr_test.json'
pred_unf_full_path = 'cococaption/results/unfiltered_captions_full_8.json' # explanations + answers
pred_unf_exp_p... | 1,979 | 29.9375 | 122 | py |
GenZProt | GenZProt-main/GenZProt/modules.py | """
functions from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/modules.py
"""
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
from torch.nn.init import xavier_uniform_, constant_
from functools import partial
class shifted_softplus(torch.nn.Module):... | 5,892 | 24.510823 | 71 | py |
GenZProt | GenZProt-main/GenZProt/genzprot.py | import torch
from torch import nn
from torch_scatter import scatter_mean, scatter_add
from conv import *
from e3nn_enc import *
class ZmatInternalDecoder(nn.Module):
"""
Invariance Message Passing + Dense decoder for internal coordinates
"""
def __init__(self, n_atom_basis, n_rbf, cutoff, num_conv, a... | 7,421 | 37.65625 | 110 | py |
GenZProt | GenZProt-main/GenZProt/data.py | """
functions adapted and modified from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/data.py
"""
import sys
import copy
from copy import deepcopy
from tqdm import tqdm
import numbers
import numpy as np
from sklearn.utils import shuffle as skshuffle
from sklearn.model_selection import tra... | 9,593 | 30.768212 | 108 | py |
GenZProt | GenZProt-main/GenZProt/cgvae.py | """
modules from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/cgvae.py
modified to a chemically transferable version by Soojung Yang
"""
import torch
from torch import nn
from torch_scatter import scatter_mean, scatter_add
from conv import *
from e3nn_enc import *
class EquivariantPsued... | 11,046 | 32.475758 | 123 | py |
GenZProt | GenZProt-main/GenZProt/datasets.py | """
functions partially adapted and modified from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/datasets.py
"""
import sys
sys.path.append("../scripts/")
import glob
import itertools
import random
from tqdm import tqdm
import time
import math
import numpy as np
import pickle
import netwo... | 22,704 | 32.88806 | 124 | py |
GenZProt | GenZProt-main/GenZProt/conv.py | """
modules from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/conv.py
"""
import torch
from torch import nn
from modules import *
from conv import *
from torch_scatter import scatter_mean, scatter_add
from torch import nn
def make_directed(nbr_list):... | 33,065 | 36.152809 | 141 | py |
GenZProt | GenZProt-main/GenZProt/e3nn_enc.py | """
e3nn encoder/prior
code adapted from DiffDock (Corso et al.)
https://github.com/gcorso/DiffDock
"""
import math
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from torch_scatter import scatter, scatter_mean, scatter_add
from e3nn import o3
from e3nn.nn import BatchNorm
... | 20,067 | 44.198198 | 151 | py |
GenZProt | GenZProt-main/scripts/inference.py | import os
import glob
import sys
import argparse
import copy
import json
import time
from datetime import timedelta
import random
from tqdm import tqdm
import numpy as np
import pandas as pd
import statsmodels.api as sm
import pickle
from sklearn.model_selection import KFold
import torch
from torch import nn
from... | 10,011 | 35.407273 | 157 | py |
GenZProt | GenZProt-main/scripts/utils.py | """
functions partially adapted and modified from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/data.py
"""
import os
import sys
import time
from tqdm import tqdm
from datetime import date
import numpy as np
from ase import Atoms, io
import networkx as nx
from sklearn.utils import shuf... | 15,509 | 35.840855 | 191 | py |
GenZProt | GenZProt-main/scripts/train_model.py | import os
import glob
import sys
import argparse
import random
import copy
import json
import time
from datetime import timedelta
import numpy as np
from tqdm import tqdm
import pandas as pd
import statsmodels.api as sm
sys.path.append("../GenZProt/")
from data import CGDataset, CG_collate
from cgvae import *
from... | 14,789 | 39.631868 | 162 | py |
GenZProt | GenZProt-main/scripts/sampling.py | """
functions partially adapted and modified from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/data.py
"""
from tqdm import tqdm
import numpy as np
import mdshare
from ase import io, Atoms
import torch
from torch_scatter import scatter_mean
from utils_ic import *
COVCUTOFFTABLE = {1: 0.... | 17,778 | 30.191228 | 188 | py |
GenZProt | GenZProt-main/scripts/test_model.py | """
functions adapted from CGVAE (Wang et al., ICML2022)
https://github.com/wwang2/CoarseGrainingVAE/data.py
"""
import os
import glob
import sys
import argparse
import copy
import json
import time
from datetime import timedelta
import random
from tqdm import tqdm
import numpy as np
import pandas as pd
import stat... | 15,149 | 38.453125 | 162 | py |
GenZProt | GenZProt-main/scripts/utils_ic.py | import copy
import torch
import numpy as np
import mdtraj as md
core_atoms = \
{
'ALA': ['O','N','C','CA','CB'],
'ARG': ['O','N','C','CA','CB','CG','CD','NE','CZ','NH1','NH2'],
'ASP': ['O','N','C','CA','CB','CG','OD1','OD2'],
'ASN': ['O','N','C','CA','CB','CG','OD1','ND2'],
'CYS': ['O','N','C','CA','CB','SG'],
'GLU':... | 10,739 | 35.161616 | 129 | py |
HTS-RL | HTS-RL-master/main.py |
import random
import os
import numpy as np
import torch
import torch.multiprocessing as _mp
from a2c_ppo_acktr.arguments import get_args
from a2c_ppo_acktr import algo
from a2c_ppo_acktr.storage_ma import RolloutStorageMA
from actor import actor
from env_step import env_step
from evaluation_aug import eval_q
from gy... | 5,438 | 37.302817 | 113 | py |
HTS-RL | HTS-RL-master/actor.py | import copy
import os
import pickle
import numpy as np
import torch
from a2c_ppo_acktr.model import Policy
from a2c_ppo_acktr.base_factory import get_base
from gym.spaces.discrete import Discrete
def actor(actor_rank, action_logits, values, observations, step_dones, act_in_progs, done_list,
shared_cpu_act... | 5,373 | 45.730435 | 119 | py |
HTS-RL | HTS-RL-master/learner.py | import os
import random
import sys
import time
import numpy as np
import torch
from a2c_ppo_acktr import utils
from collections import deque
def learn(shared_list, done_list, rollout_storages, test_q,
done_training, device, agents,
shared_cpu_actor_critics, please_load_model, args):
"""
... | 5,277 | 39.914729 | 119 | py |
HTS-RL | HTS-RL-master/helper.py | import copy
import ctypes
import gfootball.env as football_env
import torch
import torch.multiprocessing as _mp
from a2c_ppo_acktr.base_factory import get_base
from a2c_ppo_acktr.model import Policy
from create_env import create_atari_mjc_env
from gym.spaces.discrete import Discrete
mp = _mp.get_context('spawn')
Valu... | 4,204 | 43.734043 | 118 | py |
HTS-RL | HTS-RL-master/env_step.py | import copy
import math
import os
import sys
import time
import gfootball.env as football_env
import numpy as np
import torch
from a2c_ppo_acktr.envs import EpisodeRewardScoreWrapper
from a2c_ppo_acktr.envs import GFNoopResetEnv
from a2c_ppo_acktr.storage_ma import RolloutStorageMA
from gym.spaces.discrete import Dis... | 10,324 | 47.474178 | 136 | py |
HTS-RL | HTS-RL-master/evaluation_aug.py | import copy
import contextlib
import os
import sys
import gfootball.env as football_env
import numpy as np
import torch
from a2c_ppo_acktr.envs import EpisodeRewardScoreWrapper
from torch.distributions import Categorical
from utils import dict2csv
@contextlib.contextmanager
def temp_seed(seed):
state = np.rand... | 6,416 | 43.874126 | 132 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/distributions.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from a2c_ppo_acktr.utils import AddBias, init
"""
Modify standard PyTorch distributions so they are compatible with this code.
"""
#
# Standardize distribution interfaces
#
#torch.manual_seed(0)
# Categorical
FixedCategorical = torch.dis... | 3,018 | 28.028846 | 78 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/storage.py | import torch
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
def _flatten_helper(T, N, _tensor):
return _tensor.view(T * N, *_tensor.size()[2:])
#torch.manual_seed(0)
class RolloutStorage(object):
def __init__(self, num_steps, num_processes, obs_shape, action_space,
re... | 13,299 | 47.01444 | 122 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/arguments.py | import argparse
import torch
def get_args():
parser = argparse.ArgumentParser(description='RL')
parser.add_argument(
'--algo', default='ppo', help='algorithm to use: ppo')
parser.add_argument(
'--lr', type=float, default=0.000343, help='learning rate (default: 0.000343)')
parser.add_a... | 5,945 | 36.872611 | 106 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/envs.py | import os
import gym
import numpy as np
import torch
from gym.spaces.box import Box
from baselines.bench import monitor
from baselines import bench
from baselines.common.atari_wrappers import make_atari, wrap_deepmind, NoopResetEnv
from baselines.common.vec_env import VecEnvWrapper
from baselines.common.vec_env.dummy_... | 12,314 | 33.399441 | 107 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/utils.py | import glob
import os
import torch
import torch.nn as nn
from a2c_ppo_acktr.envs import VecNormalize
# Get a render function
def get_render_func(venv):
if hasattr(venv, 'envs'):
return venv.envs[0].render
elif hasattr(venv, 'venv'):
return get_render_func(venv.venv)
elif hasattr(venv, 'e... | 1,657 | 23.746269 | 81 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/model.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from a2c_ppo_acktr.distributions import Bernoulli, Categorical, DiagGaussian
from a2c_ppo_acktr.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
torch.manual_seed(0)
class ... | 14,053 | 35.790576 | 116 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/storage_ma.py | import torch
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
from a2c_ppo_acktr.storage import RolloutStorage
import time
def _flatten_helper(T, N, _tensor):
return _tensor.view(T * N, *_tensor.size()[2:])
class RolloutStorageMA(object):
def __init__(self, num_steps, num_processes, ob... | 18,067 | 47.181333 | 175 | py |
HTS-RL | HTS-RL-master/a2c_ppo_acktr/algo/ppo_aug.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import time
#torch.manual_seed(0)
class PPOAug():
def __init__(self,
actor_critic,
clip_param,
ppo_epoch,
num_mini_batch,
value_loss_co... | 4,600 | 42 | 111 | py |
scAdapt | scAdapt-master/scAdapt/scAdapt.py | import os
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import random
import math
# seed_everything()
import torch
import numpy as np
seed=666
import torch.backends.cudnn as cudnn
cudnn.deterministic = True
cudnn.benchmark = Tr... | 14,225 | 53.926641 | 156 | py |
scAdapt | scAdapt-master/scAdapt/loss_utility.py | import numpy as np
import torch
import torch.nn as nn
# seed_everything()
import torch
import numpy as np
seed=666
import torch.backends.cudnn as cudnn
cudnn.deterministic = True
cudnn.benchmark = True
import random
random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
def s... | 11,272 | 39.844203 | 143 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.