Spaces:
Sleeping
Sleeping
Delete data_loader_factory_test.py
Browse files- data_loader_factory_test.py +0 -45
data_loader_factory_test.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
|
| 15 |
-
"""Tests for official.nlp.data.data_loader_factory."""
|
| 16 |
-
|
| 17 |
-
import dataclasses
|
| 18 |
-
import tensorflow as tf, tf_keras
|
| 19 |
-
|
| 20 |
-
from official.core import config_definitions as cfg
|
| 21 |
-
from official.nlp.data import data_loader_factory
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
@dataclasses.dataclass
|
| 25 |
-
class MyDataConfig(cfg.DataConfig):
|
| 26 |
-
is_training: bool = True
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
@data_loader_factory.register_data_loader_cls(MyDataConfig)
|
| 30 |
-
class MyDataLoader:
|
| 31 |
-
|
| 32 |
-
def __init__(self, params):
|
| 33 |
-
self.params = params
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
class DataLoaderFactoryTest(tf.test.TestCase):
|
| 37 |
-
|
| 38 |
-
def test_register_and_load(self):
|
| 39 |
-
train_config = MyDataConfig()
|
| 40 |
-
train_loader = data_loader_factory.get_data_loader(train_config)
|
| 41 |
-
self.assertTrue(train_loader.params.is_training)
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
if __name__ == "__main__":
|
| 45 |
-
tf.test.main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|