AutoDL
AutoDL ์๊ฐ
AutoDL์ ๋ฅ๋ฌ๋ ๋ชจ๋ธ์ ํ์ดํผํ๋ผ๋ฏธํฐ ํ๋์ ์๋ํํ์ฌ ์ต์ ์ ํ์ดํผํ๋ผ๋ฏธํฐ ์กฐํฉ์ ํ์ํ๋ ๋ฐ ์์๋๋ ์๊ฐ์ ๋จ์ถํด ์ค๋๋ค. ํ์ ๊ฒฐ๊ณผ๋ฅผ ํ ๋์ ๋น๊ตํ ์ ์๋๋ก ํ์ดํผํ๋ผ๋ฏธํฐ ์กฐํฉ ๋ณ ์ฑ๋ฅ์ ์๊ฐํํ ๊ทธ๋ํ๋ ์ ๊ณตํฉ๋๋ค. ๋ํ ๋ถ์๊ฐ๊ฐ ๊ฑฐ์ณ์ผ ํ๋ ๋จ๊ณ๋ฅผ ์ต์ํํ๊ธฐ ์ํด ๋์ปค ์ด๋ฏธ์ง ์๋ ์์ฑ ๋ฐ trialTemplate ์๋ ์์ฑ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ฉฐ, ๋ถ์ ๋ชฉ์ ์ ๋ฐ๋ผ ๋ค์ํ ํ์ดํผํ๋ผ๋ฏธํฐ ํ๋ ์๊ณ ๋ฆฌ์ฆ์ ์ ์ฉํ ์ ์์ต๋๋ค. AutoDL์์ ํ์ดํผ ํ๋ผ๋ฏธํฐ ํ๋ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๊ธฐ ์ํด์๋ ๋ชจ๋ธ ๊ด๋ฆฌ๋ถ์์ ๋์ปค ์ด๋ฏธ์ง์ trialTemplate์ ์์ฑํ ๋ค AutoDL experiment๋ฅผ ์์ฑํ๋ ๊ณผ์ ์ ๊ฑฐ์น๊ฒ ๋ฉ๋๋ค.
๋ชจ๋ธ ๊ด๋ฆฌ๋ถ
์ด๋ฏธ์ง
- ์ด๋ฏธ์ง ๋ชฉ๋ก
ํ๋ | ์ค๋ช |
---|---|
์ด๋ฏธ์ง๋ช | ์ด๋ฏธ์ง๋ฅผ ๋ํํ๋ ์ด๋ฆ |
์ํ | BUILDING, UPLOADING, COMPLETE, FAIL |
์ํฌ์คํ์ด์ค๋ช | Python ๋ชจ๋ธ ํ์ผ์ด ์์นํ ์ํฌ์คํ์ด์ค |
์ค๋ช | ์ด๋ฏธ์ง ์ค๋ช |
๋ฑ๋ก์ผ | ์ด๋ฏธ์ง ๋น๋ ์ผ์ |
Owner | ์์ฑ์ ์ ๋ณด ํ๊ธฐ |
Action | ์์ : ์ด๋ฏธ์ง ์์ธ ์ฌํญ ํ์ธ ๋ฐ ์ค๋ช ์์ |
์ญ์ : ์ด๋ฏธ์ง ์ญ์ |
- ์ด๋ฏธ์ง ์ถ๊ฐ
- ์ฌ์ฉ์๊ฐ ์ ํํ ํ์ด์ฌ ๋ชจ๋ธ ํ์ผ(.py)๊ณผ filestorage ํด๋๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋์ปค ์ด๋ฏธ์ง๋ฅผ ์๋ ์์ฑ
- ๋ฅ๋ฌ๋ ํ๋ ์์ํฌ: Tensorflow1, Tensorflow2, Keras, Pytorch, MXNet
MXNet์ ์ ์ธํ ๋ชจ๋ ํ๋ ์์ํฌ์ GPU ๋ฒ์ ์ ์ง์ํจ - ์ฃผํผํฐ ๋ ธํธ๋ถ home ๋๋ ํ ๋ฆฌ์์ Python ๋ชจ๋ธ ํ์ผ์ ์ ํ
- '๋น๋' ๋ฒํผ์ ๋๋ฅด๋ฉด ๋์ปค ์ด๋ฏธ์ง๊ฐ ์์ฑ๋จ
trialTemplate
- '์ด๋ฏธ์ง' ํญ์์ ์์ฑ๋ ์ด๋ฏธ์ง๋ฅผ ๊ธฐ๋ฐ์ผ๋ก trialTemplate์ด ์์ฑ๋์ด ์์
- worker ๊ฐ์ ๋ฐ cpu, memory, gpu ๋ฆฌ์์ค ์ต์ ์ ํธ๋ฆฌํ๊ฒ ์ค์ ๊ฐ๋ฅ
- 'ํ ํ๋ฆฟ ์ถ๊ฐ' ๋ฒํผ์ ๋๋ฌ ์ฌ์ฉ์๊ฐ ์ง์ trialTemplate์ ์์ฑํ๋ ๊ฒ๋ ๊ฐ๋ฅ
- Job, TFJob, PyTorchJob ์ค์์ ์ ํ์ ํด๋น Job์ trialTemplate ๊ธฐ๋ณธํ์ด ์ ๊ณต๋จ
- Kubernetes Job (does not support distributed execution).
- Kubeflow TFJob (supports distributed execution).
- Kubeflow PyTorchJob (supports distributed execution).
AutoDL
AutoDL experiment ๋ชฉ๋ก
ํ๋ | ์ค๋ช |
---|---|
์ด๋ฆ | AutoDL Experiment๋ฅผ ๋ํํ๋ ์ ๋ชฉ |
์ํ | CREATED, RUNNING, SUCCEEDED, FAIL, UNKNOWN |
๋ฑ๋ก์ผ | AutoDL Experiment ์์ฑ ์ผ์ |
Owner | ์์ฑ์ ์ ๋ณด ํ๊ธฐ |
Action | ์ญ์ : Experiment ์ญ์ |
YAML ํ์ผ ๋ณด๊ธฐ: Experiment๋ฅผ ์์ฑํ YAML ํ์ผ ํ์ธ ๋ฐ ํด๋ฆฝ๋ณด๋๋ก ๋ณต์ฌ |
AutoDL experiment ์์ฑ
- YAML file ์ ๋ณด ์ ๋ ฅ
- 1์์ ์ค์ ํ ์ฌํญ์ด 2์ code mirror์ ๋ฐ์๋จ
- '์ด๊ธฐํ' ๋ฒํผ์ ๋๋ฌ ์ค์ ์ฌํญ์ ์ด๊ธฐํํ ์ ์์
- Metadata
- Name: AutoDL Experiment๋ฅผ ๋ํํ๋ ์ ๋ชฉ
- Namespace: ์คํ์ ์คํํ namespace ๋ช . ๊ณ ์ ๋ ๊ฐ
- Trial Spec
- trial pod ์์ฑ์ ์ํ ๋ช ์ธ์
- ๋ชจ๋ธ ๊ด๋ฆฌ๋ถ์ trialTemplate ํญ์์ ์์ฑํ trialTemplate ์ค์์ ์ ํ ๊ฐ๋ฅ
- Metrics Collector
- ํ๊ฐ ์งํ๋ฅผ ์์งํ๋ ํ์์ ์ง์
- StdOut: metricsFormat์์ ์ ์ํ ์ ๊ท ํํ์์ ๋ง์ถ์ด ํ๊ฐ ์งํ๋ฅผ ์์ง
metricsFormat์ ์ค์ ํด์ผ ํจ. Default: ([\w|-]+)\s=\s((-?\d+)(.\d+)?) - TensorflowEvent: tf.summary๋ก ๊ธฐ๋ก๋ ๋ก๊ทธ์์ ํ๊ฐ ์งํ๋ฅผ ์์ง (tensorflow2 ๋ฏธ์ง์)
๋ก๊ทธ ๊ฒฝ๋ก๋ฅผ ์ค์ ํด์ผ ํจ - File: ํ๊ฐ ์งํ๋ฅผ ๊ธฐ๋กํ ๋ก๊ทธ ํ์ผ์ ์์ฑํ๊ณ ํด๋น ํ์ผ์์ metricsFormat์ ๋ง์ถ์ด ํ๊ฐ ์งํ๋ฅผ ์์ง
๋ก๊ทธ ๊ฒฝ๋ก์ metricsFormat์ ์ค์ ํด์ผ ํจ. Default: ([\w|-]+)\s=\s((-?\d+)(.\d+)?)
- StdOut: metricsFormat์์ ์ ์ํ ์ ๊ท ํํ์์ ๋ง์ถ์ด ํ๊ฐ ์งํ๋ฅผ ์์ง
- ํ๊ฐ ์งํ๋ฅผ ์์งํ๋ ํ์์ ์ง์
- Algorithm Name
- ํ์ดํผํ๋ผ๋ฏธํฐ ํ๋ ์๊ณ ๋ฆฌ์ฆ์ ์ ํ
- Common Parameters
- AutoDL์์ trial์ ํ๋์ ํ์ดํผํ๋ผ๋ฏธํฐ ์กฐํฉ์ ์ ์ฉํด์ ๋ชจ๋ธ ์ฑ๋ฅ์ ํ๊ฐํ๋ ๊ฒ์ ์๋ฏธํจ
- ์๋ฅผ ๋ค์ด, ParallelTrialCount=3์ด๊ณ MaxTrialCount=12์ด๋ฉด 3๊ฐ์ trial์ ๋์์ ์คํํ๋ ๊ณผ์ ์ 4๋ฒ ๋ฐ๋ณตํ์ฌ 12๊ฐ์ trial์ ์คํ
- ParallelTrialCount: ๋์์ ์คํํ trial์ ๊ฐ์
- MaxTrialCount: ์คํํ ์ ์ฒด trial์ ๊ฐ์. ๋๋ฌํ๋ฉด ์คํ์ด ์ข ๋ฃ๋จ
- MaxFailedTrialCount: ์ต๋ trial ์คํจ ๊ฐ์. ๋๋ฌํ๋ฉด ์คํ์ด ์ข ๋ฃ๋จ
- Parameters
- ํ์ํ ํ์ดํผํ๋ผ๋ฏธํฐ์ ๊ทธ ๋ฒ์๋ฅผ ์ค์
- Name: ํ์ดํผํ๋ผ๋ฏธํฐ ๋ช
- Parameter Type: ํ์ดํผํ๋ผ๋ฏธํฐ์ ํ์ ์ double, int, categorical ์ค์์ ์ ํ
- Type: ๋ฒ์์ ํ์ ์ FeasibleSpace, list ์ค์์ ์ ํ
- Range: Type์ด FeasibleSpace์ด๋ฉด Min๊ณผ Max๋ก, Type์ด list์ด๋ฉด ๋ฒ์ฃผํ์ผ๋ก ํ์ ๋ฒ์๋ฅผ ์ค์
- ํ์ํ ํ์ดํผํ๋ผ๋ฏธํฐ์ ๊ทธ ๋ฒ์๋ฅผ ์ค์
- Objective
- ํ๊ฐ ์งํ์ ๋ชฉํ๊ฐ์ ์ค์
- Type: Maximize์ Minimize ์ค์์ ์ ํ
- Goal: ํ๊ฐ ์งํ์ ๋ชฉํ๊ฐ
- ObjectiveMetricName: ํ๊ฐ ์งํ๋ช
- ํ๊ฐ ์งํ์ ๋ชฉํ๊ฐ์ ์ค์
- YAML file ์ฝ๊ธฐ
- ํธ์ง: yaml ํ์ผ์ ์์
- ์ ๋ก๋: ์ฌ์ฉ์๊ฐ ๋ก์ปฌ์์ ๋ฏธ๋ฆฌ ์์ฑํด ๋์ yaml ํ์ผ์ ์ ๋ก๋
- ์์ฑ: ์คํ์ ์์ฑ ๋ฐ ์คํ
๊ฒฐ๊ณผ ์์ธ
- ObjectiveMetricName์์ ์ค์ ํ ํ๊ฐ ์งํ๋ฅผ ๊ธฐ์ค์ผ๋ก ํ์ดํผํ๋ผ๋ฏธํฐ ์กฐํฉ๋ณ ๊ฒฐ๊ณผ ํ์ ๊ทธ๋ํ ์ ๊ณต
- VIEW EXPERIMENT์์ AutoDL experiment๋ฅผ ์คํํ yaml ํ์ผ๊ณผ ์ต์ ์กฐํฉ์ ํ์ธ
์ฃผ์์ฌํญ
์ฝ๋ ์์ฑ์ ์ ์ ์ฌํญ
Argument parser๋ฅผ ํตํด ํ์ดํผํ๋ผ๋ฏธํฐ ์ค์
def build_parser():parser = ArgumentParser()######### ์ ์ฅํ ํด๋ ์ค์ #########parser.add_argument("--save_path", dest="save_path", default="filestorage/result/I_event_model", type=str)parser.add_argument("--dir_name", dest="dir_name", default=None, type=str)##LOG optionparser.add_argument("--log_name", dest="log_name", default="train_event_log.txt", type=str)##Common optionparser.add_argument("--device", dest="device", default="gpu", help='gpu, cpu, cuda', type=str)##Loader optionparser.add_argument("--label_path", dest="label_path", default='filestorage/result/F_label/future_class_hynix_1d.csv', type=str)parser.add_argument("--test_portion", dest="test_portion", default=0.19, type=float)parser.add_argument("--window_size", dest="window_size", default=3, type=int)parser.add_argument("--max_doc_length", dest="max_doc_length", default=50, type=int)parser.add_argument("--max_sent_length", dest="max_sent_length", default=3, type=int)parser.add_argument("--num_worker", dest="num_worker", default=4, type=int)##Model optionparser.add_argument("--hidden_size", dest="hidden_size", default=16, type=int)parser.add_argument("--n_layers", dest="n_layers", default=2, type=int)parser.add_argument("--dropout_p", dest="dropout_p", default=0.01, type=float)parser.add_argument("--num_class", dest="num_class", default=2, type=int)##Train optionparser.add_argument("--n_epochs", dest="n_epochs", default=5, type=int)parser.add_argument("--lr", dest="lr", default=0.001, type=float)parser.add_argument("--early_stop", dest="early_stop", default=70, type=int)parser.add_argument("--batch_size", dest="batch_size", default=128, type=int)config = parser.parse_args()return configAutoDL์์ ํ๊ฐ ์งํ๋ฅผ ์์งํ ์ ์๋๋ก Metrics Collector์ metricsFormat์ ๋ง์ถ์ด ํ๊ฐ ์งํ๋ฅผ ์ถ๋ ฅ
print("lastEpoch {} f1-score={:.4f} accuracy={:.4f}".format(str(history["last_epoch"]), f1_score, accuracy))๋ฉ์ธ ๋ชจ๋ธ ํ์ผ ์ธ์ ์ ๋ ฅ ๋ฐ์ดํฐ ๋ฐ ์ปค์คํ ๋ชจ๋ ๋ฑ์ filestorage ํด๋์ ์์น์ํด
filestorage ํด๋ ๋ช ์ ์์ ํ๊ฑฐ๋ ์ญ์ ํ๋ฉด ์ ๋จ
ํ์ดํผํ๋ผ๋ฏธํฐ ํ๋ ์๊ณ ๋ฆฌ์ฆ
Grid Search
- Int, double type์ parameter๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ, step(๊ฐ๊ฒฉ)์ ์ค์ ํด์ผ ํจ
Hyperband
- resource_name, eta, r_l๋ฅผ ์ค์ ํด์ผ ํจ
- resource_name์ผ๋ก ์ค์ ํ ํ์ดํผํ๋ผ๋ฏธํฐ๋ Parameters์ ์ถ๊ฐ๋์ด ์์ด์ผ ํจ
- eta, r_l์ ๋ฐ๋ผ ParallelTrialCount์ ์ต์๊ฐ์ด ๊ฒฐ์ ๋จ
smax=int(mat.log(r_l)/math.log(eta))
max_parallel=int(math.ceil(eta**smax)) - ParallelTrialCount์ MaxTrialCount๋ ๋์ผํ ๊ฐ์ ๊ฐ์ ธ์ผ ํจ
- ์๋ฅผ ๋ค์ด, resource_name๋ --epoch์ด๊ณ eta=3, r_l=9์ธ ๊ฒฝ์ฐ,
eta์ r_l์ ์ํด ParallelTrialCount์ ์ต์๊ฐ์ 9์
ParallelTrialCount๋ฅผ 9๋ก, epoch์ 27๋ก ์ค์ ํ๋ค๋ฉด 9๊ฐ์ trial์ด ๋์์ 3 epoch์ฉ ์คํ๋จ