-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add privacy notice and license to doc
Signed-off-by: Zhiyuan Chen <[email protected]>
- Loading branch information
1 parent
04ee02b
commit 9f6e780
Showing
6 changed files
with
1,783 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# CHANfiG, Easier Configuration. | ||
# Copyright (c) 2022-Present, CHANfiG Contributors | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the following licenses: | ||
# - The Unlicense | ||
# - GNU Affero General Public License v3.0 or later | ||
# - GNU General Public License v2.0 or later | ||
# - BSD 4-Clause "Original" or "Old" License | ||
# - MIT License | ||
# - Apache License 2.0 | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the LICENSE file for more details. | ||
|
||
from functools import partial | ||
|
||
from chanfig import Config, Variable | ||
|
||
|
||
class DataConfig(Config): | ||
__test__ = False | ||
|
||
def __init__(self, name): | ||
super().__init__() | ||
self.name = name | ||
|
||
def post(self): | ||
self.name = self.name.lower() | ||
|
||
|
||
class TestConfig(Config): | ||
__test__ = False | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
num_classes = Variable(10) | ||
self.name = "CHANfiG" | ||
self.seed = Variable(1013, help="random seed") | ||
data_factory = partial(DataConfig, name="CIFAR10") | ||
self.datasets = Config(default_factory=data_factory) | ||
self.datas = Config(default_factory=data_factory) | ||
self.datasets.a.num_classes = num_classes | ||
self.datasets.b.num_classes = num_classes | ||
self.network.name = "ResNet18" | ||
self.network.num_classes = num_classes | ||
|
||
def post(self): | ||
self.name = self.name.lower() | ||
self.id = f"{self.name}_{self.seed}" | ||
|
||
@property | ||
def data(self): | ||
return next(iter(self.datas.values())) if self.datas else self.datas["default"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters