示例#1
0
def test():
    configs = SampleConfigs()

    processor = ConfigProcessor(configs, {'module.prop2': 20})
    processor()
    processor.print()

    print(configs.__dict__)
    print(configs.module.__dict__)
示例#2
0
class SampleChild(Sample):
    def __init__(self, *, test: int):
        pass

    new_attr = 2


@Sample.calc()
def input_model(c: Sample):
    return c.workers_count * 2


@Sample.calc(Sample.input_model)
def input_model2(c: Sample):
    return c.workers_count * 20


@Sample.calc('model')
def simple_model(c: Sample):
    return c.total_global_steps * 3


configs = Sample()

processor = ConfigProcessor(configs)
processor()
processor.print()

print(configs.__dict__)