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 |
|---|---|---|---|---|---|---|
flaxformer | flaxformer-main/flaxformer/architectures/perceiver_ar/rotary_embedding.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 5,084 | 31.388535 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/perceiver_ar/perceiver_ar_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 17,399 | 40.232227 | 128 | py |
flaxformer | flaxformer-main/flaxformer/architectures/perceiver_ar/t5_models_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 31,728 | 36.109942 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/fido/fido_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 5,930 | 33.888235 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/fido/fido_architecture_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 8,296 | 32.321285 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/common/param_remapping_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,190 | 31.559105 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/common/param_remapping.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,677 | 37 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_parallel_fused_decoder_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,187 | 29.872727 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_architecture_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 30,979 | 38.414758 | 108 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/routing_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 22,824 | 31.889049 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_parallel_fused_decoder.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 11,725 | 33.589971 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_layers_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 14,536 | 28.132265 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/scatter_utils_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 2,302 | 36.145161 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/scatter_utils.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 1,810 | 35.22 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 25,449 | 40.517129 | 110 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/moe_layers.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 34,130 | 36.839246 | 110 | py |
flaxformer | flaxformer-main/flaxformer/architectures/moe/routing.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 33,403 | 42.325551 | 110 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/bert.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 31,705 | 35.824623 | 111 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/bert_checkpoint_converter.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 7,555 | 37.55102 | 82 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/bert_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 14,782 | 32.751142 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/heads.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 14,583 | 34.312349 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/heads_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,381 | 33.491694 | 100 | py |
flaxformer | flaxformer-main/flaxformer/architectures/bert/configs.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 3,132 | 29.417476 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_1_0.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,088 | 26.628378 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_architecture_test_utils.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 17,616 | 33.408203 | 105 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_1_1.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,442 | 27.664516 | 79 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_architecture_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 21,698 | 35.653716 | 83 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_common_layers_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,371 | 36.444043 | 74 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 63,075 | 38.496556 | 110 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/t5_common_layers.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 7,623 | 35.830918 | 104 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/parallel_fused_decoder.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 16,959 | 37.371041 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/t5/parallel_fused_decoder_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 12,093 | 33.067606 | 83 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/tensor_utils.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 14,661 | 34.936275 | 117 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/long_attention.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 56,450 | 42.059497 | 113 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/longt5_architecture_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 33,452 | 34.816916 | 111 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/longt5_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 30,917 | 40.224 | 124 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/tensor_utils_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 16,879 | 31.461538 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/relative_position_biases_general_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 3,959 | 37.446602 | 97 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/long_attention_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 33,226 | 33.432124 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/longt5/relative_position_biases_general.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 6,812 | 39.313609 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/calm_t5/components.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 18,386 | 43.306024 | 80 | py |
flaxformer | flaxformer-main/flaxformer/architectures/calm_t5/calm_architecture.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 41,532 | 39.28419 | 110 | py |
flaxformer | flaxformer-main/flaxformer/components/embedding.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 35,706 | 38.19539 | 115 | py |
flaxformer | flaxformer-main/flaxformer/components/relative_position_biases_export_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 3,830 | 32.313043 | 79 | py |
flaxformer | flaxformer-main/flaxformer/components/initializers.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 2,868 | 33.566265 | 79 | py |
flaxformer | flaxformer-main/flaxformer/components/dense.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 17,908 | 39.981693 | 109 | py |
flaxformer | flaxformer-main/flaxformer/components/layer_norm_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 1,843 | 29.733333 | 74 | py |
flaxformer | flaxformer-main/flaxformer/components/rich_attention_position_scores.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 1,331 | 27.956522 | 80 | py |
flaxformer | flaxformer-main/flaxformer/components/dense_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 20,540 | 30.552995 | 104 | py |
flaxformer | flaxformer-main/flaxformer/components/embedding_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 23,262 | 35.634646 | 80 | py |
flaxformer | flaxformer-main/flaxformer/components/initializers_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 6,579 | 32.74359 | 79 | py |
flaxformer | flaxformer-main/flaxformer/components/convolution.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 7,008 | 34.57868 | 81 | py |
flaxformer | flaxformer-main/flaxformer/components/relative_position_biases_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 7,197 | 33.605769 | 82 | py |
flaxformer | flaxformer-main/flaxformer/components/relative_position_biases.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 9,449 | 40.814159 | 84 | py |
flaxformer | flaxformer-main/flaxformer/components/layer_norm.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 3,570 | 33.669903 | 80 | py |
flaxformer | flaxformer-main/flaxformer/components/transforms.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 10,102 | 35.082143 | 97 | py |
flaxformer | flaxformer-main/flaxformer/components/attention/memory_efficient_attention_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 20,330 | 33.401015 | 81 | py |
flaxformer | flaxformer-main/flaxformer/components/attention/memory_efficient_attention.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 23,576 | 35.667185 | 80 | py |
flaxformer | flaxformer-main/flaxformer/components/attention/dense_attention.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 91,983 | 37.992794 | 105 | py |
flaxformer | flaxformer-main/flaxformer/components/attention/dense_attention_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 65,324 | 33.970557 | 104 | py |
flaxformer | flaxformer-main/flaxformer/components/attention/attention_benchmarks.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 7,573 | 27.473684 | 80 | py |
flaxformer | flaxformer-main/flaxformer/t5x/checkpointing_util.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,551 | 36.619835 | 80 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/h_transformer/gin_configs_encoder_decoder_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,830 | 33.755396 | 79 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/h_transformer/gin_configs_decoder_only_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 3,949 | 30.854839 | 79 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/moe/gin_configs_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,893 | 31.845638 | 79 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/calm/gin_configs_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,936 | 32.134228 | 79 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/t5/gin_configs_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 4,841 | 31.496644 | 79 | py |
flaxformer | flaxformer-main/flaxformer/t5x/configs/longt5/gin_configs_test.py | # Copyright 2023 Google LLC.
#
# 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 agreed to in writing, ... | 6,865 | 34.210256 | 79 | py |
pytket | pytket-main/examples/python/pytket-qujax-classification.py | from jax import numpy as jnp, random, vmap, value_and_grad, jit
from pytket import Circuit
from pytket.circuit.display import render_circuit_jupyter
from pytket.extensions.qujax import tk_to_qujax
import qujax
import matplotlib.pyplot as plt
# # Define the classification task
# We'll try and learn a _donut_ binary cla... | 5,758 | 37.393333 | 328 | py |
pytket | pytket-main/examples/python/pytket-qujax_qaoa.py | # # Symbolic circuits with `qujax` and `pytket-qujax`
# In this notebook we will show how to manipulate symbolic circuits with the `pytket-qujax` extension. In particular, we will consider a QAOA and an Ising Hamiltonian.
from pytket import Circuit
from pytket.circuit.display import render_circuit_jupyter
from jax imp... | 6,609 | 47.962963 | 478 | py |
pytket | pytket-main/examples/python/pytket-qujax_heisenberg_vqe.py | from pytket import Circuit
from pytket.circuit.display import render_circuit_jupyter
from jax import numpy as jnp, random, vmap, grad, value_and_grad, jit
import matplotlib.pyplot as plt
import qujax
from pytket.extensions.qujax import tk_to_qujax
# # Let's start with a tket circuit
# We place barriers to stop tket a... | 7,440 | 42.261628 | 398 | py |
pytket | pytket-main/manual/conf.py | # -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
# See https://www.sphinx-doc.org/en/master/usage/configuration.html
copyright = "2020-2023 Quantinuum"
author = "Quantinuum"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sph... | 1,109 | 22.617021 | 78 | py |
Resemblyzer | Resemblyzer-master/resemblyzer/voice_encoder.py | from resemblyzer.hparams import *
from resemblyzer import audio
from pathlib import Path
from typing import Union, List
from torch import nn
from time import perf_counter as timer
import numpy as np
import torch
class VoiceEncoder(nn.Module):
def __init__(self, device: Union[str, torch.device]=None, verbose=True,... | 9,191 | 50.640449 | 114 | py |
rebias | rebias-master/evaluator.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import torch
import numpy as np
def n_correct(pred, labels):
_, predicted = torch.max(pred.data, 1)
n_correct = (predicted == labels).sum().item()
return n_correct
class EvaluatorBase(object):
def __init__(self, device='cuda'):
... | 11,149 | 37.184932 | 122 | py |
rebias | rebias-master/make_clusters.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import argparse
import os
import time
import torch
import torch.nn as nn
import torchvision
from torchvision import transforms
from torchvision.utils import save_image
import numpy as np
from PIL import Image
from sklearn.cluster import MiniBatchKMeans... | 5,502 | 34.503226 | 105 | py |
rebias | rebias-master/trainer.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Unified implementation of the de-biasing minimax optimisation by various methods including,
- ReBias (ours, outer_criterion='RbfHSIC', inner criterion='MinusRbfHSIC')
- Vanilla and Biased baselines (f_lambda_outer=0, g_lambda_inner=0)
- Learned Mixin (outer_... | 20,817 | 42.280665 | 144 | py |
rebias | rebias-master/optims/__init__.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Opitmizers for the training.
"""
from torch.optim import Adam
from torch.optim.lr_scheduler import StepLR, CosineAnnealingLR
from adamp import AdamP
__optim__ = ['Adam', 'AdamP']
__scheduler__ = ['StepLR', 'CosineAnnealingLR']
__all__ = ['Adam', 'AdamP',... | 977 | 24.736842 | 88 | py |
rebias | rebias-master/criterions/comparison_methods.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
De-biasing comparison methods.
Cadene, Remi, et al. "RUBi: Reducing Unimodal Biases for Visual Question Answering.",
Clark, Christopher, Mark Yatskar, and Luke Zettlemoyer. "Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biase... | 3,496 | 34.683673 | 157 | py |
rebias | rebias-master/criterions/sigma_utils.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import numpy as np
import torch
def _l2_dist(X):
X = X.view(len(X), -1)
XX = X @ X.t()
X_sqnorms = torch.diag(XX)
X_L2 = -2 * XX + X_sqnorms.unsqueeze(1) + X_sqnorms.unsqueeze(0)
return X_L2.clone().detach().cpu().numpy().reshape(-1)... | 1,810 | 26.029851 | 99 | py |
rebias | rebias-master/criterions/hsic.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Python Implementation of the finite sample estimator of Hilbert-Schmidt Independence Criterion (HSIC)
We provide both biased estimator and unbiased estimators (unbiased estimator is used in the paper)
"""
import torch
import torch.nn as nn
def to_numpy(x):... | 4,434 | 33.648438 | 172 | py |
rebias | rebias-master/criterions/dist.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Distance-based objective functions.
Re-implemented for the compatibility with other losses
"""
import torch.nn as nn
import torch.nn.functional as F
class MSELoss(nn.Module):
""" A simple mean squared error (MSE) implementation.
"""
def __init_... | 858 | 25.84375 | 66 | py |
rebias | rebias-master/models/rebias_models.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
ReBias model wrapper.
"""
import torch.nn as nn
class ReBiasModels(object):
"""A container for the target network and the intentionally biased network.
"""
def __init__(self, f_net, g_nets):
self.f_net = f_net
self.g_nets = g_ne... | 1,620 | 23.560606 | 79 | py |
rebias | rebias-master/models/imagenet_models.py | """ResNet and BagNet implementations.
original codes
- https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
- https://github.com/wielandbrendel/bag-of-local-features-models/blob/master/bagnets/pytorchnet.py
"""
import torch
import torch.nn as nn
import math
from torch.utils.model_zoo import load_u... | 15,233 | 38.466321 | 159 | py |
rebias | rebias-master/models/mnist_models.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Implementation for simple statcked convolutional networks.
"""
import torch
import torch.nn as nn
class SimpleConvNet(nn.Module):
def __init__(self, num_classes=None, kernel_size=7, feature_pos='post'):
super(SimpleConvNet, self).__init__()
... | 2,049 | 32.606557 | 86 | py |
rebias | rebias-master/models/action_models/ResNet3D.py | import torch.nn as nn
from .weight_init_helper import init_weights
from .stem_helper import VideoModelStem
from .resnet_helper import ResStage
from .head_helper import ResNetBasicHead
# Number of blocks for different stages given the model depth.
_MODEL_STAGE_DEPTH = {18.1: (2, 2, 2, 2),
18: (2, ... | 8,939 | 33.921875 | 74 | py |
rebias | rebias-master/models/action_models/nonlocal_helper.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Non-local helper"""
import torch
import torch.nn as nn
class Nonlocal(nn.Module):
"""
Builds Non-local Neural Networks as a generic family of building
blocks for capturing long-range dependencies. Non-local... | 6,320 | 37.542683 | 80 | py |
rebias | rebias-master/models/action_models/head_helper.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""ResNe(X)t Head helper."""
import torch
import torch.nn as nn
class ResNetBasicHead(nn.Module):
"""
ResNe(X)t 3D head.
This layer performs a fully-connected projection during training, when the
input siz... | 5,073 | 36.308824 | 94 | py |
rebias | rebias-master/models/action_models/stem_helper.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""ResNe(X)t 3D stem helper."""
import torch.nn as nn
class VideoModelStem(nn.Module):
"""
Video 3D stem module. Provides stem operations of Conv, BN, ReLU, MaxPool
on input data tensor for one or multiple pat... | 5,867 | 33.116279 | 82 | py |
rebias | rebias-master/models/action_models/weight_init_helper.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Utility function for weight initialization"""
import torch.nn as nn
from fvcore.nn.weight_init import c2_msra_fill
def init_weights(model, fc_init_std=0.01, zero_init_final_bn=True):
"""
Performs ResNet style w... | 1,444 | 33.404762 | 76 | py |
rebias | rebias-master/models/action_models/resnet_helper.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Video models."""
import torch.nn as nn
from .nonlocal_helper import Nonlocal
def get_trans_func(name):
"""
Retrieves the transformation module by name.
"""
trans_funcs = {
"bottleneck_transform... | 17,499 | 33.448819 | 83 | py |
rebias | rebias-master/datasets/colour_mnist.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Python implementation of Biased-MNIST.
"""
import os
import numpy as np
from PIL import Image
import torch
from torch.utils import data
from torchvision import transforms
from torchvision.datasets import MNIST
class BiasedMNIST(MNIST):
"""A base clas... | 7,875 | 40.235602 | 124 | py |
rebias | rebias-master/datasets/kinetics.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Dataset for the action recognition benchmarks.
We use the official implemenation of SlowFast by Facebook research.
https://github.com/facebookresearch/SlowFast
"""
import torch
from datasets.kinetics_tools.loader import construct_loader
def get_kinetics_d... | 831 | 32.28 | 67 | py |
rebias | rebias-master/datasets/imagenet.py | """ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
9-Class ImageNet wrapper. Many codes are borrowed from the official torchvision dataset.
https://github.com/pytorch/vision/blob/master/torchvision/datasets/imagenet.py
The following nine classes are selected to build the subset:
dog, cat, frog, turtle, ... | 6,565 | 38.317365 | 97 | py |
rebias | rebias-master/datasets/kinetics_tools/transform.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import math
import numpy as np
import torch
def random_short_side_scale_jitter(images, min_size, max_size):
"""
Perform a spatial short scale jittering on the given images.
Args:
images (tensor): images... | 3,922 | 31.155738 | 79 | py |
rebias | rebias-master/datasets/kinetics_tools/decoder.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import math
import numpy as np
import random
import torch
def temporal_sampling(frames, start_idx, end_idx, num_samples):
"""
Given the start and end frame index, sample num_samples frames between
the start and... | 8,893 | 36.527426 | 80 | py |
rebias | rebias-master/datasets/kinetics_tools/kinetics.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import json
import random
import torch
import torch.utils.data
import datasets.kinetics_tools.decoder as decoder
import datasets.kinetics_tools.video_container as container
import datasets.kinetics_tools.transform... | 17,839 | 40.488372 | 118 | py |
rebias | rebias-master/datasets/kinetics_tools/loader.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Data loader."""
import torch
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data.sampler import RandomSampler
from datasets.kinetics_tools.kinetics import Kinetics
# Supported datasets.
_D... | 2,473 | 29.925 | 71 | py |
rebias | rebias-master/datasets/kinetics_tools/meters.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Meters."""
import datetime
import numpy as np
from collections import deque
import torch
import time
import slowfast.utils.logging as logging
import slowfast.utils.metrics as metrics
from fvcore.common.timer import Tim... | 13,430 | 31.442029 | 80 | py |
TraBS | TraBS-main/scripts/main_pretrain.py |
from pathlib import Path
from datetime import datetime
import torch
from pytorch_lightning.trainer import Trainer
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
import numpy as np
import torchio as tio
from breaststudies.data import BreastDataModule, BreastDataModuleLR, BreastDataModule2D... | 5,913 | 39.506849 | 179 | py |
TraBS | TraBS-main/scripts/main_compute_segmentation_quality.py | import logging
from pathlib import Path
import numpy as np
import pandas as pd
import monai.metrics as mm
import torchio as tio
from breaststudies.utils import one_hot
from breaststudies.metrics import compute_surface_distances, compute_average_surface_distance
from breaststudies.data import BreastDatasetCreator,... | 4,308 | 36.469565 | 168 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.