From 3911994bad2a60ce54a2e7d522fb04e96cbd7308 Mon Sep 17 00:00:00 2001 From: omry Date: Thu, 15 Feb 2024 18:58:57 +0000 Subject: [PATCH] Deploy website - based on d6df211b03579b48943922a019f73ca947aaceec --- 404.html | 4 ++-- assets/js/{1e1bc213.de964369.js => 0169dbe1.ca0f52b0.js} | 2 +- assets/js/0169dbe1.e79d0918.js | 1 - assets/js/{028aaae6.7f44a906.js => 028aaae6.fa26fe80.js} | 2 +- assets/js/02deea7a.9d47866f.js | 1 + assets/js/02deea7a.eec514b9.js | 1 - assets/js/03322abc.4a95b63c.js | 1 + assets/js/03322abc.daee8556.js | 1 - assets/js/0413c37e.265195ed.js | 1 - assets/js/{f1aff4d7.cf2a79ae.js => 0413c37e.ab4a567f.js} | 2 +- assets/js/043fc566.f1d3d5a2.js | 1 + assets/js/043fc566.fcdc95cb.js | 1 - assets/js/05d1ea85.10de91bf.js | 1 + assets/js/05d1ea85.cef66cab.js | 1 - assets/js/{06056e6c.ee9716ff.js => 06056e6c.28d8fa0e.js} | 2 +- assets/js/{0689266f.6188347b.js => 0689266f.a28fa646.js} | 2 +- assets/js/06963ee3.623e8789.js | 1 - assets/js/06963ee3.a88a7dcd.js | 1 + assets/js/07586c7f.03dd9c03.js | 1 - assets/js/07586c7f.389ee1bb.js | 1 + assets/js/0a4b398d.8302eaed.js | 1 + assets/js/{0a7b70ce.ae5b7173.js => 0a7b70ce.6fee88ee.js} | 2 +- assets/js/0aa416e4.66f88d38.js | 1 + assets/js/0b3cc50a.47125348.js | 1 + assets/js/0b3cc50a.f925b508.js | 1 - assets/js/0e384e19.531edde4.js | 1 - assets/js/0e384e19.de3b1a0e.js | 1 + assets/js/{0e5950c6.8252b995.js => 0e5950c6.392685fb.js} | 2 +- assets/js/{0e71d84b.9a2cc699.js => 0e71d84b.02f2bd4f.js} | 2 +- assets/js/{0fa51aec.3330f1fe.js => 0fa51aec.d89df1b0.js} | 2 +- assets/js/{478ff238.761789a1.js => 10abfaeb.3956bacb.js} | 2 +- assets/js/10abfaeb.b592e38c.js | 1 - assets/js/10c36d6f.3955b903.js | 1 - assets/js/10c36d6f.432d15e4.js | 1 + assets/js/10dd8346.505405a0.js | 1 + assets/js/10e059cb.39783cac.js | 1 - assets/js/10e059cb.4e441dfb.js | 1 + assets/js/{10fbd247.1aeae81a.js => 10fbd247.bbe9a1be.js} | 2 +- assets/js/{120f5b8b.7566b270.js => 120f5b8b.817b362d.js} | 2 +- assets/js/12111f85.37b9a36a.js | 1 + assets/js/12111f85.d44f5bce.js | 1 - assets/js/13a26e00.59e5217b.js | 1 + assets/js/13a26e00.6e0890cd.js | 1 - assets/js/14173c40.50b666cb.js | 1 + assets/js/14173c40.e8062592.js | 1 - assets/js/141a01e8.afff0d76.js | 1 - assets/js/141a01e8.c9a4c975.js | 1 + assets/js/1434836b.048d8a68.js | 1 + assets/js/1434836b.38f413ec.js | 1 - assets/js/1443f4ed.71e5fa51.js | 1 + assets/js/1483e3dc.0bee4923.js | 1 - assets/js/1483e3dc.e80dee6f.js | 1 + assets/js/1564a8d3.b865df6c.js | 1 + assets/js/1564a8d3.c62cc72c.js | 1 - assets/js/16568db6.464e2262.js | 1 + assets/js/16568db6.8d45b6ad.js | 1 - assets/js/1760e2a5.2496cc98.js | 1 - assets/js/1760e2a5.24a57751.js | 1 + assets/js/{176287c7.686575f4.js => 176287c7.82163e8b.js} | 2 +- assets/js/17885660.59bd37a3.js | 1 + assets/js/17885660.fa375f9b.js | 1 - assets/js/{17b1a13a.ffc95d23.js => 17b1a13a.ce6bde8f.js} | 2 +- assets/js/{17e73f1c.935516a4.js => 17e73f1c.61e4628c.js} | 2 +- assets/js/18954878.820967bb.js | 1 - assets/js/18954878.962e6c9f.js | 1 + assets/js/18d93f34.0ae73cbd.js | 1 - assets/js/18d93f34.5bb7e0be.js | 1 + assets/js/{1b0e2224.febf00f1.js => 1b0e2224.90e72d44.js} | 2 +- assets/js/1c10768b.5b32cf67.js | 1 + assets/js/1c10768b.695f5d9f.js | 1 - assets/js/1c50c1b8.13d1aad9.js | 1 - assets/js/1c50c1b8.1bb94a2b.js | 1 + assets/js/1d831f5a.4e829cea.js | 1 + assets/js/1d9190c2.3d894be4.js | 1 - assets/js/1d9190c2.6b79df4e.js | 1 + assets/js/1e1bc213.e1e5fcb8.js | 1 + assets/js/1e2eb92a.5dfeb6cb.js | 1 - assets/js/1e2eb92a.aa825cf2.js | 1 + assets/js/{1e3a3c98.65ec0a7e.js => 1e3a3c98.698f51bb.js} | 2 +- assets/js/1e3f28fe.c5782ef7.js | 1 + assets/js/{1f1bf95b.3cc7237a.js => 1f1bf95b.a2678353.js} | 2 +- assets/js/1f4529b5.568c8e85.js | 1 - assets/js/1f4529b5.d6adfa71.js | 1 + assets/js/208d083d.24ae8c46.js | 1 - assets/js/208d083d.90c3b30e.js | 1 + assets/js/213609f5.0f1c064b.js | 1 - assets/js/{7303162f.290a5388.js => 213609f5.1c7bc203.js} | 2 +- assets/js/215ac4d9.8199d115.js | 1 - assets/js/215ac4d9.dc2c4e5f.js | 1 + assets/js/215cc2c0.9fe8a7a8.js | 1 + assets/js/215cc2c0.ee239f3e.js | 1 - assets/js/2174f925.5924f7fe.js | 1 - assets/js/2174f925.df7cad4a.js | 1 + assets/js/21854093.03799f7b.js | 1 + assets/js/21edddaf.1a9660a7.js | 1 - assets/js/21edddaf.ba823e57.js | 1 + assets/js/2205f950.77e41aa3.js | 1 - assets/js/{0a4b398d.24d71bf2.js => 2205f950.b768e25f.js} | 2 +- assets/js/{22abb723.ff0ed002.js => 22abb723.7a26085b.js} | 2 +- assets/js/{2380203e.b144db19.js => 2380203e.5ed08d0a.js} | 2 +- assets/js/240de8c7.1f2f385f.js | 1 + assets/js/240de8c7.be5922a1.js | 1 - assets/js/{25a59092.92103ef2.js => 25a59092.dc3ffbd4.js} | 2 +- assets/js/2682ecde.1c0c75d6.js | 1 - assets/js/2682ecde.2f64130a.js | 1 + assets/js/27546d3e.2ad6e9b7.js | 1 + assets/js/27546d3e.8073fc4e.js | 1 - assets/js/{27af8fe6.a6aebc19.js => 27af8fe6.7bba35db.js} | 2 +- assets/js/27f5d38d.2ecff687.js | 1 - assets/js/27f5d38d.a4e6e547.js | 1 + assets/js/2862967f.4edc24f0.js | 1 - assets/js/{3e5c2e49.fadca57b.js => 2862967f.ab14c1e5.js} | 2 +- assets/js/{6bc4497f.7b73b793.js => 28a7fcb4.4ad20b9a.js} | 2 +- assets/js/28a7fcb4.f476225b.js | 1 - assets/js/290e3655.1f92d1ad.js | 1 + assets/js/290e3655.c970cd85.js | 1 - assets/js/{2c8fa177.ad6879b6.js => 2c8fa177.fc8ba043.js} | 2 +- assets/js/2cac4d70.69fe625e.js | 1 - assets/js/2cac4d70.bc1bbe25.js | 1 + assets/js/{2ceb009d.3aa5b9d0.js => 2ceb009d.2f1e90ef.js} | 2 +- assets/js/2d3c34e0.bb17cd46.js | 1 + assets/js/2d3c34e0.fee18fab.js | 1 - assets/js/2d57dfba.2d50eb01.js | 1 + assets/js/2d57dfba.57643a27.js | 1 - assets/js/{2e99c05e.a729d823.js => 2e99c05e.bb4bb089.js} | 2 +- assets/js/2f529812.4c48686a.js | 1 + assets/js/2f529812.f915b441.js | 1 - assets/js/315f70d7.571f09e6.js | 1 + assets/js/318b0639.10b1543f.js | 1 + assets/js/318b0639.53257903.js | 1 - assets/js/{338ef806.b62797f6.js => 338ef806.29b81ae6.js} | 2 +- assets/js/33afe7db.15fe633d.js | 1 + assets/js/33afe7db.c3d3ffeb.js | 1 - assets/js/3462c84f.4d71d31c.js | 1 + assets/js/3462c84f.d526e17c.js | 1 - assets/js/356d2c93.60b02a0f.js | 1 - assets/js/{79491168.cbb219a7.js => 356d2c93.66607cee.js} | 2 +- assets/js/{35935476.16ec750e.js => 35935476.d0319b0f.js} | 2 +- assets/js/35af814a.c296b27e.js | 1 - assets/js/35af814a.d698c01a.js | 1 + assets/js/{364e9131.4fae5a4e.js => 364e9131.037e02ca.js} | 2 +- assets/js/3721ffec.9731424b.js | 1 + assets/js/3721ffec.bc251f4c.js | 1 - assets/js/37b83927.061713e8.js | 1 - assets/js/37b83927.ad836a45.js | 1 + assets/js/{38d99aff.e5d86610.js => 38d99aff.21ac297d.js} | 2 +- assets/js/38f8d538.825f831b.js | 1 - assets/js/38f8d538.9a0f7089.js | 1 + assets/js/3955c41d.86c0ffbc.js | 1 - assets/js/3955c41d.994812d9.js | 1 + assets/js/{395e7b7b.2cd63a3d.js => 395e7b7b.2051f60c.js} | 2 +- assets/js/3989901c.5ed93d4a.js | 1 + assets/js/3989901c.e9b0c774.js | 1 - assets/js/39a98d83.0b4b17d8.js | 1 - assets/js/39a98d83.35554b6c.js | 1 + assets/js/39fd50bc.884d8ce9.js | 1 - assets/js/39fd50bc.fea564e6.js | 1 + assets/js/{3ab89cf6.bc42c38a.js => 3ab89cf6.b7153633.js} | 2 +- assets/js/3cf33e0d.23a30b49.js | 1 + assets/js/3cf33e0d.651a3299.js | 1 - assets/js/{3d066543.5657881a.js => 3d066543.1ac9e8c0.js} | 2 +- assets/js/3dca537e.231a54ad.js | 1 + assets/js/3dca537e.2c060844.js | 1 - assets/js/3e16a344.db8d0764.js | 1 - assets/js/3e16a344.f004c423.js | 1 + assets/js/3e5c2e49.db4c3759.js | 1 + assets/js/3e7cc949.6acf75cb.js | 1 + assets/js/3e7cc949.fd591c40.js | 1 - assets/js/{3f08a60a.b4b4b6c9.js => 3f08a60a.daeb1a79.js} | 2 +- assets/js/3f5d6c87.47cbe891.js | 1 - assets/js/3f5d6c87.71f4cae3.js | 1 + assets/js/3ff38ccf.94362d7b.js | 1 + assets/js/3ff38ccf.f432e9d2.js | 1 - assets/js/4074bd8f.27edf9f2.js | 1 - assets/js/4074bd8f.45911f53.js | 1 + assets/js/408f478d.8f8c1fdf.js | 1 - assets/js/408f478d.b3ec540d.js | 1 + assets/js/40c5bf50.669ea375.js | 1 + assets/js/40c5bf50.e05b149a.js | 1 - assets/js/{427c7252.8e2940c8.js => 427c7252.2343d6c8.js} | 2 +- assets/js/{42b6b4bf.27c6902b.js => 42b6b4bf.e1fbec9a.js} | 2 +- assets/js/{42bfec69.2f99267b.js => 42bfec69.0e4ec3e4.js} | 2 +- assets/js/4372d0ca.24e1441b.js | 1 - assets/js/4372d0ca.b84eef14.js | 1 + assets/js/{f2b6f2a5.58e838e4.js => 43c904aa.be1e5bd0.js} | 2 +- assets/js/43c904aa.bf9d7a56.js | 1 - assets/js/{441b9731.414fc415.js => 441b9731.3aefdbc5.js} | 2 +- assets/js/{44d746fc.a5fb5dc6.js => 44d746fc.cf8d3643.js} | 2 +- assets/js/{4561b7e2.1660b948.js => 4561b7e2.7f5ec4e4.js} | 2 +- assets/js/{45c1c4a6.38817094.js => 45c1c4a6.11ed09be.js} | 2 +- assets/js/{46dd2a73.c564c5f9.js => 46dd2a73.92e2648c.js} | 2 +- assets/js/478ff238.f3fd58a6.js | 1 + assets/js/48f36528.2e7f9b2b.js | 1 - assets/js/48f36528.83ed4fb3.js | 1 + assets/js/49cef19b.561e02b6.js | 1 - assets/js/49cef19b.c2301192.js | 1 + assets/js/{4a4fc0d2.c6c69dc3.js => 4a4fc0d2.6b6ddb8d.js} | 2 +- assets/js/{4a8b0891.93481b42.js => 4a8b0891.54da9aa4.js} | 2 +- assets/js/4b16ce42.155654bf.js | 1 - assets/js/4b16ce42.e02f3622.js | 1 + assets/js/{4cba40dc.522266d5.js => 4cba40dc.becefe8b.js} | 2 +- assets/js/4cdabbab.95be2575.js | 1 + assets/js/4eeb0b32.461d5354.js | 1 + assets/js/4eeb0b32.aa3f4570.js | 1 - assets/js/4f5ea895.1dd64d3d.js | 1 + assets/js/4f5ea895.87c69993.js | 1 - assets/js/4fbd2ab8.445630ed.js | 1 + assets/js/4fbd2ab8.7f362d2a.js | 1 - assets/js/4fcbe075.5c105a5a.js | 1 + assets/js/4fcbe075.ed1ba569.js | 1 - assets/js/4fd99ad7.136792ab.js | 1 + assets/js/{50036cfd.484ad41f.js => 50036cfd.b30cf6bb.js} | 2 +- assets/js/502fd0fa.1f421edc.js | 1 + assets/js/502fd0fa.af410c9f.js | 1 - assets/js/50919e5f.41670687.js | 1 - assets/js/50919e5f.b3347460.js | 1 + assets/js/509e4e5c.82438789.js | 1 - assets/js/509e4e5c.af5eeed9.js | 1 + assets/js/50e12e40.215f0ca1.js | 1 + assets/js/52e31a99.26be4d43.js | 1 + assets/js/52e31a99.3cdfc83d.js | 1 - assets/js/55ac25ed.6d8c52f3.js | 1 + assets/js/55ac25ed.a27e9edd.js | 1 - assets/js/5644e108.4053dd9e.js | 1 - assets/js/{4cdabbab.a43d689e.js => 5644e108.877a6490.js} | 2 +- assets/js/56b400d0.288df516.js | 1 - assets/js/{1d831f5a.fffd4d0b.js => 56b400d0.cf095495.js} | 2 +- assets/js/56f07402.1697d7c5.js | 1 + assets/js/56f07402.44fade4f.js | 1 - assets/js/5713876c.624c9be5.js | 1 - assets/js/5713876c.9130252e.js | 1 + assets/js/59487f02.020c1b7c.js | 1 - assets/js/{21854093.f16835ae.js => 59487f02.36073bf4.js} | 2 +- assets/js/59b3e5d6.89e59a7e.js | 1 + assets/js/59b3e5d6.eefb8052.js | 1 - assets/js/{5a6cb2f1.325db74e.js => 5a6cb2f1.046dfed3.js} | 2 +- assets/js/{5aeeabc8.c6dc76fa.js => 5aeeabc8.3d32e29f.js} | 2 +- assets/js/{5b46d51b.1b8894c5.js => 5b46d51b.0a40b234.js} | 2 +- assets/js/{5c328b3e.4bd79f16.js => 5c328b3e.c4e51b92.js} | 2 +- assets/js/5cbd420b.637c6624.js | 1 + assets/js/5cbd420b.f2bd32c6.js | 1 - assets/js/5dfb4dbd.8cedb688.js | 1 + assets/js/5dfb4dbd.a46fb84a.js | 1 - assets/js/{5e9ce6b2.1ba37133.js => 5e9ce6b2.cc7fb010.js} | 2 +- assets/js/5ed0b598.19f82507.js | 1 + assets/js/5ed0b598.318b4ed1.js | 1 - assets/js/5f458459.2fd01979.js | 1 - assets/js/5f458459.71cd7a6c.js | 1 + assets/js/5f92c861.d6a669e6.js | 1 + assets/js/5f92c861.e91b8899.js | 1 - assets/js/5f998a2f.96689d56.js | 1 + assets/js/5f998a2f.a8b37b95.js | 1 - assets/js/6069dd8f.3d9c7ee5.js | 1 - assets/js/6069dd8f.4020b3a2.js | 1 + assets/js/{60b44bb3.307b0835.js => 60b44bb3.cd6b02e5.js} | 2 +- assets/js/614bf889.aaba91cf.js | 1 - assets/js/614bf889.d0cd4e0f.js | 1 + assets/js/616c3c5f.1cdca731.js | 1 + assets/js/616c3c5f.bd691e7a.js | 1 - assets/js/{630c0586.c70b91cf.js => 630c0586.3d0a2222.js} | 2 +- assets/js/{633c1607.89502a88.js => 633c1607.161382be.js} | 2 +- assets/js/{315f70d7.f7772db5.js => 63e50675.01233995.js} | 2 +- assets/js/63e50675.4297b82d.js | 1 - assets/js/{63f4f69b.96e28581.js => 63f4f69b.e025fb7b.js} | 2 +- assets/js/6640fadb.2a263df0.js | 1 - assets/js/6640fadb.9fe22cfe.js | 1 + assets/js/{67577ba3.6bcff61d.js => 67577ba3.2b5d76ef.js} | 2 +- assets/js/677cd0d0.0e545643.js | 1 + assets/js/677cd0d0.a3136fa6.js | 1 - assets/js/{6820665d.c22c5d41.js => 6820665d.4b5ff88d.js} | 2 +- assets/js/6860aade.49b86ed0.js | 1 - assets/js/6860aade.fe4a8975.js | 1 + assets/js/{69e166e6.aec8046e.js => 69e166e6.b996d0bc.js} | 2 +- assets/js/6a3f97e9.26250eac.js | 1 + assets/js/6a3f97e9.c7f68fb4.js | 1 - assets/js/6a5f4378.605f245e.js | 1 + assets/js/6a5f4378.9df15c40.js | 1 - assets/js/6a776bdd.11aef138.js | 1 - assets/js/{10dd8346.e6eb5a40.js => 6a776bdd.33947d69.js} | 2 +- assets/js/6bc4497f.df3ef900.js | 1 + assets/js/{6ce368a3.af02e414.js => 6ce368a3.f5eb1e9f.js} | 2 +- assets/js/6d1e9f65.b59e638a.js | 1 - assets/js/6d1e9f65.f1c33b61.js | 1 + assets/js/{6dd10ff9.1bca96c4.js => 6dd10ff9.d0f53e5d.js} | 2 +- assets/js/{6e04c99e.f82c0fb5.js => 6e04c99e.594c9f82.js} | 2 +- assets/js/{f045e7b7.85347ddc.js => 6e3ad032.0b66d669.js} | 2 +- assets/js/6e3ad032.57d009b8.js | 1 - assets/js/{6e45c04d.ec1fdd8c.js => 6e45c04d.c1bec811.js} | 2 +- assets/js/6e8f824f.3bf40882.js | 1 + assets/js/6e8f824f.fcacc816.js | 1 - assets/js/{6f4ef943.2cd06597.js => 6f4ef943.bd733d86.js} | 2 +- assets/js/708f8d61.22d52505.js | 1 - assets/js/708f8d61.4935a0a9.js | 1 + assets/js/7099ba54.3af58104.js | 1 - assets/js/7099ba54.72e93bbc.js | 1 + assets/js/716c9898.48033f5a.js | 1 - assets/js/716c9898.d4cfa1da.js | 1 + assets/js/7185c610.a883142c.js | 1 + assets/js/7185c610.f766119c.js | 1 - assets/js/72c1f20b.61c48f83.js | 1 - assets/js/72c1f20b.c1872017.js | 1 + assets/js/7303162f.e2092c41.js | 1 + assets/js/745b747c.4b5d123f.js | 1 - assets/js/745b747c.b8558566.js | 1 + assets/js/{74759a1d.2abc1c7e.js => 74759a1d.89b75277.js} | 2 +- assets/js/{74d44509.92412fc8.js => 74d44509.0de4d5fb.js} | 2 +- assets/js/74ebec6a.deb7a647.js | 1 - assets/js/74ebec6a.eed1087b.js | 1 + assets/js/{75302c49.5bb0a4f2.js => 75302c49.667ab493.js} | 2 +- assets/js/7545587d.ee923580.js | 1 - assets/js/7545587d.fa3d9e6c.js | 1 + assets/js/75ab057d.8e50ae3b.js | 1 + assets/js/75ab057d.fdc0c98e.js | 1 - assets/js/7618e133.a0a9aa35.js | 1 - assets/js/7618e133.e73bf9d2.js | 1 + assets/js/76d95e5c.1035a5ce.js | 1 + assets/js/76d95e5c.98e43164.js | 1 - assets/js/778a9245.52bb1dd4.js | 1 - assets/js/778a9245.b33afa5e.js | 1 + assets/js/{782c6007.28231cd9.js => 782c6007.e7bd0bbe.js} | 2 +- assets/js/{786c47e0.9cf1c460.js => 786c47e0.bde7816d.js} | 2 +- assets/js/{dba30cc3.853fc089.js => 79491168.3e566cc8.js} | 2 +- assets/js/7a554e78.52336f85.js | 1 - assets/js/7a554e78.724af6fa.js | 1 + assets/js/7a9a7793.5a65253b.js | 1 + assets/js/7b1770b7.174514d2.js | 1 - assets/js/7b1770b7.1f7ad088.js | 1 + assets/js/{0aa416e4.d61046d3.js => 7b2d9031.8f4c61e1.js} | 2 +- assets/js/7b2d9031.9cd88ca6.js | 1 - assets/js/{7bbaa3fd.9b4a80f1.js => 7bbaa3fd.af7b2d6e.js} | 2 +- assets/js/7bd8db71.384128b2.js | 1 - assets/js/7bd8db71.44a33105.js | 1 + assets/js/{7bff0330.604bd494.js => 7bff0330.69d0c41b.js} | 2 +- assets/js/7c2d24a0.2383c4c0.js | 1 - assets/js/7c2d24a0.aa937b42.js | 1 + assets/js/{7cdda714.e7dbc7cd.js => 7cdda714.e6ce9e93.js} | 2 +- assets/js/{7e5eaca3.a0ce4cdd.js => 7e5eaca3.407b5a75.js} | 2 +- assets/js/{7eebe738.4560fb74.js => 7eebe738.15caaaaf.js} | 2 +- assets/js/7f295f25.590a8a65.js | 1 + assets/js/7f295f25.da885120.js | 1 - assets/js/7f9218ea.10926291.js | 1 - assets/js/7f9218ea.72384585.js | 1 + assets/js/822b3119.a98bd0bf.js | 1 - assets/js/822b3119.f4d9a350.js | 1 + assets/js/829ea0d8.74e9b0e8.js | 1 + assets/js/{848d8688.0644699c.js => 848d8688.fc51b9bd.js} | 2 +- assets/js/{84ed7bc0.15900fd8.js => 84ed7bc0.f119d912.js} | 2 +- assets/js/854c9b92.99ecdc12.js | 1 - assets/js/854c9b92.db2599e0.js | 1 + assets/js/86627abc.6564fa7a.js | 1 - assets/js/{4fd99ad7.01581955.js => 86627abc.e66ff675.js} | 2 +- assets/js/{86824b0d.31443cd1.js => 86824b0d.9345414d.js} | 2 +- assets/js/8686a231.35636ce1.js | 1 - assets/js/8686a231.b2d997e9.js | 1 + assets/js/{872f83ed.0e67c0e0.js => 872f83ed.449249f6.js} | 2 +- assets/js/{87ba6c01.f88a0e3d.js => 87ba6c01.efc5f88d.js} | 2 +- assets/js/{8825f040.3fd88dc1.js => 8825f040.dca277e4.js} | 2 +- assets/js/885c3eed.7926480e.js | 1 - assets/js/885c3eed.84f23cf3.js | 1 + assets/js/88738dec.60a172da.js | 1 - assets/js/88738dec.cfaf97ca.js | 1 + assets/js/88cd306c.a1d977c8.js | 1 - assets/js/88cd306c.c7045164.js | 1 + assets/js/{897ccb8c.1ba865d0.js => 897ccb8c.9c64b198.js} | 2 +- assets/js/8a613fda.2e0b9a53.js | 1 + assets/js/8a613fda.6cd69134.js | 1 - assets/js/{1443f4ed.278c3413.js => 8b9d128b.c47e6976.js} | 2 +- assets/js/8b9d128b.ef7ca228.js | 1 - assets/js/8c58d523.5b41f32c.js | 1 - assets/js/8c58d523.5fcf9a72.js | 1 + assets/js/8caa8a00.0f19b4eb.js | 1 - assets/js/8caa8a00.5b9ba429.js | 1 + assets/js/8d09ef80.70a09e5b.js | 1 + assets/js/8d09ef80.a3b8aa69.js | 1 - assets/js/{8d949470.d6952492.js => 8d949470.7acbf8b2.js} | 2 +- assets/js/{8fb47936.3f20ecc8.js => 8fb47936.f492469b.js} | 2 +- assets/js/8fce6473.379c2566.js | 1 + assets/js/8fce6473.4a6095c5.js | 1 - assets/js/903a24c7.302c2ff8.js | 1 + assets/js/903a24c7.507b4f50.js | 1 - assets/js/{50e12e40.8d04c83c.js => 9179e1fd.0caed1e5.js} | 2 +- assets/js/9179e1fd.437c3741.js | 1 - assets/js/939aec07.357d07dc.js | 1 + assets/js/939aec07.f6ef11c8.js | 1 - assets/js/{939d8e48.1e44b5fa.js => 939d8e48.16c8bb90.js} | 2 +- assets/js/94e13d9f.e7f73dcf.js | 1 + assets/js/965844a6.8de32c04.js | 1 - assets/js/965844a6.b7015cf5.js | 1 + assets/js/{967cd6f1.b0edf112.js => 967cd6f1.1e70f997.js} | 2 +- assets/js/97ebb3c3.1dfb3c05.js | 1 + assets/js/97ebb3c3.43adf073.js | 1 - assets/js/{98a7e8c2.5299a206.js => 98a7e8c2.f3011ce4.js} | 2 +- assets/js/98de558e.5063c841.js | 1 - assets/js/98de558e.94ef12b5.js | 1 + assets/js/9b2d48a8.c819c812.js | 1 + assets/js/9b2d48a8.df607282.js | 1 - assets/js/{94e13d9f.8a871bbb.js => 9bb6a893.11b68303.js} | 2 +- assets/js/9bb6a893.aedf09b8.js | 1 - assets/js/9bf318bc.33f1e1f1.js | 1 + assets/js/9bf318bc.f88f848e.js | 1 - assets/js/9c48a3c3.b10fafba.js | 1 - assets/js/9c48a3c3.bc99bb67.js | 1 + assets/js/9c519060.36b66e53.js | 1 - assets/js/9c519060.56ecdb7c.js | 1 + assets/js/{9c663d15.3d4d8e7e.js => 9c663d15.a566ba20.js} | 2 +- assets/js/9cd9e94b.00d652a7.js | 1 + assets/js/9cd9e94b.25a780ca.js | 1 - assets/js/9d7f1f4e.3c38deb1.js | 1 + assets/js/9d7f1f4e.84ef8d56.js | 1 - assets/js/{9ea7bff0.7c995c9b.js => 9ea7bff0.58898870.js} | 2 +- assets/js/{9f4fc3a5.4676ea6f.js => 9f4fc3a5.4e77d862.js} | 2 +- assets/js/a0e70061.8b4238fb.js | 1 - assets/js/a0e70061.de3aff40.js | 1 + assets/js/a2999c7b.c459d196.js | 1 - assets/js/a2999c7b.c615aa55.js | 1 + assets/js/{a2cf3e59.23034402.js => a2cf3e59.3d2a70c4.js} | 2 +- assets/js/{a3c59622.dffc9c0d.js => a3c59622.0e20a29e.js} | 2 +- assets/js/{a4de3295.f43a0d6a.js => a4de3295.e9631e48.js} | 2 +- assets/js/a6f269d3.2df3a6fc.js | 1 + assets/js/a6f269d3.74d04c77.js | 1 - assets/js/a75904f3.0c6c93fd.js | 1 + assets/js/a75904f3.200176d4.js | 1 - assets/js/a7e19356.8683a77e.js | 1 + assets/js/a7e19356.db816234.js | 1 - assets/js/a8448cb9.6f8c663a.js | 1 - assets/js/{829ea0d8.519befe1.js => a8448cb9.b3014463.js} | 2 +- assets/js/aa54ad12.19abde00.js | 1 + assets/js/aa54ad12.725bcc1f.js | 1 - assets/js/ab7f36eb.633f5963.js | 1 + assets/js/ac458ff7.15ac0b60.js | 1 + assets/js/ac458ff7.25ec84f1.js | 1 - assets/js/acda1e9a.62601357.js | 1 + assets/js/acda1e9a.67ab3473.js | 1 - assets/js/{ad46b7fa.73e7c6ad.js => ad46b7fa.ad1f7deb.js} | 2 +- assets/js/aeed717b.62e6e664.js | 1 + assets/js/aeed717b.ba318044.js | 1 - assets/js/{af1d2a20.cea10546.js => af1d2a20.6129d6b4.js} | 2 +- assets/js/b3513936.93597101.js | 1 - assets/js/b3513936.d675af76.js | 1 + assets/js/{b3598656.429ce049.js => b3598656.ba7247f4.js} | 2 +- assets/js/{b3852a80.6933d545.js => b3852a80.0e498c01.js} | 2 +- assets/js/b3b28758.27709425.js | 1 + assets/js/b3b28758.8b6cb505.js | 1 - assets/js/{b613d2b0.a22ac46f.js => b613d2b0.5f48174b.js} | 2 +- assets/js/{b6b7462b.cd2d3da6.js => b6b7462b.bb2370eb.js} | 2 +- assets/js/b7738e77.901f8721.js | 1 + assets/js/b7738e77.c51a3648.js | 1 - assets/js/{b8f8efa9.cc1cb748.js => b8f8efa9.31c4c577.js} | 2 +- assets/js/{b98442e5.8025a7f7.js => b98442e5.dbe77e92.js} | 2 +- assets/js/ba80fff7.516b72f2.js | 1 - assets/js/ba80fff7.ed9a2284.js | 1 + assets/js/bab3d5c4.0d3e12e3.js | 1 - assets/js/bab3d5c4.e4ffa122.js | 1 + assets/js/bb3d1fd8.ab5434d0.js | 1 + assets/js/bb3d1fd8.ffcfeb53.js | 1 - assets/js/bbadfede.5e3d010e.js | 1 + assets/js/bbadfede.f271bc2d.js | 1 - assets/js/c0a31065.2adb126b.js | 1 - assets/js/c0a31065.a87d9d25.js | 1 + assets/js/c0a597be.9e69f870.js | 1 - assets/js/c0a597be.e61676f6.js | 1 + assets/js/{c15d2dfd.689305f1.js => c15d2dfd.11486c6b.js} | 2 +- assets/js/c16d8146.77e647d6.js | 1 - assets/js/c16d8146.c0b7a86d.js | 1 + assets/js/c23d0401.4aa1aadb.js | 1 - assets/js/c23d0401.dbb5ed99.js | 1 + assets/js/c2ab93b1.0629cadc.js | 1 - assets/js/c2ab93b1.d768c67a.js | 1 + assets/js/{c343b34f.7cf5f70e.js => c343b34f.47cc5e4c.js} | 2 +- assets/js/{c3883936.7f65b339.js => c3883936.69ca83e1.js} | 2 +- assets/js/{c399ec27.97387419.js => c399ec27.d82ec406.js} | 2 +- assets/js/{c5085584.f1e9fbed.js => c5085584.6987b4c8.js} | 2 +- assets/js/{c6038e1b.9065c830.js => c6038e1b.c5b8be9a.js} | 2 +- assets/js/{c60805be.b1286331.js => c60805be.eae39302.js} | 2 +- assets/js/c64f3a69.00cc6093.js | 1 + assets/js/c64f3a69.cc8408fa.js | 1 - assets/js/{c723c0cc.118a236d.js => c723c0cc.7b7cc99f.js} | 2 +- assets/js/c7fbc0ef.1ca14613.js | 1 - assets/js/c7fbc0ef.6e7b3adf.js | 1 + assets/js/c822c14e.163b14fe.js | 1 - assets/js/c822c14e.b5c6aebd.js | 1 + assets/js/c84d9142.0bf34fe1.js | 1 + assets/js/c84d9142.d3bfcb5a.js | 1 - assets/js/{c8df61ff.0a67c754.js => c8df61ff.52c7c58d.js} | 2 +- assets/js/c92127f8.13640964.js | 1 + assets/js/c92127f8.5bab74c5.js | 1 - assets/js/c9cd668e.66732cfe.js | 1 - assets/js/c9cd668e.8335d969.js | 1 + assets/js/{ca18adae.32fd3af5.js => ca18adae.472ebde4.js} | 2 +- assets/js/{ffb45ffd.0a254235.js => ca555eb7.15ffd6ec.js} | 2 +- assets/js/ca555eb7.d3539520.js | 1 - assets/js/{cac9ed2c.cc42edd8.js => cac9ed2c.6d0ad2ad.js} | 2 +- assets/js/cba6b6af.41fd2045.js | 1 - assets/js/cba6b6af.743b1b2a.js | 1 + assets/js/{cbc1ba65.6e126df8.js => cbc1ba65.e57f07db.js} | 2 +- assets/js/cd9b1c9a.67bdc03f.js | 1 + assets/js/cd9b1c9a.a69f595c.js | 1 - assets/js/{cdaa6d95.9a752298.js => cdaa6d95.14c7a070.js} | 2 +- assets/js/{cf3af301.c04ce4bb.js => cf3af301.5efab20d.js} | 2 +- assets/js/{d015a450.741ff624.js => d015a450.600eae63.js} | 2 +- assets/js/d0407f30.1f570c33.js | 1 + assets/js/d0407f30.390b443b.js | 1 - assets/js/{d3423e10.52f4e15c.js => d3423e10.f6733019.js} | 2 +- assets/js/d42a51a7.472b1b4e.js | 1 + assets/js/d42a51a7.594b4d8b.js | 1 - assets/js/d45de8b2.a3d5e9fb.js | 1 - assets/js/d45de8b2.b57b7bca.js | 1 + assets/js/d56aca12.8e3e433e.js | 1 - assets/js/d56aca12.e5c0e8de.js | 1 + assets/js/{d7171b57.c5380824.js => d7171b57.fdb7c1d9.js} | 2 +- assets/js/{d7e03563.b5b41400.js => d7e03563.2852b237.js} | 2 +- assets/js/d80994d3.9ddfc2f5.js | 1 + assets/js/d80994d3.eb5f2a88.js | 1 - assets/js/d8462e79.a8153383.js | 1 + assets/js/d8462e79.f99c8297.js | 1 - assets/js/d8df352c.0dcaff33.js | 1 + assets/js/d8df352c.eabfb865.js | 1 - assets/js/db14d48d.47080618.js | 1 + assets/js/db14d48d.84b14ced.js | 1 - assets/js/dba30cc3.97c8545f.js | 1 + assets/js/dc15f746.bd7c3078.js | 1 + assets/js/dc15f746.dee8c45e.js | 1 - assets/js/{dc194db1.6c6a2b2e.js => dc194db1.025d31f6.js} | 2 +- assets/js/dc4070cd.29ba74e9.js | 1 + assets/js/dc4070cd.69c62b49.js | 1 - assets/js/dc5374e7.95a2aa90.js | 1 - assets/js/dc5374e7.c1a39806.js | 1 + assets/js/dc88b3e9.2451965e.js | 1 + assets/js/dc88b3e9.7162991b.js | 1 - assets/js/dca1894e.244ba8e7.js | 1 - assets/js/dca1894e.7236dc0c.js | 1 + assets/js/dcd98c64.6341f514.js | 1 + assets/js/dcd98c64.91638dcf.js | 1 - assets/js/dd866dcb.2af98cd0.js | 1 - assets/js/dd866dcb.5e0e9691.js | 1 + assets/js/ddc2f5d7.cd4b8a93.js | 1 - assets/js/{7a9a7793.b54767d3.js => ddc2f5d7.ddcbe3c6.js} | 2 +- assets/js/ddd0b04f.6ba97eb5.js | 1 - assets/js/ddd0b04f.916c5fd4.js | 1 + assets/js/deef9a5e.27dcb544.js | 1 - assets/js/deef9a5e.47da4fa4.js | 1 + assets/js/df710605.158f54d0.js | 1 - assets/js/df710605.2df1578c.js | 1 + assets/js/e00febc1.627bedaf.js | 1 - assets/js/e00febc1.8e89b8b8.js | 1 + assets/js/{e0440eb5.0c2f2926.js => e0440eb5.33c64edf.js} | 2 +- assets/js/{ab7f36eb.ae65c9fc.js => e0e7afc2.16317bd4.js} | 2 +- assets/js/e0e7afc2.54c3c748.js | 1 - assets/js/{e173b207.62663617.js => e173b207.b0fe2756.js} | 2 +- assets/js/e1f73728.8df6bb2b.js | 1 - assets/js/e1f73728.adbcc625.js | 1 + assets/js/e2a5b3d8.9888da91.js | 1 - assets/js/e2a5b3d8.c057ef9b.js | 1 + assets/js/{e42a2b73.e3c9cb46.js => e42a2b73.a5dc8e5f.js} | 2 +- assets/js/{e44881fb.b8c852bb.js => e44881fb.8f374c06.js} | 2 +- assets/js/{e4e82e6a.c0ce8fb3.js => e4e82e6a.d2c13804.js} | 2 +- assets/js/e553387a.a7eaf8ba.js | 1 - assets/js/e553387a.d8621b90.js | 1 + assets/js/{e69e8760.99227eaa.js => e69e8760.697d3c2d.js} | 2 +- assets/js/{e70660f8.b57cf4b9.js => e70660f8.1c609078.js} | 2 +- assets/js/{e726a1ae.987d1199.js => e726a1ae.208139b3.js} | 2 +- assets/js/e7abe289.4bc84b9c.js | 1 + assets/js/e7abe289.a9d5b521.js | 1 - assets/js/e7fd969b.04b54ae9.js | 1 + assets/js/e7fd969b.c0dec1fc.js | 1 - assets/js/e8dc6da9.779860b8.js | 1 + assets/js/e8dc6da9.c19f9011.js | 1 - assets/js/{e8ee2e7e.86722293.js => e8ee2e7e.a3401d66.js} | 2 +- assets/js/e96154c8.25978e0d.js | 1 + assets/js/e96154c8.822e635d.js | 1 - assets/js/{e9a1fc69.79989be9.js => e9a1fc69.d6f6b50f.js} | 2 +- assets/js/ea0753a5.10d3e1c3.js | 1 + assets/js/ea0753a5.6402f3a8.js | 1 - assets/js/ea3ae765.39b961ea.js | 1 + assets/js/ea3ae765.a98d8e08.js | 1 - assets/js/ea9c842e.8db019ee.js | 1 - assets/js/ea9c842e.9d400985.js | 1 + assets/js/{eac2cc2d.e1322892.js => eac2cc2d.bdd9f443.js} | 2 +- assets/js/eb63b0ef.8273f577.js | 1 + assets/js/eb63b0ef.fc6ca354.js | 1 - assets/js/ec0fc490.57559266.js | 1 + assets/js/ec0fc490.f6c9823a.js | 1 - assets/js/ecab07fd.6f276b2e.js | 1 + assets/js/ecab07fd.e5484f12.js | 1 - assets/js/{ecad0521.47483e14.js => ecad0521.102a5ff2.js} | 2 +- assets/js/{eccba3aa.43b4cd99.js => eccba3aa.4a6d39c3.js} | 2 +- assets/js/ed03b417.1ba9930b.js | 1 + assets/js/ed03b417.3b39e326.js | 1 - assets/js/ed75a16f.2f5c8dc1.js | 1 - assets/js/ed75a16f.4daffc73.js | 1 + assets/js/{edccb6ef.fa02e59a.js => edccb6ef.bca025bd.js} | 2 +- assets/js/ee7d8ce4.3cf8fded.js | 1 - assets/js/ee7d8ce4.7a714097.js | 1 + assets/js/f045e7b7.1d2a35bf.js | 1 + assets/js/f1ab784a.854cff6c.js | 1 + assets/js/f1ab784a.adce89f0.js | 1 - assets/js/f1aff4d7.db47787f.js | 1 + assets/js/f299eef4.d5c39b68.js | 1 + assets/js/f299eef4.e08728d2.js | 1 - assets/js/f2b6f2a5.2679b198.js | 1 + assets/js/{f2cf4e40.e71b86e8.js => f2cf4e40.577a48d1.js} | 2 +- assets/js/f3c54afa.15bef2ad.js | 1 - assets/js/f3c54afa.e813accf.js | 1 + assets/js/f3d1d985.937d5c74.js | 1 + assets/js/f3d1d985.efe508c5.js | 1 - assets/js/f6257df4.39fb9fdb.js | 1 - assets/js/f6257df4.d61f8320.js | 1 + assets/js/f7401177.9e77e213.js | 1 + assets/js/f7401177.db760ab4.js | 1 - assets/js/f7abad00.c58ab378.js | 1 + assets/js/f7abad00.f87b0b39.js | 1 - assets/js/f7d78b3c.23e9d308.js | 1 + assets/js/f7d78b3c.e54297a7.js | 1 - assets/js/f819c265.45510951.js | 1 + assets/js/f819c265.a0044aa2.js | 1 - assets/js/{f8810dab.2be3fca8.js => f8810dab.9eecf211.js} | 2 +- assets/js/f920965e.ab3ce600.js | 1 + assets/js/f920965e.cf804876.js | 1 - assets/js/f9c04764.287b42a9.js | 1 - assets/js/f9c04764.7ab7be8d.js | 1 + assets/js/fac9b75a.0511d56b.js | 1 - assets/js/fac9b75a.f3bbb3f7.js | 1 + assets/js/fb64cc05.4bda9c7b.js | 1 - assets/js/fb64cc05.b7922c0a.js | 1 + assets/js/{fc092607.696a6720.js => fc092607.830c412c.js} | 2 +- assets/js/fc1dbbb7.443fc69f.js | 1 - assets/js/fc1dbbb7.97705f7b.js | 1 + assets/js/{fd4e0f15.eb3f931c.js => fd4e0f15.ee55a187.js} | 2 +- assets/js/{fe8f578b.f18f48c7.js => fe8f578b.20cbd6ea.js} | 2 +- assets/js/fedff9e4.6511f300.js | 1 - assets/js/{1e3f28fe.2858d53d.js => fedff9e4.8d6b6744.js} | 2 +- assets/js/ffb45ffd.eda4f0c5.js | 1 + .../js/{runtime~main.28d61aff.js => runtime~main.283b9de6.js} | 2 +- blog/2020/05/04/New-blog/index.html | 4 ++-- blog/2020/09/03/Hydra_1.0/index.html | 4 ++-- blog/2020/12/22/Hydra_Ray_Launcher/index.html | 4 ++-- blog/2021/06/13/Hydra_1.1/index.html | 4 ++-- blog/2022/05/18/Hydra_1.2/index.html | 4 ++-- blog/archive/index.html | 4 ++-- blog/index.html | 4 ++-- blog/tags/hydra/index.html | 4 ++-- blog/tags/index.html | 4 ++-- blog/tags/plugin/index.html | 4 ++-- blog/tags/ray/index.html | 4 ++-- blog/tags/release/index.html | 4 ++-- docs/0.11/advanced/app_packaging/index.html | 4 ++-- docs/0.11/advanced/compose_api/index.html | 4 ++-- docs/0.11/advanced/plugins/index.html | 4 ++-- docs/0.11/advanced/ray_example/index.html | 4 ++-- docs/0.11/advanced/search_path/index.html | 4 ++-- docs/0.11/configure_hydra/app_help/index.html | 4 ++-- docs/0.11/configure_hydra/intro/index.html | 4 ++-- docs/0.11/configure_hydra/logging/index.html | 4 ++-- docs/0.11/configure_hydra/workdir/index.html | 4 ++-- docs/0.11/development/contributing/index.html | 4 ++-- docs/0.11/development/release/index.html | 4 ++-- docs/0.11/fb/intro/index.html | 4 ++-- docs/0.11/intro/index.html | 4 ++-- docs/0.11/patterns/objects/index.html | 4 ++-- docs/0.11/patterns/specializing_config/index.html | 4 ++-- docs/0.11/plugins/colorlog/index.html | 4 ++-- docs/0.11/tutorial/composition/index.html | 4 ++-- docs/0.11/tutorial/config_file/index.html | 4 ++-- docs/0.11/tutorial/config_groups/index.html | 4 ++-- docs/0.11/tutorial/debugging/index.html | 4 ++-- docs/0.11/tutorial/defaults/index.html | 4 ++-- docs/0.11/tutorial/logging/index.html | 4 ++-- docs/0.11/tutorial/multi-run/index.html | 4 ++-- docs/0.11/tutorial/simple_cli/index.html | 4 ++-- docs/0.11/tutorial/tab_completion/index.html | 4 ++-- docs/0.11/tutorial/working_directory/index.html | 4 ++-- docs/1.0/advanced/app_packaging/index.html | 4 ++-- docs/1.0/advanced/hydra-command-line-flags/index.html | 4 ++-- docs/1.0/advanced/jupyter_notebooks/index.html | 4 ++-- docs/1.0/advanced/override_grammar/basic/index.html | 4 ++-- docs/1.0/advanced/override_grammar/extended/index.html | 4 ++-- docs/1.0/advanced/overriding_packages/index.html | 4 ++-- docs/1.0/advanced/plugins/index.html | 4 ++-- docs/1.0/advanced/search_path/index.html | 4 ++-- docs/1.0/advanced/unit_testing/index.html | 4 ++-- docs/1.0/configure_hydra/app_help/index.html | 4 ++-- docs/1.0/configure_hydra/intro/index.html | 4 ++-- docs/1.0/configure_hydra/job/index.html | 4 ++-- docs/1.0/configure_hydra/logging/index.html | 4 ++-- docs/1.0/configure_hydra/workdir/index.html | 4 ++-- docs/1.0/development/documentation/index.html | 4 ++-- docs/1.0/development/overview/index.html | 4 ++-- docs/1.0/development/release/index.html | 4 ++-- docs/1.0/development/style_guide/index.html | 4 ++-- docs/1.0/development/testing/index.html | 4 ++-- docs/1.0/experimental/compose_api/index.html | 4 ++-- docs/1.0/experimental/intro/index.html | 4 ++-- docs/1.0/intro/index.html | 4 ++-- docs/1.0/patterns/instantiate_objects/config_files/index.html | 4 ++-- docs/1.0/patterns/instantiate_objects/overview/index.html | 4 ++-- .../patterns/instantiate_objects/structured_config/index.html | 4 ++-- docs/1.0/patterns/specializing_config/index.html | 4 ++-- docs/1.0/patterns/write_protect_config_node/index.html | 4 ++-- docs/1.0/plugins/ax_sweeper/index.html | 4 ++-- docs/1.0/plugins/colorlog/index.html | 4 ++-- docs/1.0/plugins/joblib_launcher/index.html | 4 ++-- docs/1.0/plugins/nevergrad_sweeper/index.html | 4 ++-- docs/1.0/plugins/ray_launcher/index.html | 4 ++-- docs/1.0/plugins/rq_launcher/index.html | 4 ++-- docs/1.0/plugins/submitit_launcher/index.html | 4 ++-- docs/1.0/terminology/index.html | 4 ++-- .../1.0/tutorials/basic/running_your_app/debugging/index.html | 4 ++-- docs/1.0/tutorials/basic/running_your_app/logging/index.html | 4 ++-- .../1.0/tutorials/basic/running_your_app/multi-run/index.html | 4 ++-- .../basic/running_your_app/tab_completion/index.html | 4 ++-- .../basic/running_your_app/working_directory/index.html | 4 ++-- .../1.0/tutorials/basic/your_first_app/composition/index.html | 4 ++-- .../1.0/tutorials/basic/your_first_app/config_file/index.html | 4 ++-- .../tutorials/basic/your_first_app/config_groups/index.html | 4 ++-- docs/1.0/tutorials/basic/your_first_app/defaults/index.html | 4 ++-- docs/1.0/tutorials/basic/your_first_app/simple_cli/index.html | 4 ++-- .../tutorials/basic/your_first_app/using_config/index.html | 4 ++-- docs/1.0/tutorials/intro/index.html | 4 ++-- docs/1.0/tutorials/structured_config/config_groups/index.html | 4 ++-- docs/1.0/tutorials/structured_config/config_store/index.html | 4 ++-- docs/1.0/tutorials/structured_config/defaults/index.html | 4 ++-- .../1.0/tutorials/structured_config/dynamic_schema/index.html | 4 ++-- .../structured_config/hierarchical_static_config/index.html | 4 ++-- docs/1.0/tutorials/structured_config/intro/index.html | 4 ++-- .../tutorials/structured_config/minimal_example/index.html | 4 ++-- docs/1.0/tutorials/structured_config/schema/index.html | 4 ++-- docs/1.0/tutorials/structured_config/static_schema/index.html | 4 ++-- .../0.11_to_1.0/adding_a_package_directive/index.html | 4 ++-- docs/1.0/upgrades/0.11_to_1.0/config_path_changes/index.html | 4 ++-- .../0.11_to_1.0/object_instantiation_changes/index.html | 4 ++-- .../0.11_to_1.0/strict_mode_flag_deprecated/index.html | 4 ++-- docs/1.1/advanced/app_packaging/index.html | 4 ++-- docs/1.1/advanced/compose_api/index.html | 4 ++-- docs/1.1/advanced/defaults_list/index.html | 4 ++-- docs/1.1/advanced/hydra-command-line-flags/index.html | 4 ++-- docs/1.1/advanced/instantiate_objects/config_files/index.html | 4 ++-- docs/1.1/advanced/instantiate_objects/overview/index.html | 4 ++-- .../advanced/instantiate_objects/structured_config/index.html | 4 ++-- docs/1.1/advanced/jupyter_notebooks/index.html | 4 ++-- docs/1.1/advanced/override_grammar/basic/index.html | 4 ++-- docs/1.1/advanced/override_grammar/extended/index.html | 4 ++-- docs/1.1/advanced/overriding_packages/index.html | 4 ++-- docs/1.1/advanced/plugins/develop/index.html | 4 ++-- docs/1.1/advanced/plugins/overview/index.html | 4 ++-- docs/1.1/advanced/search_path/index.html | 4 ++-- docs/1.1/advanced/terminology/index.html | 4 ++-- docs/1.1/advanced/unit_testing/index.html | 4 ++-- docs/1.1/configure_hydra/app_help/index.html | 4 ++-- docs/1.1/configure_hydra/intro/index.html | 4 ++-- docs/1.1/configure_hydra/job/index.html | 4 ++-- docs/1.1/configure_hydra/logging/index.html | 4 ++-- docs/1.1/configure_hydra/workdir/index.html | 4 ++-- docs/1.1/development/documentation/index.html | 4 ++-- docs/1.1/development/overview/index.html | 4 ++-- docs/1.1/development/release/index.html | 4 ++-- docs/1.1/development/style_guide/index.html | 4 ++-- docs/1.1/development/testing/index.html | 4 ++-- docs/1.1/experimental/callbacks/index.html | 4 ++-- docs/1.1/experimental/intro/index.html | 4 ++-- docs/1.1/intro/index.html | 4 ++-- docs/1.1/patterns/configuring_experiments/index.html | 4 ++-- docs/1.1/patterns/configuring_plugins/index.html | 4 ++-- docs/1.1/patterns/extending_configs/index.html | 4 ++-- .../select_multiple_configs_from_config_group/index.html | 4 ++-- docs/1.1/patterns/specializing_config/index.html | 4 ++-- docs/1.1/patterns/write_protect_config_node/index.html | 4 ++-- docs/1.1/plugins/ax_sweeper/index.html | 4 ++-- docs/1.1/plugins/colorlog/index.html | 4 ++-- docs/1.1/plugins/joblib_launcher/index.html | 4 ++-- docs/1.1/plugins/nevergrad_sweeper/index.html | 4 ++-- docs/1.1/plugins/optuna_sweeper/index.html | 4 ++-- docs/1.1/plugins/ray_launcher/index.html | 4 ++-- docs/1.1/plugins/rq_launcher/index.html | 4 ++-- docs/1.1/plugins/submitit_launcher/index.html | 4 ++-- .../1.1/tutorials/basic/running_your_app/debugging/index.html | 4 ++-- docs/1.1/tutorials/basic/running_your_app/logging/index.html | 4 ++-- .../1.1/tutorials/basic/running_your_app/multi-run/index.html | 4 ++-- .../basic/running_your_app/tab_completion/index.html | 4 ++-- .../basic/running_your_app/working_directory/index.html | 4 ++-- .../1.1/tutorials/basic/your_first_app/composition/index.html | 4 ++-- .../1.1/tutorials/basic/your_first_app/config_file/index.html | 4 ++-- .../tutorials/basic/your_first_app/config_groups/index.html | 4 ++-- docs/1.1/tutorials/basic/your_first_app/defaults/index.html | 4 ++-- docs/1.1/tutorials/basic/your_first_app/simple_cli/index.html | 4 ++-- .../tutorials/basic/your_first_app/using_config/index.html | 4 ++-- docs/1.1/tutorials/intro/index.html | 4 ++-- docs/1.1/tutorials/structured_config/config_groups/index.html | 4 ++-- docs/1.1/tutorials/structured_config/config_store/index.html | 4 ++-- docs/1.1/tutorials/structured_config/defaults/index.html | 4 ++-- .../structured_config/hierarchical_static_config/index.html | 4 ++-- docs/1.1/tutorials/structured_config/intro/index.html | 4 ++-- .../tutorials/structured_config/minimal_example/index.html | 4 ++-- docs/1.1/tutorials/structured_config/schema/index.html | 4 ++-- .../0.11_to_1.0/adding_a_package_directive/index.html | 4 ++-- docs/1.1/upgrades/0.11_to_1.0/config_path_changes/index.html | 4 ++-- .../0.11_to_1.0/object_instantiation_changes/index.html | 4 ++-- .../0.11_to_1.0/strict_mode_flag_deprecated/index.html | 4 ++-- .../upgrades/1.0_to_1.1/automatic_schema_matching/index.html | 4 ++-- .../1.0_to_1.1/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.0_to_1.1/changes_to_package_header/index.html | 4 ++-- .../upgrades/1.0_to_1.1/default_composition_order/index.html | 4 ++-- .../1.0_to_1.1/defaults_list_interpolation/index.html | 4 ++-- .../1.1/upgrades/1.0_to_1.1/defaults_list_override/index.html | 4 ++-- docs/1.1/upgrades/intro/index.html | 4 ++-- docs/1.2/advanced/app_packaging/index.html | 4 ++-- docs/1.2/advanced/compose_api/index.html | 4 ++-- docs/1.2/advanced/defaults_list/index.html | 4 ++-- docs/1.2/advanced/hydra-command-line-flags/index.html | 4 ++-- docs/1.2/advanced/instantiate_objects/config_files/index.html | 4 ++-- docs/1.2/advanced/instantiate_objects/overview/index.html | 4 ++-- .../advanced/instantiate_objects/structured_config/index.html | 4 ++-- docs/1.2/advanced/jupyter_notebooks/index.html | 4 ++-- docs/1.2/advanced/override_grammar/basic/index.html | 4 ++-- docs/1.2/advanced/override_grammar/extended/index.html | 4 ++-- docs/1.2/advanced/overriding_packages/index.html | 4 ++-- docs/1.2/advanced/plugins/develop/index.html | 4 ++-- docs/1.2/advanced/plugins/overview/index.html | 4 ++-- docs/1.2/advanced/search_path/index.html | 4 ++-- docs/1.2/advanced/terminology/index.html | 4 ++-- docs/1.2/advanced/unit_testing/index.html | 4 ++-- docs/1.2/configure_hydra/app_help/index.html | 4 ++-- docs/1.2/configure_hydra/intro/index.html | 4 ++-- docs/1.2/configure_hydra/job/index.html | 4 ++-- docs/1.2/configure_hydra/logging/index.html | 4 ++-- docs/1.2/configure_hydra/workdir/index.html | 4 ++-- docs/1.2/development/documentation/index.html | 4 ++-- docs/1.2/development/overview/index.html | 4 ++-- docs/1.2/development/release/index.html | 4 ++-- docs/1.2/development/style_guide/index.html | 4 ++-- docs/1.2/development/testing/index.html | 4 ++-- docs/1.2/experimental/callbacks/index.html | 4 ++-- docs/1.2/experimental/intro/index.html | 4 ++-- docs/1.2/experimental/rerun/index.html | 4 ++-- docs/1.2/intro/index.html | 4 ++-- docs/1.2/patterns/configuring_experiments/index.html | 4 ++-- docs/1.2/patterns/configuring_plugins/index.html | 4 ++-- docs/1.2/patterns/extending_configs/index.html | 4 ++-- .../select_multiple_configs_from_config_group/index.html | 4 ++-- docs/1.2/patterns/specializing_config/index.html | 4 ++-- docs/1.2/patterns/write_protect_config_node/index.html | 4 ++-- docs/1.2/plugins/ax_sweeper/index.html | 4 ++-- docs/1.2/plugins/colorlog/index.html | 4 ++-- docs/1.2/plugins/joblib_launcher/index.html | 4 ++-- docs/1.2/plugins/nevergrad_sweeper/index.html | 4 ++-- docs/1.2/plugins/optuna_sweeper/index.html | 4 ++-- docs/1.2/plugins/ray_launcher/index.html | 4 ++-- docs/1.2/plugins/rq_launcher/index.html | 4 ++-- docs/1.2/plugins/submitit_launcher/index.html | 4 ++-- .../1.2/tutorials/basic/running_your_app/debugging/index.html | 4 ++-- docs/1.2/tutorials/basic/running_your_app/logging/index.html | 4 ++-- .../1.2/tutorials/basic/running_your_app/multi-run/index.html | 4 ++-- .../basic/running_your_app/tab_completion/index.html | 4 ++-- .../basic/running_your_app/working_directory/index.html | 4 ++-- .../1.2/tutorials/basic/your_first_app/composition/index.html | 4 ++-- .../1.2/tutorials/basic/your_first_app/config_file/index.html | 4 ++-- .../tutorials/basic/your_first_app/config_groups/index.html | 4 ++-- docs/1.2/tutorials/basic/your_first_app/defaults/index.html | 4 ++-- docs/1.2/tutorials/basic/your_first_app/simple_cli/index.html | 4 ++-- .../tutorials/basic/your_first_app/using_config/index.html | 4 ++-- docs/1.2/tutorials/intro/index.html | 4 ++-- docs/1.2/tutorials/structured_config/config_groups/index.html | 4 ++-- docs/1.2/tutorials/structured_config/config_store/index.html | 4 ++-- docs/1.2/tutorials/structured_config/defaults/index.html | 4 ++-- .../structured_config/hierarchical_static_config/index.html | 4 ++-- docs/1.2/tutorials/structured_config/intro/index.html | 4 ++-- .../tutorials/structured_config/minimal_example/index.html | 4 ++-- docs/1.2/tutorials/structured_config/schema/index.html | 4 ++-- .../0.11_to_1.0/adding_a_package_directive/index.html | 4 ++-- docs/1.2/upgrades/0.11_to_1.0/config_path_changes/index.html | 4 ++-- .../0.11_to_1.0/object_instantiation_changes/index.html | 4 ++-- .../0.11_to_1.0/strict_mode_flag_deprecated/index.html | 4 ++-- .../upgrades/1.0_to_1.1/automatic_schema_matching/index.html | 4 ++-- .../1.0_to_1.1/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.0_to_1.1/changes_to_package_header/index.html | 4 ++-- .../upgrades/1.0_to_1.1/default_composition_order/index.html | 4 ++-- .../1.0_to_1.1/defaults_list_interpolation/index.html | 4 ++-- .../1.2/upgrades/1.0_to_1.1/defaults_list_override/index.html | 4 ++-- .../1.1_to_1.2/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.1_to_1.2/changes_to_job_working_dir/index.html | 4 ++-- .../upgrades/1.1_to_1.2/changes_to_sweeper_config/index.html | 4 ++-- docs/1.2/upgrades/intro/index.html | 4 ++-- docs/1.2/upgrades/version_base/index.html | 4 ++-- docs/1.3/advanced/app_packaging/index.html | 4 ++-- docs/1.3/advanced/compose_api/index.html | 4 ++-- docs/1.3/advanced/decorating_main/index.html | 4 ++-- docs/1.3/advanced/defaults_list/index.html | 4 ++-- docs/1.3/advanced/hydra-command-line-flags/index.html | 4 ++-- docs/1.3/advanced/instantiate_objects/config_files/index.html | 4 ++-- docs/1.3/advanced/instantiate_objects/overview/index.html | 4 ++-- .../advanced/instantiate_objects/structured_config/index.html | 4 ++-- docs/1.3/advanced/jupyter_notebooks/index.html | 4 ++-- docs/1.3/advanced/override_grammar/basic/index.html | 4 ++-- docs/1.3/advanced/override_grammar/extended/index.html | 4 ++-- docs/1.3/advanced/overriding_packages/index.html | 4 ++-- docs/1.3/advanced/plugins/develop/index.html | 4 ++-- docs/1.3/advanced/plugins/overview/index.html | 4 ++-- docs/1.3/advanced/search_path/index.html | 4 ++-- docs/1.3/advanced/terminology/index.html | 4 ++-- docs/1.3/advanced/unit_testing/index.html | 4 ++-- docs/1.3/configure_hydra/app_help/index.html | 4 ++-- docs/1.3/configure_hydra/intro/index.html | 4 ++-- docs/1.3/configure_hydra/job/index.html | 4 ++-- docs/1.3/configure_hydra/logging/index.html | 4 ++-- docs/1.3/configure_hydra/workdir/index.html | 4 ++-- docs/1.3/development/documentation/index.html | 4 ++-- docs/1.3/development/overview/index.html | 4 ++-- docs/1.3/development/release/index.html | 4 ++-- docs/1.3/development/style_guide/index.html | 4 ++-- docs/1.3/development/testing/index.html | 4 ++-- docs/1.3/experimental/callbacks/index.html | 4 ++-- docs/1.3/experimental/intro/index.html | 4 ++-- docs/1.3/experimental/rerun/index.html | 4 ++-- docs/1.3/intro/index.html | 4 ++-- docs/1.3/patterns/configuring_experiments/index.html | 4 ++-- docs/1.3/patterns/configuring_plugins/index.html | 4 ++-- docs/1.3/patterns/extending_configs/index.html | 4 ++-- .../select_multiple_configs_from_config_group/index.html | 4 ++-- docs/1.3/patterns/specializing_config/index.html | 4 ++-- docs/1.3/patterns/write_protect_config_node/index.html | 4 ++-- docs/1.3/plugins/ax_sweeper/index.html | 4 ++-- docs/1.3/plugins/colorlog/index.html | 4 ++-- docs/1.3/plugins/joblib_launcher/index.html | 4 ++-- docs/1.3/plugins/nevergrad_sweeper/index.html | 4 ++-- docs/1.3/plugins/optuna_sweeper/index.html | 4 ++-- docs/1.3/plugins/ray_launcher/index.html | 4 ++-- docs/1.3/plugins/rq_launcher/index.html | 4 ++-- docs/1.3/plugins/submitit_launcher/index.html | 4 ++-- .../1.3/tutorials/basic/running_your_app/debugging/index.html | 4 ++-- docs/1.3/tutorials/basic/running_your_app/logging/index.html | 4 ++-- .../1.3/tutorials/basic/running_your_app/multi-run/index.html | 4 ++-- .../basic/running_your_app/tab_completion/index.html | 4 ++-- .../basic/running_your_app/working_directory/index.html | 4 ++-- .../1.3/tutorials/basic/your_first_app/composition/index.html | 4 ++-- .../1.3/tutorials/basic/your_first_app/config_file/index.html | 4 ++-- .../tutorials/basic/your_first_app/config_groups/index.html | 4 ++-- docs/1.3/tutorials/basic/your_first_app/defaults/index.html | 4 ++-- docs/1.3/tutorials/basic/your_first_app/simple_cli/index.html | 4 ++-- .../tutorials/basic/your_first_app/using_config/index.html | 4 ++-- docs/1.3/tutorials/intro/index.html | 4 ++-- docs/1.3/tutorials/structured_config/config_groups/index.html | 4 ++-- docs/1.3/tutorials/structured_config/config_store/index.html | 4 ++-- docs/1.3/tutorials/structured_config/defaults/index.html | 4 ++-- .../structured_config/hierarchical_static_config/index.html | 4 ++-- docs/1.3/tutorials/structured_config/intro/index.html | 4 ++-- .../tutorials/structured_config/minimal_example/index.html | 4 ++-- docs/1.3/tutorials/structured_config/schema/index.html | 4 ++-- .../0.11_to_1.0/adding_a_package_directive/index.html | 4 ++-- docs/1.3/upgrades/0.11_to_1.0/config_path_changes/index.html | 4 ++-- .../0.11_to_1.0/object_instantiation_changes/index.html | 4 ++-- .../0.11_to_1.0/strict_mode_flag_deprecated/index.html | 4 ++-- .../upgrades/1.0_to_1.1/automatic_schema_matching/index.html | 4 ++-- .../1.0_to_1.1/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.0_to_1.1/changes_to_package_header/index.html | 4 ++-- .../upgrades/1.0_to_1.1/default_composition_order/index.html | 4 ++-- .../1.0_to_1.1/defaults_list_interpolation/index.html | 4 ++-- .../1.3/upgrades/1.0_to_1.1/defaults_list_override/index.html | 4 ++-- .../1.1_to_1.2/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.1_to_1.2/changes_to_job_working_dir/index.html | 4 ++-- .../upgrades/1.1_to_1.2/changes_to_sweeper_config/index.html | 4 ++-- docs/1.3/upgrades/intro/index.html | 4 ++-- docs/1.3/upgrades/version_base/index.html | 4 ++-- docs/advanced/app_packaging/index.html | 4 ++-- docs/advanced/compose_api/index.html | 4 ++-- docs/advanced/decorating_main/index.html | 4 ++-- docs/advanced/defaults_list/index.html | 4 ++-- docs/advanced/hydra-command-line-flags/index.html | 4 ++-- docs/advanced/instantiate_objects/config_files/index.html | 4 ++-- docs/advanced/instantiate_objects/overview/index.html | 4 ++-- .../advanced/instantiate_objects/structured_config/index.html | 4 ++-- docs/advanced/jupyter_notebooks/index.html | 4 ++-- docs/advanced/override_grammar/basic/index.html | 4 ++-- docs/advanced/override_grammar/extended/index.html | 4 ++-- docs/advanced/overriding_packages/index.html | 4 ++-- docs/advanced/plugins/develop/index.html | 4 ++-- docs/advanced/plugins/overview/index.html | 4 ++-- docs/advanced/search_path/index.html | 4 ++-- docs/advanced/terminology/index.html | 4 ++-- docs/advanced/unit_testing/index.html | 4 ++-- docs/configure_hydra/app_help/index.html | 4 ++-- docs/configure_hydra/intro/index.html | 4 ++-- docs/configure_hydra/job/index.html | 4 ++-- docs/configure_hydra/logging/index.html | 4 ++-- docs/configure_hydra/workdir/index.html | 4 ++-- docs/development/documentation/index.html | 4 ++-- docs/development/overview/index.html | 4 ++-- docs/development/release/index.html | 4 ++-- docs/development/style_guide/index.html | 4 ++-- docs/development/testing/index.html | 4 ++-- docs/experimental/callbacks/index.html | 4 ++-- docs/experimental/intro/index.html | 4 ++-- docs/experimental/rerun/index.html | 4 ++-- docs/intro/index.html | 4 ++-- docs/patterns/configuring_experiments/index.html | 4 ++-- docs/patterns/configuring_plugins/index.html | 4 ++-- docs/patterns/extending_configs/index.html | 4 ++-- .../select_multiple_configs_from_config_group/index.html | 4 ++-- docs/patterns/specializing_config/index.html | 4 ++-- docs/patterns/write_protect_config_node/index.html | 4 ++-- docs/plugins/ax_sweeper/index.html | 4 ++-- docs/plugins/colorlog/index.html | 4 ++-- docs/plugins/joblib_launcher/index.html | 4 ++-- docs/plugins/nevergrad_sweeper/index.html | 4 ++-- docs/plugins/optuna_sweeper/index.html | 4 ++-- docs/plugins/ray_launcher/index.html | 4 ++-- docs/plugins/rq_launcher/index.html | 4 ++-- docs/plugins/submitit_launcher/index.html | 4 ++-- docs/tutorials/basic/running_your_app/debugging/index.html | 4 ++-- docs/tutorials/basic/running_your_app/logging/index.html | 4 ++-- docs/tutorials/basic/running_your_app/multi-run/index.html | 4 ++-- .../basic/running_your_app/tab_completion/index.html | 4 ++-- .../basic/running_your_app/working_directory/index.html | 4 ++-- docs/tutorials/basic/your_first_app/composition/index.html | 4 ++-- docs/tutorials/basic/your_first_app/config_file/index.html | 4 ++-- docs/tutorials/basic/your_first_app/config_groups/index.html | 4 ++-- docs/tutorials/basic/your_first_app/defaults/index.html | 4 ++-- docs/tutorials/basic/your_first_app/simple_cli/index.html | 4 ++-- docs/tutorials/basic/your_first_app/using_config/index.html | 4 ++-- docs/tutorials/intro/index.html | 4 ++-- docs/tutorials/structured_config/config_groups/index.html | 4 ++-- docs/tutorials/structured_config/config_store/index.html | 4 ++-- docs/tutorials/structured_config/defaults/index.html | 4 ++-- .../structured_config/hierarchical_static_config/index.html | 4 ++-- docs/tutorials/structured_config/intro/index.html | 4 ++-- docs/tutorials/structured_config/minimal_example/index.html | 4 ++-- docs/tutorials/structured_config/schema/index.html | 4 ++-- .../0.11_to_1.0/adding_a_package_directive/index.html | 4 ++-- docs/upgrades/0.11_to_1.0/config_path_changes/index.html | 4 ++-- .../0.11_to_1.0/object_instantiation_changes/index.html | 4 ++-- .../0.11_to_1.0/strict_mode_flag_deprecated/index.html | 4 ++-- docs/upgrades/1.0_to_1.1/automatic_schema_matching/index.html | 4 ++-- .../1.0_to_1.1/changes_to_hydra_main_config_path/index.html | 4 ++-- docs/upgrades/1.0_to_1.1/changes_to_package_header/index.html | 4 ++-- docs/upgrades/1.0_to_1.1/default_composition_order/index.html | 4 ++-- .../1.0_to_1.1/defaults_list_interpolation/index.html | 4 ++-- docs/upgrades/1.0_to_1.1/defaults_list_override/index.html | 4 ++-- .../1.1_to_1.2/changes_to_hydra_main_config_path/index.html | 4 ++-- .../upgrades/1.1_to_1.2/changes_to_job_working_dir/index.html | 4 ++-- docs/upgrades/1.1_to_1.2/changes_to_sweeper_config/index.html | 4 ++-- docs/upgrades/intro/index.html | 4 ++-- docs/upgrades/version_base/index.html | 4 ++-- index.html | 4 ++-- search/index.html | 4 ++-- 1042 files changed, 1216 insertions(+), 1216 deletions(-) rename assets/js/{1e1bc213.de964369.js => 0169dbe1.ca0f52b0.js} (80%) delete mode 100644 assets/js/0169dbe1.e79d0918.js rename assets/js/{028aaae6.7f44a906.js => 028aaae6.fa26fe80.js} (50%) create mode 100644 assets/js/02deea7a.9d47866f.js delete mode 100644 assets/js/02deea7a.eec514b9.js create mode 100644 assets/js/03322abc.4a95b63c.js delete mode 100644 assets/js/03322abc.daee8556.js delete mode 100644 assets/js/0413c37e.265195ed.js rename assets/js/{f1aff4d7.cf2a79ae.js => 0413c37e.ab4a567f.js} (81%) create mode 100644 assets/js/043fc566.f1d3d5a2.js delete mode 100644 assets/js/043fc566.fcdc95cb.js create mode 100644 assets/js/05d1ea85.10de91bf.js delete mode 100644 assets/js/05d1ea85.cef66cab.js rename assets/js/{06056e6c.ee9716ff.js => 06056e6c.28d8fa0e.js} (59%) rename assets/js/{0689266f.6188347b.js => 0689266f.a28fa646.js} (58%) delete mode 100644 assets/js/06963ee3.623e8789.js create mode 100644 assets/js/06963ee3.a88a7dcd.js delete mode 100644 assets/js/07586c7f.03dd9c03.js create mode 100644 assets/js/07586c7f.389ee1bb.js create mode 100644 assets/js/0a4b398d.8302eaed.js rename assets/js/{0a7b70ce.ae5b7173.js => 0a7b70ce.6fee88ee.js} (61%) create mode 100644 assets/js/0aa416e4.66f88d38.js create mode 100644 assets/js/0b3cc50a.47125348.js delete mode 100644 assets/js/0b3cc50a.f925b508.js delete mode 100644 assets/js/0e384e19.531edde4.js create mode 100644 assets/js/0e384e19.de3b1a0e.js rename assets/js/{0e5950c6.8252b995.js => 0e5950c6.392685fb.js} (66%) rename assets/js/{0e71d84b.9a2cc699.js => 0e71d84b.02f2bd4f.js} (72%) rename assets/js/{0fa51aec.3330f1fe.js => 0fa51aec.d89df1b0.js} (50%) rename assets/js/{478ff238.761789a1.js => 10abfaeb.3956bacb.js} (59%) delete mode 100644 assets/js/10abfaeb.b592e38c.js delete mode 100644 assets/js/10c36d6f.3955b903.js create mode 100644 assets/js/10c36d6f.432d15e4.js create mode 100644 assets/js/10dd8346.505405a0.js delete mode 100644 assets/js/10e059cb.39783cac.js create mode 100644 assets/js/10e059cb.4e441dfb.js rename assets/js/{10fbd247.1aeae81a.js => 10fbd247.bbe9a1be.js} (58%) rename assets/js/{120f5b8b.7566b270.js => 120f5b8b.817b362d.js} (50%) create mode 100644 assets/js/12111f85.37b9a36a.js delete mode 100644 assets/js/12111f85.d44f5bce.js create mode 100644 assets/js/13a26e00.59e5217b.js delete mode 100644 assets/js/13a26e00.6e0890cd.js create mode 100644 assets/js/14173c40.50b666cb.js delete mode 100644 assets/js/14173c40.e8062592.js delete mode 100644 assets/js/141a01e8.afff0d76.js create mode 100644 assets/js/141a01e8.c9a4c975.js create mode 100644 assets/js/1434836b.048d8a68.js delete mode 100644 assets/js/1434836b.38f413ec.js create mode 100644 assets/js/1443f4ed.71e5fa51.js delete mode 100644 assets/js/1483e3dc.0bee4923.js create mode 100644 assets/js/1483e3dc.e80dee6f.js create mode 100644 assets/js/1564a8d3.b865df6c.js delete mode 100644 assets/js/1564a8d3.c62cc72c.js create mode 100644 assets/js/16568db6.464e2262.js delete mode 100644 assets/js/16568db6.8d45b6ad.js delete mode 100644 assets/js/1760e2a5.2496cc98.js create mode 100644 assets/js/1760e2a5.24a57751.js rename assets/js/{176287c7.686575f4.js => 176287c7.82163e8b.js} (72%) create mode 100644 assets/js/17885660.59bd37a3.js delete mode 100644 assets/js/17885660.fa375f9b.js rename assets/js/{17b1a13a.ffc95d23.js => 17b1a13a.ce6bde8f.js} (87%) rename assets/js/{17e73f1c.935516a4.js => 17e73f1c.61e4628c.js} (57%) delete mode 100644 assets/js/18954878.820967bb.js create mode 100644 assets/js/18954878.962e6c9f.js delete mode 100644 assets/js/18d93f34.0ae73cbd.js create mode 100644 assets/js/18d93f34.5bb7e0be.js rename assets/js/{1b0e2224.febf00f1.js => 1b0e2224.90e72d44.js} (65%) create mode 100644 assets/js/1c10768b.5b32cf67.js delete mode 100644 assets/js/1c10768b.695f5d9f.js delete mode 100644 assets/js/1c50c1b8.13d1aad9.js create mode 100644 assets/js/1c50c1b8.1bb94a2b.js create mode 100644 assets/js/1d831f5a.4e829cea.js delete mode 100644 assets/js/1d9190c2.3d894be4.js create mode 100644 assets/js/1d9190c2.6b79df4e.js create mode 100644 assets/js/1e1bc213.e1e5fcb8.js delete mode 100644 assets/js/1e2eb92a.5dfeb6cb.js create mode 100644 assets/js/1e2eb92a.aa825cf2.js rename assets/js/{1e3a3c98.65ec0a7e.js => 1e3a3c98.698f51bb.js} (56%) create mode 100644 assets/js/1e3f28fe.c5782ef7.js rename assets/js/{1f1bf95b.3cc7237a.js => 1f1bf95b.a2678353.js} (72%) delete mode 100644 assets/js/1f4529b5.568c8e85.js create mode 100644 assets/js/1f4529b5.d6adfa71.js delete mode 100644 assets/js/208d083d.24ae8c46.js create mode 100644 assets/js/208d083d.90c3b30e.js delete mode 100644 assets/js/213609f5.0f1c064b.js rename assets/js/{7303162f.290a5388.js => 213609f5.1c7bc203.js} (71%) delete mode 100644 assets/js/215ac4d9.8199d115.js create mode 100644 assets/js/215ac4d9.dc2c4e5f.js create mode 100644 assets/js/215cc2c0.9fe8a7a8.js delete mode 100644 assets/js/215cc2c0.ee239f3e.js delete mode 100644 assets/js/2174f925.5924f7fe.js create mode 100644 assets/js/2174f925.df7cad4a.js create mode 100644 assets/js/21854093.03799f7b.js delete mode 100644 assets/js/21edddaf.1a9660a7.js create mode 100644 assets/js/21edddaf.ba823e57.js delete mode 100644 assets/js/2205f950.77e41aa3.js rename assets/js/{0a4b398d.24d71bf2.js => 2205f950.b768e25f.js} (78%) rename assets/js/{22abb723.ff0ed002.js => 22abb723.7a26085b.js} (62%) rename assets/js/{2380203e.b144db19.js => 2380203e.5ed08d0a.js} (56%) create mode 100644 assets/js/240de8c7.1f2f385f.js delete mode 100644 assets/js/240de8c7.be5922a1.js rename assets/js/{25a59092.92103ef2.js => 25a59092.dc3ffbd4.js} (58%) delete mode 100644 assets/js/2682ecde.1c0c75d6.js create mode 100644 assets/js/2682ecde.2f64130a.js create mode 100644 assets/js/27546d3e.2ad6e9b7.js delete mode 100644 assets/js/27546d3e.8073fc4e.js rename assets/js/{27af8fe6.a6aebc19.js => 27af8fe6.7bba35db.js} (57%) delete mode 100644 assets/js/27f5d38d.2ecff687.js create mode 100644 assets/js/27f5d38d.a4e6e547.js delete mode 100644 assets/js/2862967f.4edc24f0.js rename assets/js/{3e5c2e49.fadca57b.js => 2862967f.ab14c1e5.js} (86%) rename assets/js/{6bc4497f.7b73b793.js => 28a7fcb4.4ad20b9a.js} (88%) delete mode 100644 assets/js/28a7fcb4.f476225b.js create mode 100644 assets/js/290e3655.1f92d1ad.js delete mode 100644 assets/js/290e3655.c970cd85.js rename assets/js/{2c8fa177.ad6879b6.js => 2c8fa177.fc8ba043.js} (57%) delete mode 100644 assets/js/2cac4d70.69fe625e.js create mode 100644 assets/js/2cac4d70.bc1bbe25.js rename assets/js/{2ceb009d.3aa5b9d0.js => 2ceb009d.2f1e90ef.js} (58%) create mode 100644 assets/js/2d3c34e0.bb17cd46.js delete mode 100644 assets/js/2d3c34e0.fee18fab.js create mode 100644 assets/js/2d57dfba.2d50eb01.js delete mode 100644 assets/js/2d57dfba.57643a27.js rename assets/js/{2e99c05e.a729d823.js => 2e99c05e.bb4bb089.js} (59%) create mode 100644 assets/js/2f529812.4c48686a.js delete mode 100644 assets/js/2f529812.f915b441.js create mode 100644 assets/js/315f70d7.571f09e6.js create mode 100644 assets/js/318b0639.10b1543f.js delete mode 100644 assets/js/318b0639.53257903.js rename assets/js/{338ef806.b62797f6.js => 338ef806.29b81ae6.js} (50%) create mode 100644 assets/js/33afe7db.15fe633d.js delete mode 100644 assets/js/33afe7db.c3d3ffeb.js create mode 100644 assets/js/3462c84f.4d71d31c.js delete mode 100644 assets/js/3462c84f.d526e17c.js delete mode 100644 assets/js/356d2c93.60b02a0f.js rename assets/js/{79491168.cbb219a7.js => 356d2c93.66607cee.js} (52%) rename assets/js/{35935476.16ec750e.js => 35935476.d0319b0f.js} (56%) delete mode 100644 assets/js/35af814a.c296b27e.js create mode 100644 assets/js/35af814a.d698c01a.js rename assets/js/{364e9131.4fae5a4e.js => 364e9131.037e02ca.js} (51%) create mode 100644 assets/js/3721ffec.9731424b.js delete mode 100644 assets/js/3721ffec.bc251f4c.js delete mode 100644 assets/js/37b83927.061713e8.js create mode 100644 assets/js/37b83927.ad836a45.js rename assets/js/{38d99aff.e5d86610.js => 38d99aff.21ac297d.js} (50%) delete mode 100644 assets/js/38f8d538.825f831b.js create mode 100644 assets/js/38f8d538.9a0f7089.js delete mode 100644 assets/js/3955c41d.86c0ffbc.js create mode 100644 assets/js/3955c41d.994812d9.js rename assets/js/{395e7b7b.2cd63a3d.js => 395e7b7b.2051f60c.js} (59%) create mode 100644 assets/js/3989901c.5ed93d4a.js delete mode 100644 assets/js/3989901c.e9b0c774.js delete mode 100644 assets/js/39a98d83.0b4b17d8.js create mode 100644 assets/js/39a98d83.35554b6c.js delete mode 100644 assets/js/39fd50bc.884d8ce9.js create mode 100644 assets/js/39fd50bc.fea564e6.js rename assets/js/{3ab89cf6.bc42c38a.js => 3ab89cf6.b7153633.js} (50%) create mode 100644 assets/js/3cf33e0d.23a30b49.js delete mode 100644 assets/js/3cf33e0d.651a3299.js rename assets/js/{3d066543.5657881a.js => 3d066543.1ac9e8c0.js} (57%) create mode 100644 assets/js/3dca537e.231a54ad.js delete mode 100644 assets/js/3dca537e.2c060844.js delete mode 100644 assets/js/3e16a344.db8d0764.js create mode 100644 assets/js/3e16a344.f004c423.js create mode 100644 assets/js/3e5c2e49.db4c3759.js create mode 100644 assets/js/3e7cc949.6acf75cb.js delete mode 100644 assets/js/3e7cc949.fd591c40.js rename assets/js/{3f08a60a.b4b4b6c9.js => 3f08a60a.daeb1a79.js} (75%) delete mode 100644 assets/js/3f5d6c87.47cbe891.js create mode 100644 assets/js/3f5d6c87.71f4cae3.js create mode 100644 assets/js/3ff38ccf.94362d7b.js delete mode 100644 assets/js/3ff38ccf.f432e9d2.js delete mode 100644 assets/js/4074bd8f.27edf9f2.js create mode 100644 assets/js/4074bd8f.45911f53.js delete mode 100644 assets/js/408f478d.8f8c1fdf.js create mode 100644 assets/js/408f478d.b3ec540d.js create mode 100644 assets/js/40c5bf50.669ea375.js delete mode 100644 assets/js/40c5bf50.e05b149a.js rename assets/js/{427c7252.8e2940c8.js => 427c7252.2343d6c8.js} (51%) rename assets/js/{42b6b4bf.27c6902b.js => 42b6b4bf.e1fbec9a.js} (53%) rename assets/js/{42bfec69.2f99267b.js => 42bfec69.0e4ec3e4.js} (50%) delete mode 100644 assets/js/4372d0ca.24e1441b.js create mode 100644 assets/js/4372d0ca.b84eef14.js rename assets/js/{f2b6f2a5.58e838e4.js => 43c904aa.be1e5bd0.js} (80%) delete mode 100644 assets/js/43c904aa.bf9d7a56.js rename assets/js/{441b9731.414fc415.js => 441b9731.3aefdbc5.js} (65%) rename assets/js/{44d746fc.a5fb5dc6.js => 44d746fc.cf8d3643.js} (50%) rename assets/js/{4561b7e2.1660b948.js => 4561b7e2.7f5ec4e4.js} (66%) rename assets/js/{45c1c4a6.38817094.js => 45c1c4a6.11ed09be.js} (59%) rename assets/js/{46dd2a73.c564c5f9.js => 46dd2a73.92e2648c.js} (57%) create mode 100644 assets/js/478ff238.f3fd58a6.js delete mode 100644 assets/js/48f36528.2e7f9b2b.js create mode 100644 assets/js/48f36528.83ed4fb3.js delete mode 100644 assets/js/49cef19b.561e02b6.js create mode 100644 assets/js/49cef19b.c2301192.js rename assets/js/{4a4fc0d2.c6c69dc3.js => 4a4fc0d2.6b6ddb8d.js} (50%) rename assets/js/{4a8b0891.93481b42.js => 4a8b0891.54da9aa4.js} (57%) delete mode 100644 assets/js/4b16ce42.155654bf.js create mode 100644 assets/js/4b16ce42.e02f3622.js rename assets/js/{4cba40dc.522266d5.js => 4cba40dc.becefe8b.js} (75%) create mode 100644 assets/js/4cdabbab.95be2575.js create mode 100644 assets/js/4eeb0b32.461d5354.js delete mode 100644 assets/js/4eeb0b32.aa3f4570.js create mode 100644 assets/js/4f5ea895.1dd64d3d.js delete mode 100644 assets/js/4f5ea895.87c69993.js create mode 100644 assets/js/4fbd2ab8.445630ed.js delete mode 100644 assets/js/4fbd2ab8.7f362d2a.js create mode 100644 assets/js/4fcbe075.5c105a5a.js delete mode 100644 assets/js/4fcbe075.ed1ba569.js create mode 100644 assets/js/4fd99ad7.136792ab.js rename assets/js/{50036cfd.484ad41f.js => 50036cfd.b30cf6bb.js} (61%) create mode 100644 assets/js/502fd0fa.1f421edc.js delete mode 100644 assets/js/502fd0fa.af410c9f.js delete mode 100644 assets/js/50919e5f.41670687.js create mode 100644 assets/js/50919e5f.b3347460.js delete mode 100644 assets/js/509e4e5c.82438789.js create mode 100644 assets/js/509e4e5c.af5eeed9.js create mode 100644 assets/js/50e12e40.215f0ca1.js create mode 100644 assets/js/52e31a99.26be4d43.js delete mode 100644 assets/js/52e31a99.3cdfc83d.js create mode 100644 assets/js/55ac25ed.6d8c52f3.js delete mode 100644 assets/js/55ac25ed.a27e9edd.js delete mode 100644 assets/js/5644e108.4053dd9e.js rename assets/js/{4cdabbab.a43d689e.js => 5644e108.877a6490.js} (52%) delete mode 100644 assets/js/56b400d0.288df516.js rename assets/js/{1d831f5a.fffd4d0b.js => 56b400d0.cf095495.js} (82%) create mode 100644 assets/js/56f07402.1697d7c5.js delete mode 100644 assets/js/56f07402.44fade4f.js delete mode 100644 assets/js/5713876c.624c9be5.js create mode 100644 assets/js/5713876c.9130252e.js delete mode 100644 assets/js/59487f02.020c1b7c.js rename assets/js/{21854093.f16835ae.js => 59487f02.36073bf4.js} (57%) create mode 100644 assets/js/59b3e5d6.89e59a7e.js delete mode 100644 assets/js/59b3e5d6.eefb8052.js rename assets/js/{5a6cb2f1.325db74e.js => 5a6cb2f1.046dfed3.js} (58%) rename assets/js/{5aeeabc8.c6dc76fa.js => 5aeeabc8.3d32e29f.js} (55%) rename assets/js/{5b46d51b.1b8894c5.js => 5b46d51b.0a40b234.js} (52%) rename assets/js/{5c328b3e.4bd79f16.js => 5c328b3e.c4e51b92.js} (51%) create mode 100644 assets/js/5cbd420b.637c6624.js delete mode 100644 assets/js/5cbd420b.f2bd32c6.js create mode 100644 assets/js/5dfb4dbd.8cedb688.js delete mode 100644 assets/js/5dfb4dbd.a46fb84a.js rename assets/js/{5e9ce6b2.1ba37133.js => 5e9ce6b2.cc7fb010.js} (60%) create mode 100644 assets/js/5ed0b598.19f82507.js delete mode 100644 assets/js/5ed0b598.318b4ed1.js delete mode 100644 assets/js/5f458459.2fd01979.js create mode 100644 assets/js/5f458459.71cd7a6c.js create mode 100644 assets/js/5f92c861.d6a669e6.js delete mode 100644 assets/js/5f92c861.e91b8899.js create mode 100644 assets/js/5f998a2f.96689d56.js delete mode 100644 assets/js/5f998a2f.a8b37b95.js delete mode 100644 assets/js/6069dd8f.3d9c7ee5.js create mode 100644 assets/js/6069dd8f.4020b3a2.js rename assets/js/{60b44bb3.307b0835.js => 60b44bb3.cd6b02e5.js} (76%) delete mode 100644 assets/js/614bf889.aaba91cf.js create mode 100644 assets/js/614bf889.d0cd4e0f.js create mode 100644 assets/js/616c3c5f.1cdca731.js delete mode 100644 assets/js/616c3c5f.bd691e7a.js rename assets/js/{630c0586.c70b91cf.js => 630c0586.3d0a2222.js} (72%) rename assets/js/{633c1607.89502a88.js => 633c1607.161382be.js} (58%) rename assets/js/{315f70d7.f7772db5.js => 63e50675.01233995.js} (87%) delete mode 100644 assets/js/63e50675.4297b82d.js rename assets/js/{63f4f69b.96e28581.js => 63f4f69b.e025fb7b.js} (66%) delete mode 100644 assets/js/6640fadb.2a263df0.js create mode 100644 assets/js/6640fadb.9fe22cfe.js rename assets/js/{67577ba3.6bcff61d.js => 67577ba3.2b5d76ef.js} (54%) create mode 100644 assets/js/677cd0d0.0e545643.js delete mode 100644 assets/js/677cd0d0.a3136fa6.js rename assets/js/{6820665d.c22c5d41.js => 6820665d.4b5ff88d.js} (59%) delete mode 100644 assets/js/6860aade.49b86ed0.js create mode 100644 assets/js/6860aade.fe4a8975.js rename assets/js/{69e166e6.aec8046e.js => 69e166e6.b996d0bc.js} (63%) create mode 100644 assets/js/6a3f97e9.26250eac.js delete mode 100644 assets/js/6a3f97e9.c7f68fb4.js create mode 100644 assets/js/6a5f4378.605f245e.js delete mode 100644 assets/js/6a5f4378.9df15c40.js delete mode 100644 assets/js/6a776bdd.11aef138.js rename assets/js/{10dd8346.e6eb5a40.js => 6a776bdd.33947d69.js} (52%) create mode 100644 assets/js/6bc4497f.df3ef900.js rename assets/js/{6ce368a3.af02e414.js => 6ce368a3.f5eb1e9f.js} (52%) delete mode 100644 assets/js/6d1e9f65.b59e638a.js create mode 100644 assets/js/6d1e9f65.f1c33b61.js rename assets/js/{6dd10ff9.1bca96c4.js => 6dd10ff9.d0f53e5d.js} (71%) rename assets/js/{6e04c99e.f82c0fb5.js => 6e04c99e.594c9f82.js} (56%) rename assets/js/{f045e7b7.85347ddc.js => 6e3ad032.0b66d669.js} (83%) delete mode 100644 assets/js/6e3ad032.57d009b8.js rename assets/js/{6e45c04d.ec1fdd8c.js => 6e45c04d.c1bec811.js} (50%) create mode 100644 assets/js/6e8f824f.3bf40882.js delete mode 100644 assets/js/6e8f824f.fcacc816.js rename assets/js/{6f4ef943.2cd06597.js => 6f4ef943.bd733d86.js} (66%) delete mode 100644 assets/js/708f8d61.22d52505.js create mode 100644 assets/js/708f8d61.4935a0a9.js delete mode 100644 assets/js/7099ba54.3af58104.js create mode 100644 assets/js/7099ba54.72e93bbc.js delete mode 100644 assets/js/716c9898.48033f5a.js create mode 100644 assets/js/716c9898.d4cfa1da.js create mode 100644 assets/js/7185c610.a883142c.js delete mode 100644 assets/js/7185c610.f766119c.js delete mode 100644 assets/js/72c1f20b.61c48f83.js create mode 100644 assets/js/72c1f20b.c1872017.js create mode 100644 assets/js/7303162f.e2092c41.js delete mode 100644 assets/js/745b747c.4b5d123f.js create mode 100644 assets/js/745b747c.b8558566.js rename assets/js/{74759a1d.2abc1c7e.js => 74759a1d.89b75277.js} (79%) rename assets/js/{74d44509.92412fc8.js => 74d44509.0de4d5fb.js} (72%) delete mode 100644 assets/js/74ebec6a.deb7a647.js create mode 100644 assets/js/74ebec6a.eed1087b.js rename assets/js/{75302c49.5bb0a4f2.js => 75302c49.667ab493.js} (71%) delete mode 100644 assets/js/7545587d.ee923580.js create mode 100644 assets/js/7545587d.fa3d9e6c.js create mode 100644 assets/js/75ab057d.8e50ae3b.js delete mode 100644 assets/js/75ab057d.fdc0c98e.js delete mode 100644 assets/js/7618e133.a0a9aa35.js create mode 100644 assets/js/7618e133.e73bf9d2.js create mode 100644 assets/js/76d95e5c.1035a5ce.js delete mode 100644 assets/js/76d95e5c.98e43164.js delete mode 100644 assets/js/778a9245.52bb1dd4.js create mode 100644 assets/js/778a9245.b33afa5e.js rename assets/js/{782c6007.28231cd9.js => 782c6007.e7bd0bbe.js} (57%) rename assets/js/{786c47e0.9cf1c460.js => 786c47e0.bde7816d.js} (61%) rename assets/js/{dba30cc3.853fc089.js => 79491168.3e566cc8.js} (61%) delete mode 100644 assets/js/7a554e78.52336f85.js create mode 100644 assets/js/7a554e78.724af6fa.js create mode 100644 assets/js/7a9a7793.5a65253b.js delete mode 100644 assets/js/7b1770b7.174514d2.js create mode 100644 assets/js/7b1770b7.1f7ad088.js rename assets/js/{0aa416e4.d61046d3.js => 7b2d9031.8f4c61e1.js} (61%) delete mode 100644 assets/js/7b2d9031.9cd88ca6.js rename assets/js/{7bbaa3fd.9b4a80f1.js => 7bbaa3fd.af7b2d6e.js} (50%) delete mode 100644 assets/js/7bd8db71.384128b2.js create mode 100644 assets/js/7bd8db71.44a33105.js rename assets/js/{7bff0330.604bd494.js => 7bff0330.69d0c41b.js} (52%) delete mode 100644 assets/js/7c2d24a0.2383c4c0.js create mode 100644 assets/js/7c2d24a0.aa937b42.js rename assets/js/{7cdda714.e7dbc7cd.js => 7cdda714.e6ce9e93.js} (57%) rename assets/js/{7e5eaca3.a0ce4cdd.js => 7e5eaca3.407b5a75.js} (61%) rename assets/js/{7eebe738.4560fb74.js => 7eebe738.15caaaaf.js} (66%) create mode 100644 assets/js/7f295f25.590a8a65.js delete mode 100644 assets/js/7f295f25.da885120.js delete mode 100644 assets/js/7f9218ea.10926291.js create mode 100644 assets/js/7f9218ea.72384585.js delete mode 100644 assets/js/822b3119.a98bd0bf.js create mode 100644 assets/js/822b3119.f4d9a350.js create mode 100644 assets/js/829ea0d8.74e9b0e8.js rename assets/js/{848d8688.0644699c.js => 848d8688.fc51b9bd.js} (57%) rename assets/js/{84ed7bc0.15900fd8.js => 84ed7bc0.f119d912.js} (74%) delete mode 100644 assets/js/854c9b92.99ecdc12.js create mode 100644 assets/js/854c9b92.db2599e0.js delete mode 100644 assets/js/86627abc.6564fa7a.js rename assets/js/{4fd99ad7.01581955.js => 86627abc.e66ff675.js} (52%) rename assets/js/{86824b0d.31443cd1.js => 86824b0d.9345414d.js} (73%) delete mode 100644 assets/js/8686a231.35636ce1.js create mode 100644 assets/js/8686a231.b2d997e9.js rename assets/js/{872f83ed.0e67c0e0.js => 872f83ed.449249f6.js} (56%) rename assets/js/{87ba6c01.f88a0e3d.js => 87ba6c01.efc5f88d.js} (59%) rename assets/js/{8825f040.3fd88dc1.js => 8825f040.dca277e4.js} (50%) delete mode 100644 assets/js/885c3eed.7926480e.js create mode 100644 assets/js/885c3eed.84f23cf3.js delete mode 100644 assets/js/88738dec.60a172da.js create mode 100644 assets/js/88738dec.cfaf97ca.js delete mode 100644 assets/js/88cd306c.a1d977c8.js create mode 100644 assets/js/88cd306c.c7045164.js rename assets/js/{897ccb8c.1ba865d0.js => 897ccb8c.9c64b198.js} (51%) create mode 100644 assets/js/8a613fda.2e0b9a53.js delete mode 100644 assets/js/8a613fda.6cd69134.js rename assets/js/{1443f4ed.278c3413.js => 8b9d128b.c47e6976.js} (66%) delete mode 100644 assets/js/8b9d128b.ef7ca228.js delete mode 100644 assets/js/8c58d523.5b41f32c.js create mode 100644 assets/js/8c58d523.5fcf9a72.js delete mode 100644 assets/js/8caa8a00.0f19b4eb.js create mode 100644 assets/js/8caa8a00.5b9ba429.js create mode 100644 assets/js/8d09ef80.70a09e5b.js delete mode 100644 assets/js/8d09ef80.a3b8aa69.js rename assets/js/{8d949470.d6952492.js => 8d949470.7acbf8b2.js} (50%) rename assets/js/{8fb47936.3f20ecc8.js => 8fb47936.f492469b.js} (53%) create mode 100644 assets/js/8fce6473.379c2566.js delete mode 100644 assets/js/8fce6473.4a6095c5.js create mode 100644 assets/js/903a24c7.302c2ff8.js delete mode 100644 assets/js/903a24c7.507b4f50.js rename assets/js/{50e12e40.8d04c83c.js => 9179e1fd.0caed1e5.js} (63%) delete mode 100644 assets/js/9179e1fd.437c3741.js create mode 100644 assets/js/939aec07.357d07dc.js delete mode 100644 assets/js/939aec07.f6ef11c8.js rename assets/js/{939d8e48.1e44b5fa.js => 939d8e48.16c8bb90.js} (57%) create mode 100644 assets/js/94e13d9f.e7f73dcf.js delete mode 100644 assets/js/965844a6.8de32c04.js create mode 100644 assets/js/965844a6.b7015cf5.js rename assets/js/{967cd6f1.b0edf112.js => 967cd6f1.1e70f997.js} (56%) create mode 100644 assets/js/97ebb3c3.1dfb3c05.js delete mode 100644 assets/js/97ebb3c3.43adf073.js rename assets/js/{98a7e8c2.5299a206.js => 98a7e8c2.f3011ce4.js} (57%) delete mode 100644 assets/js/98de558e.5063c841.js create mode 100644 assets/js/98de558e.94ef12b5.js create mode 100644 assets/js/9b2d48a8.c819c812.js delete mode 100644 assets/js/9b2d48a8.df607282.js rename assets/js/{94e13d9f.8a871bbb.js => 9bb6a893.11b68303.js} (81%) delete mode 100644 assets/js/9bb6a893.aedf09b8.js create mode 100644 assets/js/9bf318bc.33f1e1f1.js delete mode 100644 assets/js/9bf318bc.f88f848e.js delete mode 100644 assets/js/9c48a3c3.b10fafba.js create mode 100644 assets/js/9c48a3c3.bc99bb67.js delete mode 100644 assets/js/9c519060.36b66e53.js create mode 100644 assets/js/9c519060.56ecdb7c.js rename assets/js/{9c663d15.3d4d8e7e.js => 9c663d15.a566ba20.js} (52%) create mode 100644 assets/js/9cd9e94b.00d652a7.js delete mode 100644 assets/js/9cd9e94b.25a780ca.js create mode 100644 assets/js/9d7f1f4e.3c38deb1.js delete mode 100644 assets/js/9d7f1f4e.84ef8d56.js rename assets/js/{9ea7bff0.7c995c9b.js => 9ea7bff0.58898870.js} (55%) rename assets/js/{9f4fc3a5.4676ea6f.js => 9f4fc3a5.4e77d862.js} (62%) delete mode 100644 assets/js/a0e70061.8b4238fb.js create mode 100644 assets/js/a0e70061.de3aff40.js delete mode 100644 assets/js/a2999c7b.c459d196.js create mode 100644 assets/js/a2999c7b.c615aa55.js rename assets/js/{a2cf3e59.23034402.js => a2cf3e59.3d2a70c4.js} (52%) rename assets/js/{a3c59622.dffc9c0d.js => a3c59622.0e20a29e.js} (73%) rename assets/js/{a4de3295.f43a0d6a.js => a4de3295.e9631e48.js} (61%) create mode 100644 assets/js/a6f269d3.2df3a6fc.js delete mode 100644 assets/js/a6f269d3.74d04c77.js create mode 100644 assets/js/a75904f3.0c6c93fd.js delete mode 100644 assets/js/a75904f3.200176d4.js create mode 100644 assets/js/a7e19356.8683a77e.js delete mode 100644 assets/js/a7e19356.db816234.js delete mode 100644 assets/js/a8448cb9.6f8c663a.js rename assets/js/{829ea0d8.519befe1.js => a8448cb9.b3014463.js} (78%) create mode 100644 assets/js/aa54ad12.19abde00.js delete mode 100644 assets/js/aa54ad12.725bcc1f.js create mode 100644 assets/js/ab7f36eb.633f5963.js create mode 100644 assets/js/ac458ff7.15ac0b60.js delete mode 100644 assets/js/ac458ff7.25ec84f1.js create mode 100644 assets/js/acda1e9a.62601357.js delete mode 100644 assets/js/acda1e9a.67ab3473.js rename assets/js/{ad46b7fa.73e7c6ad.js => ad46b7fa.ad1f7deb.js} (61%) create mode 100644 assets/js/aeed717b.62e6e664.js delete mode 100644 assets/js/aeed717b.ba318044.js rename assets/js/{af1d2a20.cea10546.js => af1d2a20.6129d6b4.js} (57%) delete mode 100644 assets/js/b3513936.93597101.js create mode 100644 assets/js/b3513936.d675af76.js rename assets/js/{b3598656.429ce049.js => b3598656.ba7247f4.js} (65%) rename assets/js/{b3852a80.6933d545.js => b3852a80.0e498c01.js} (62%) create mode 100644 assets/js/b3b28758.27709425.js delete mode 100644 assets/js/b3b28758.8b6cb505.js rename assets/js/{b613d2b0.a22ac46f.js => b613d2b0.5f48174b.js} (66%) rename assets/js/{b6b7462b.cd2d3da6.js => b6b7462b.bb2370eb.js} (58%) create mode 100644 assets/js/b7738e77.901f8721.js delete mode 100644 assets/js/b7738e77.c51a3648.js rename assets/js/{b8f8efa9.cc1cb748.js => b8f8efa9.31c4c577.js} (55%) rename assets/js/{b98442e5.8025a7f7.js => b98442e5.dbe77e92.js} (51%) delete mode 100644 assets/js/ba80fff7.516b72f2.js create mode 100644 assets/js/ba80fff7.ed9a2284.js delete mode 100644 assets/js/bab3d5c4.0d3e12e3.js create mode 100644 assets/js/bab3d5c4.e4ffa122.js create mode 100644 assets/js/bb3d1fd8.ab5434d0.js delete mode 100644 assets/js/bb3d1fd8.ffcfeb53.js create mode 100644 assets/js/bbadfede.5e3d010e.js delete mode 100644 assets/js/bbadfede.f271bc2d.js delete mode 100644 assets/js/c0a31065.2adb126b.js create mode 100644 assets/js/c0a31065.a87d9d25.js delete mode 100644 assets/js/c0a597be.9e69f870.js create mode 100644 assets/js/c0a597be.e61676f6.js rename assets/js/{c15d2dfd.689305f1.js => c15d2dfd.11486c6b.js} (75%) delete mode 100644 assets/js/c16d8146.77e647d6.js create mode 100644 assets/js/c16d8146.c0b7a86d.js delete mode 100644 assets/js/c23d0401.4aa1aadb.js create mode 100644 assets/js/c23d0401.dbb5ed99.js delete mode 100644 assets/js/c2ab93b1.0629cadc.js create mode 100644 assets/js/c2ab93b1.d768c67a.js rename assets/js/{c343b34f.7cf5f70e.js => c343b34f.47cc5e4c.js} (76%) rename assets/js/{c3883936.7f65b339.js => c3883936.69ca83e1.js} (58%) rename assets/js/{c399ec27.97387419.js => c399ec27.d82ec406.js} (56%) rename assets/js/{c5085584.f1e9fbed.js => c5085584.6987b4c8.js} (57%) rename assets/js/{c6038e1b.9065c830.js => c6038e1b.c5b8be9a.js} (54%) rename assets/js/{c60805be.b1286331.js => c60805be.eae39302.js} (51%) create mode 100644 assets/js/c64f3a69.00cc6093.js delete mode 100644 assets/js/c64f3a69.cc8408fa.js rename assets/js/{c723c0cc.118a236d.js => c723c0cc.7b7cc99f.js} (73%) delete mode 100644 assets/js/c7fbc0ef.1ca14613.js create mode 100644 assets/js/c7fbc0ef.6e7b3adf.js delete mode 100644 assets/js/c822c14e.163b14fe.js create mode 100644 assets/js/c822c14e.b5c6aebd.js create mode 100644 assets/js/c84d9142.0bf34fe1.js delete mode 100644 assets/js/c84d9142.d3bfcb5a.js rename assets/js/{c8df61ff.0a67c754.js => c8df61ff.52c7c58d.js} (54%) create mode 100644 assets/js/c92127f8.13640964.js delete mode 100644 assets/js/c92127f8.5bab74c5.js delete mode 100644 assets/js/c9cd668e.66732cfe.js create mode 100644 assets/js/c9cd668e.8335d969.js rename assets/js/{ca18adae.32fd3af5.js => ca18adae.472ebde4.js} (65%) rename assets/js/{ffb45ffd.0a254235.js => ca555eb7.15ffd6ec.js} (50%) delete mode 100644 assets/js/ca555eb7.d3539520.js rename assets/js/{cac9ed2c.cc42edd8.js => cac9ed2c.6d0ad2ad.js} (56%) delete mode 100644 assets/js/cba6b6af.41fd2045.js create mode 100644 assets/js/cba6b6af.743b1b2a.js rename assets/js/{cbc1ba65.6e126df8.js => cbc1ba65.e57f07db.js} (59%) create mode 100644 assets/js/cd9b1c9a.67bdc03f.js delete mode 100644 assets/js/cd9b1c9a.a69f595c.js rename assets/js/{cdaa6d95.9a752298.js => cdaa6d95.14c7a070.js} (56%) rename assets/js/{cf3af301.c04ce4bb.js => cf3af301.5efab20d.js} (57%) rename assets/js/{d015a450.741ff624.js => d015a450.600eae63.js} (61%) create mode 100644 assets/js/d0407f30.1f570c33.js delete mode 100644 assets/js/d0407f30.390b443b.js rename assets/js/{d3423e10.52f4e15c.js => d3423e10.f6733019.js} (58%) create mode 100644 assets/js/d42a51a7.472b1b4e.js delete mode 100644 assets/js/d42a51a7.594b4d8b.js delete mode 100644 assets/js/d45de8b2.a3d5e9fb.js create mode 100644 assets/js/d45de8b2.b57b7bca.js delete mode 100644 assets/js/d56aca12.8e3e433e.js create mode 100644 assets/js/d56aca12.e5c0e8de.js rename assets/js/{d7171b57.c5380824.js => d7171b57.fdb7c1d9.js} (50%) rename assets/js/{d7e03563.b5b41400.js => d7e03563.2852b237.js} (64%) create mode 100644 assets/js/d80994d3.9ddfc2f5.js delete mode 100644 assets/js/d80994d3.eb5f2a88.js create mode 100644 assets/js/d8462e79.a8153383.js delete mode 100644 assets/js/d8462e79.f99c8297.js create mode 100644 assets/js/d8df352c.0dcaff33.js delete mode 100644 assets/js/d8df352c.eabfb865.js create mode 100644 assets/js/db14d48d.47080618.js delete mode 100644 assets/js/db14d48d.84b14ced.js create mode 100644 assets/js/dba30cc3.97c8545f.js create mode 100644 assets/js/dc15f746.bd7c3078.js delete mode 100644 assets/js/dc15f746.dee8c45e.js rename assets/js/{dc194db1.6c6a2b2e.js => dc194db1.025d31f6.js} (56%) create mode 100644 assets/js/dc4070cd.29ba74e9.js delete mode 100644 assets/js/dc4070cd.69c62b49.js delete mode 100644 assets/js/dc5374e7.95a2aa90.js create mode 100644 assets/js/dc5374e7.c1a39806.js create mode 100644 assets/js/dc88b3e9.2451965e.js delete mode 100644 assets/js/dc88b3e9.7162991b.js delete mode 100644 assets/js/dca1894e.244ba8e7.js create mode 100644 assets/js/dca1894e.7236dc0c.js create mode 100644 assets/js/dcd98c64.6341f514.js delete mode 100644 assets/js/dcd98c64.91638dcf.js delete mode 100644 assets/js/dd866dcb.2af98cd0.js create mode 100644 assets/js/dd866dcb.5e0e9691.js delete mode 100644 assets/js/ddc2f5d7.cd4b8a93.js rename assets/js/{7a9a7793.b54767d3.js => ddc2f5d7.ddcbe3c6.js} (68%) delete mode 100644 assets/js/ddd0b04f.6ba97eb5.js create mode 100644 assets/js/ddd0b04f.916c5fd4.js delete mode 100644 assets/js/deef9a5e.27dcb544.js create mode 100644 assets/js/deef9a5e.47da4fa4.js delete mode 100644 assets/js/df710605.158f54d0.js create mode 100644 assets/js/df710605.2df1578c.js delete mode 100644 assets/js/e00febc1.627bedaf.js create mode 100644 assets/js/e00febc1.8e89b8b8.js rename assets/js/{e0440eb5.0c2f2926.js => e0440eb5.33c64edf.js} (65%) rename assets/js/{ab7f36eb.ae65c9fc.js => e0e7afc2.16317bd4.js} (75%) delete mode 100644 assets/js/e0e7afc2.54c3c748.js rename assets/js/{e173b207.62663617.js => e173b207.b0fe2756.js} (71%) delete mode 100644 assets/js/e1f73728.8df6bb2b.js create mode 100644 assets/js/e1f73728.adbcc625.js delete mode 100644 assets/js/e2a5b3d8.9888da91.js create mode 100644 assets/js/e2a5b3d8.c057ef9b.js rename assets/js/{e42a2b73.e3c9cb46.js => e42a2b73.a5dc8e5f.js} (52%) rename assets/js/{e44881fb.b8c852bb.js => e44881fb.8f374c06.js} (71%) rename assets/js/{e4e82e6a.c0ce8fb3.js => e4e82e6a.d2c13804.js} (56%) delete mode 100644 assets/js/e553387a.a7eaf8ba.js create mode 100644 assets/js/e553387a.d8621b90.js rename assets/js/{e69e8760.99227eaa.js => e69e8760.697d3c2d.js} (50%) rename assets/js/{e70660f8.b57cf4b9.js => e70660f8.1c609078.js} (50%) rename assets/js/{e726a1ae.987d1199.js => e726a1ae.208139b3.js} (56%) create mode 100644 assets/js/e7abe289.4bc84b9c.js delete mode 100644 assets/js/e7abe289.a9d5b521.js create mode 100644 assets/js/e7fd969b.04b54ae9.js delete mode 100644 assets/js/e7fd969b.c0dec1fc.js create mode 100644 assets/js/e8dc6da9.779860b8.js delete mode 100644 assets/js/e8dc6da9.c19f9011.js rename assets/js/{e8ee2e7e.86722293.js => e8ee2e7e.a3401d66.js} (56%) create mode 100644 assets/js/e96154c8.25978e0d.js delete mode 100644 assets/js/e96154c8.822e635d.js rename assets/js/{e9a1fc69.79989be9.js => e9a1fc69.d6f6b50f.js} (51%) create mode 100644 assets/js/ea0753a5.10d3e1c3.js delete mode 100644 assets/js/ea0753a5.6402f3a8.js create mode 100644 assets/js/ea3ae765.39b961ea.js delete mode 100644 assets/js/ea3ae765.a98d8e08.js delete mode 100644 assets/js/ea9c842e.8db019ee.js create mode 100644 assets/js/ea9c842e.9d400985.js rename assets/js/{eac2cc2d.e1322892.js => eac2cc2d.bdd9f443.js} (62%) create mode 100644 assets/js/eb63b0ef.8273f577.js delete mode 100644 assets/js/eb63b0ef.fc6ca354.js create mode 100644 assets/js/ec0fc490.57559266.js delete mode 100644 assets/js/ec0fc490.f6c9823a.js create mode 100644 assets/js/ecab07fd.6f276b2e.js delete mode 100644 assets/js/ecab07fd.e5484f12.js rename assets/js/{ecad0521.47483e14.js => ecad0521.102a5ff2.js} (62%) rename assets/js/{eccba3aa.43b4cd99.js => eccba3aa.4a6d39c3.js} (70%) create mode 100644 assets/js/ed03b417.1ba9930b.js delete mode 100644 assets/js/ed03b417.3b39e326.js delete mode 100644 assets/js/ed75a16f.2f5c8dc1.js create mode 100644 assets/js/ed75a16f.4daffc73.js rename assets/js/{edccb6ef.fa02e59a.js => edccb6ef.bca025bd.js} (65%) delete mode 100644 assets/js/ee7d8ce4.3cf8fded.js create mode 100644 assets/js/ee7d8ce4.7a714097.js create mode 100644 assets/js/f045e7b7.1d2a35bf.js create mode 100644 assets/js/f1ab784a.854cff6c.js delete mode 100644 assets/js/f1ab784a.adce89f0.js create mode 100644 assets/js/f1aff4d7.db47787f.js create mode 100644 assets/js/f299eef4.d5c39b68.js delete mode 100644 assets/js/f299eef4.e08728d2.js create mode 100644 assets/js/f2b6f2a5.2679b198.js rename assets/js/{f2cf4e40.e71b86e8.js => f2cf4e40.577a48d1.js} (66%) delete mode 100644 assets/js/f3c54afa.15bef2ad.js create mode 100644 assets/js/f3c54afa.e813accf.js create mode 100644 assets/js/f3d1d985.937d5c74.js delete mode 100644 assets/js/f3d1d985.efe508c5.js delete mode 100644 assets/js/f6257df4.39fb9fdb.js create mode 100644 assets/js/f6257df4.d61f8320.js create mode 100644 assets/js/f7401177.9e77e213.js delete mode 100644 assets/js/f7401177.db760ab4.js create mode 100644 assets/js/f7abad00.c58ab378.js delete mode 100644 assets/js/f7abad00.f87b0b39.js create mode 100644 assets/js/f7d78b3c.23e9d308.js delete mode 100644 assets/js/f7d78b3c.e54297a7.js create mode 100644 assets/js/f819c265.45510951.js delete mode 100644 assets/js/f819c265.a0044aa2.js rename assets/js/{f8810dab.2be3fca8.js => f8810dab.9eecf211.js} (68%) create mode 100644 assets/js/f920965e.ab3ce600.js delete mode 100644 assets/js/f920965e.cf804876.js delete mode 100644 assets/js/f9c04764.287b42a9.js create mode 100644 assets/js/f9c04764.7ab7be8d.js delete mode 100644 assets/js/fac9b75a.0511d56b.js create mode 100644 assets/js/fac9b75a.f3bbb3f7.js delete mode 100644 assets/js/fb64cc05.4bda9c7b.js create mode 100644 assets/js/fb64cc05.b7922c0a.js rename assets/js/{fc092607.696a6720.js => fc092607.830c412c.js} (50%) delete mode 100644 assets/js/fc1dbbb7.443fc69f.js create mode 100644 assets/js/fc1dbbb7.97705f7b.js rename assets/js/{fd4e0f15.eb3f931c.js => fd4e0f15.ee55a187.js} (72%) rename assets/js/{fe8f578b.f18f48c7.js => fe8f578b.20cbd6ea.js} (50%) delete mode 100644 assets/js/fedff9e4.6511f300.js rename assets/js/{1e3f28fe.2858d53d.js => fedff9e4.8d6b6744.js} (83%) create mode 100644 assets/js/ffb45ffd.eda4f0c5.js rename assets/js/{runtime~main.28d61aff.js => runtime~main.283b9de6.js} (72%) diff --git a/404.html b/404.html index f516f8d153..6c7785533b 100644 --- a/404.html +++ b/404.html @@ -7,14 +7,14 @@ Page Not Found | Hydra - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/1e1bc213.de964369.js b/assets/js/0169dbe1.ca0f52b0.js similarity index 80% rename from assets/js/1e1bc213.de964369.js rename to assets/js/0169dbe1.ca0f52b0.js index bf01d9f63a..eaf02f1864 100644 --- a/assets/js/1e1bc213.de964369.js +++ b/assets/js/0169dbe1.ca0f52b0.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8198],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return g},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return c}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var g=r.createContext({}),c=function(e){return function(n){var t=s(n.components);return r.createElement(e,i({},n,{components:t}))}},s=function(e){var n=r.useContext(g),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=s(e.components);return r.createElement(g.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,g=u(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,p=c["".concat(a,".").concat(m)]||c[m]||d[m]||i;return t?r.createElement(p,l(l({ref:n},g),{},{components:t})):r.createElement(p,l({ref:n},g))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=p;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var g=2;g=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var g=r.createContext({}),c=function(e){return function(n){var t=s(n.components);return r.createElement(e,i({},n,{components:t}))}},s=function(e){var n=r.useContext(g),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=s(e.components);return r.createElement(g.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,g=u(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,p=c["".concat(a,".").concat(m)]||c[m]||d[m]||i;return t?r.createElement(p,l(l({ref:n},g),{},{components:t})):r.createElement(p,l({ref:n},g))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=p;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var g=2;g=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var g=r.createContext({}),c=function(e){return function(n){var t=s(n.components);return r.createElement(e,i({},n,{components:t}))}},s=function(e){var n=r.useContext(g),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=s(e.components);return r.createElement(g.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,g=u(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,p=c["".concat(a,".").concat(m)]||c[m]||d[m]||i;return t?r.createElement(p,l(l({ref:n},g),{},{components:t})):r.createElement(p,l({ref:n},g))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=p;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var g=2;g=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){return function(n){var t=l(n.components);return r.createElement(e,i({},n,{components:t}))}},l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},h={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),p=l(t),u=a,m=p["".concat(o,".").concat(u)]||p[u]||h[u]||i;return t?r.createElement(m,c(c({ref:n},s),{},{components:t})):r.createElement(m,c({ref:n},s))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=m;var c={};for(var d in n)hasOwnProperty.call(n,d)&&(c[d]=n[d]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;s= "1.2"'),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"@hydra.main(config_path=None)\n# or:\nhydra.initialize(config_path=None)\n")),(0,i.mdx)("h3",{id:"using-the-application-directory"},"Using the application directory"),(0,i.mdx)("p",null,"Use the directory/module of the Python script.\nThis was the default behavior up to Hydra 1.0.",(0,i.mdx)("br",{parentName:"p"}),"\n","This is not recommended as it can cause the surprising behavior outlined above."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'@hydra.main(config_path=".")\n# or:\nhydra.initialize(config_path=".")\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2523],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return s},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return l},withMDXComponents:function(){return p}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){return function(n){var t=l(n.components);return r.createElement(e,i({},n,{components:t}))}},l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},h={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),p=l(t),u=a,m=p["".concat(o,".").concat(u)]||p[u]||h[u]||i;return t?r.createElement(m,c(c({ref:n},s),{},{components:t})):r.createElement(m,c({ref:n},s))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=m;var c={};for(var d in n)hasOwnProperty.call(n,d)&&(c[d]=n[d]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;s= "1.2"'),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"@hydra.main(config_path=None)\n# or:\nhydra.initialize(config_path=None)\n")),(0,i.mdx)("h3",{id:"using-the-application-directory"},"Using the application directory"),(0,i.mdx)("p",null,"Use the directory/module of the Python script.\nThis was the default behavior up to Hydra 1.0.",(0,i.mdx)("br",{parentName:"p"}),"\n","This is not recommended as it can cause the surprising behavior outlined above."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'@hydra.main(config_path=".")\n# or:\nhydra.initialize(config_path=".")\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/02deea7a.9d47866f.js b/assets/js/02deea7a.9d47866f.js new file mode 100644 index 0000000000..d915a50c16 --- /dev/null +++ b/assets/js/02deea7a.9d47866f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4420],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return p},mdx:function(){return f},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(){return r=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,r({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=c(n),p=i,g=m["".concat(o,".").concat(p)]||m[p]||u[p]||r;return n?a.createElement(g,s(s({ref:t},d),{},{components:n})):a.createElement(g,s({ref:t},d))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=g;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var d=2;d Any:\n """\n :param config: An config object describing what to call and what params to use.\n In addition to the parameters, the config must contain:\n _target_ : target class or callable name (str)\n And may contain:\n _args_: List-like of positional arguments to pass to the target\n _recursive_: Construct nested objects as well (bool).\n True by default.\n may be overridden via a _recursive_ key in\n the kwargs\n _convert_: Conversion strategy\n none : Passed objects are DictConfig and ListConfig, default\n partial : Passed objects are converted to dict and list, with\n the exception of Structured Configs (and their fields).\n object : Passed objects are converted to dict and list.\n Structured Configs are converted to instances of the\n backing dataclass / attr class.\n all : Passed objects are dicts, lists and primitives without\n a trace of OmegaConf containers. Structured configs\n are converted to dicts / lists too.\n _partial_: If True, return functools.partial wrapped method or object\n False by default. Configure per target.\n :param args: Optional positional parameters pass-through\n :param kwargs: Optional named parameters to override\n parameters in the config object. Parameters not present\n in the config objects are being passed as is to the target.\n IMPORTANT: dataclasses instances in kwargs are interpreted as config\n and cannot be used as passthrough\n :return: if _target_ is a class name: the instantiated object\n if _target_ is a callable: the return value of the call\n """\n\n# Alias for instantiate\ncall = instantiate\n'))),(0,o.mdx)("br",null),(0,o.mdx)("p",null,"The config passed to these functions must have a key called ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),", with the value of a fully qualified class name, class method, static method or callable.\nFor convenience, ",(0,o.mdx)("inlineCode",{parentName:"p"},"None")," config results in a ",(0,o.mdx)("inlineCode",{parentName:"p"},"None")," object."),(0,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"Named arguments")," : Config fields (except reserved fields like ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),") are passed as named arguments to the target.\nNamed arguments in the config can be overridden by passing named argument with the same name in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"Positional arguments")," : The config may contain a ",(0,o.mdx)("inlineCode",{parentName:"p"},"_args_")," field representing positional arguments to pass to the target.\nThe positional arguments can be overridden together by passing positional arguments in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,o.mdx)("h3",{id:"simple-usage"},"Simple usage"),(0,o.mdx)("p",null,"Your application might have an Optimizer class:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example class"',title:'"Example','class"':!0},"class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n")),(0,o.mdx)("div",{className:"row"},(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n\n\n\n\n"))),(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},"opt = instantiate(cfg.optimizer)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.01)\n\n# override parameters on the call-site\nopt = instantiate(cfg.optimizer, lr=0.2)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.2)\n")))),(0,o.mdx)("h3",{id:"recursive-instantiation"},"Recursive instantiation"),(0,o.mdx)("p",null,"Let's add a Dataset and a Trainer class. The trainer holds a Dataset and an Optimizer instances."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Additional classes"',title:'"Additional','classes"':!0},"class Dataset:\n name: str\n path: str\n\n def __init__(self, name: str, path: str) -> None:\n self.name = name\n self.path = path\n\n\nclass Trainer:\n def __init__(self, optimizer: Optimizer, dataset: Dataset) -> None:\n self.optimizer = optimizer\n self.dataset = dataset\n")),(0,o.mdx)("p",null,"With the following config, you can instantiate the whole thing with a single call:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Example config"',title:'"Example','config"':!0},"trainer:\n _target_: my_app.Trainer\n optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n dataset:\n _target_: my_app.Dataset\n name: Imagenet\n path: /datasets/imagenet\n")),(0,o.mdx)("p",null,"Hydra will instantiate nested objects recursively by default."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"trainer = instantiate(cfg.trainer)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.01),\n# dataset=Dataset(name=Imagenet, path=/datasets/imagenet)\n# )\n")),(0,o.mdx)("p",null,"You can override parameters for nested objects:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'trainer = instantiate(\n cfg.trainer,\n optimizer={"lr": 0.3},\n dataset={"name": "cifar10", "path": "/datasets/cifar10"},\n)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.3),\n# dataset=Dataset(name=cifar10, path=/datasets/cifar10)\n# )\n')),(0,o.mdx)("p",null,"Similarly, positional arguments of nested objects can be overridden:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'obj = instantiate(\n cfg.object,\n # pass 1 and 2 as positional arguments to the target object\n 1, 2, \n # pass 3 and 4 as positional arguments to a nested child object\n child={"_args_": [3, 4]},\n)\n')),(0,o.mdx)("h3",{id:"disable-recursive-instantiation"},"Disable recursive instantiation"),(0,o.mdx)("p",null,"You can disable recursive instantiation by setting ",(0,o.mdx)("inlineCode",{parentName:"p"},"_recursive_")," to ",(0,o.mdx)("inlineCode",{parentName:"p"},"False")," in the config node or in the call-site\nIn that case the Trainer object will receive an OmegaConf DictConfig for nested dataset and optimizer instead of the instantiated objects."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"optimizer = instantiate(cfg.trainer, _recursive_=False)\nprint(optimizer)\n")),(0,o.mdx)("p",null,"Output:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"Trainer(\n optimizer={\n '_target_': 'my_app.Optimizer', 'algo': 'SGD', 'lr': 0.01\n },\n dataset={\n '_target_': 'my_app.Dataset', 'name': 'Imagenet', 'path': '/datasets/imagenet'\n }\n)\n")),(0,o.mdx)("h3",{id:"parameter-conversion-strategies"},"Parameter conversion strategies"),(0,o.mdx)("p",null,"By default, the parameters passed to the target are either primitives (int,\nfloat, bool etc) or OmegaConf containers (",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig"),").\nOmegaConf containers have many advantages over primitive dicts and lists,\nincluding convenient attribute access for keys,\n",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html"},"duck-typing as instances of dataclasses or attrs classes"),", and\nsupport for ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#variable-interpolation"},"variable interpolation"),"\nand ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/custom_resolvers.html"},"custom resolvers"),".\nIf the callable targeted by ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate")," leverages OmegaConf's features, it\nwill make sense to pass ",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances directly to\nthat callable."),(0,o.mdx)("p",null,"That being said, in many cases it's desired to pass normal Python dicts and\nlists, rather than ",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances, as arguments to your\ncallable. You can change instantiate's argument conversion strategy using the\n",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," parameter. Supported values are:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"none"')," : Default behavior, Use OmegaConf containers"),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"partial"')," : Convert OmegaConf containers to dict and list, except\nStructured Configs, which remain as DictConfig instances."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"object"')," : Convert OmegaConf containers to dict and list, except Structured\nConfigs, which are converted to instances of the backing dataclass / attr\nclass using ",(0,o.mdx)("inlineCode",{parentName:"li"},"OmegaConf.to_object"),"."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"all"')," : Convert everything to primitive containers")),(0,o.mdx)("p",null,"The conversion strategy applies recursively to all subconfigs of the instantiation target.\nHere is an example demonstrating the various conversion strategies:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\nfrom omegaconf import DictConfig, OmegaConf\nfrom hydra.utils import instantiate\n\n@dataclass\nclass Foo:\n a: int = 123\n\nclass MyTarget:\n def __init__(self, foo, bar):\n self.foo = foo\n self.bar = bar\n\ncfg = OmegaConf.create(\n {\n "_target_": "__main__.MyTarget",\n "foo": Foo(),\n "bar": {"b": 456},\n }\n)\n\nobj_none = instantiate(cfg, _convert_="none")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_none.foo, DictConfig)\nassert isinstance(obj_none.bar, DictConfig)\n\nobj_partial = instantiate(cfg, _convert_="partial")\nassert isinstance(obj_partial, MyTarget)\nassert isinstance(obj_partial.foo, DictConfig)\nassert isinstance(obj_partial.bar, dict)\n\nobj_object = instantiate(cfg, _convert_="object")\nassert isinstance(obj_object, MyTarget)\nassert isinstance(obj_object.foo, Foo)\nassert isinstance(obj_object.bar, dict)\n\nobj_all = instantiate(cfg, _convert_="all")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_all.foo, dict)\nassert isinstance(obj_all.bar, dict)\n')),(0,o.mdx)("p",null,"Passing the ",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," keyword argument to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate")," has the same effect as defining\na ",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," attribute on your config object. Here is an example creating\ninstances of ",(0,o.mdx)("inlineCode",{parentName:"p"},"MyTarget")," that are equivalent to the above:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'cfg_none = OmegaConf.create({..., "_convert_": "none"})\nobj_none = instantiate(cfg_none)\n\ncfg_partial = OmegaConf.create({..., "_convert_": "partial"})\nobj_partial = instantiate(cfg_partial)\n\ncfg_object = OmegaConf.create({..., "_convert_": "object"})\nobj_object = instantiate(cfg_object)\n\ncfg_all = OmegaConf.create({..., "_convert_": "all"})\nobj_all = instantiate(cfg_all)\n')),(0,o.mdx)("h3",{id:"partial-instantiation"},"Partial Instantiation"),(0,o.mdx)("p",null,"Sometimes you may not set all parameters needed to instantiate an object from the configuration, in this case you can set\n",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_")," to be ",(0,o.mdx)("inlineCode",{parentName:"p"},"True")," to get a ",(0,o.mdx)("inlineCode",{parentName:"p"},"functools.partial")," wrapped object or method, then complete initializing the object in\nthe application code. Here is an example:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example classes"',title:'"Example','classes"':!0},'class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Optimizer(algo={self.algo},lr={self.lr})"\n\n\nclass Model:\n def __init__(self, optim_partial: Any, lr: float):\n super().__init__()\n self.optim = optim_partial(lr=lr)\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Model(Optimizer={self.optim},lr={self.lr})"\n')),(0,o.mdx)("div",{className:"row"},(0,o.mdx)("div",{className:"col col--5"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"model:\n _target_: my_app.Model\n optim_partial:\n _partial_: true\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n"))),(0,o.mdx)("div",{className:"col col--7"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},'model = instantiate(cfg.model)\nprint(model)\n# "Model(Optimizer=Optimizer(algo=SGD,lr=0.01),lr=0.01)\n')))),(0,o.mdx)("p",null,"If you are repeatedly instantiating the same config,\nusing ",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_=True")," may provide a significant speedup as compared with regular (non-partial) instantiation."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"factory = instantiate(config, _partial_=True)\nobj = factory()\n")),(0,o.mdx)("p",null,"In the above example, repeatedly calling ",(0,o.mdx)("inlineCode",{parentName:"p"},"factory")," would be faster than repeatedly calling ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate(config)"),".\nA caveat of this approach is that the same keyword arguments would be re-used in each call to ",(0,o.mdx)("inlineCode",{parentName:"p"},"factory"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'class Foo:\n ...\n\nclass Bar:\n def __init__(self, foo):\n self.foo = foo\n\nbar_conf = {\n "_target_": "__main__.Bar",\n "foo": {"_target_": "__main__.Foo"},\n}\n\nbar_factory = instantiate(bar_conf, _partial_=True)\nbar1 = bar_factory()\nbar2 = bar_factory()\n\nassert bar1 is not bar2\nassert bar1.foo is bar2.foo # the `Foo` instance is re-used here\n')),(0,o.mdx)("p",null,"This does not apply if ",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_=False"),",\nin which case a new ",(0,o.mdx)("inlineCode",{parentName:"p"},"Foo")," instance would be created with each call to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate"),"."),(0,o.mdx)("h3",{id:"instantiation-of-builtins"},"Instantiation of builtins"),(0,o.mdx)("p",null,"The value of ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_")," passed to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate"),' should be a "dotpath" pointing\nto some callable that can be looked up via a combination of ',(0,o.mdx)("inlineCode",{parentName:"p"},"import")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"getattr"),".\nIf you want to target one of Python's ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/functions.html"},"built-in functions")," (such as ",(0,o.mdx)("inlineCode",{parentName:"p"},"len")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"print")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"divmod"),"),\nyou will need to provide a dotpath looking up that function in Python's ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/builtins.html"},(0,o.mdx)("inlineCode",{parentName:"a"},"builtins"))," module."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import instantiate\n# instantiate({"_target_": "len"}, [1,2,3]) # this gives an InstantiationException\ninstantiate({"_target_": "builtins.len"}, [1,2,3]) # this works, returns the number 3\n')),(0,o.mdx)("h3",{id:"dotpath-lookup-machinery"},"Dotpath lookup machinery"),(0,o.mdx)("p",null,"Hydra looks up a given ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_")," by attempting to find a module that\ncorresponds to a prefix of the given dotpath and then looking for an object in\nthat module corresponding to the dotpath's tail. For example, to look up a ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),"\ngiven by the dotpath ",(0,o.mdx)("inlineCode",{parentName:"p"},'"my_module.my_nested_module.my_object"'),", hydra first locates\nthe module ",(0,o.mdx)("inlineCode",{parentName:"p"},"my_module.my_nested_module"),", then find ",(0,o.mdx)("inlineCode",{parentName:"p"},"my_object")," inside that nested module."),(0,o.mdx)("p",null,"Hydra exposes an API allowing direct use of this dotpath lookup machinery.\nThe following two functions, which can be imported from the ",(0,o.mdx)(u,{to:"hydra/utils.py",mdxType:"GithubLink"},"hydra.utils")," module,\naccept a string-typed dotpath as an argument and return the located class/callable/object:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'def get_class(path: str) -> type:\n """\n Look up a class based on a dotpath.\n Fails if the path does not point to a class.\n\n >>> import my_module\n >>> from hydra.utils import get_class\n >>> assert get_class("my_module.MyClass") is my_module.MyClass\n """\n ...\n\ndef get_method(path: str) -> Callable[..., Any]:\n """\n Look up a callable based on a dotpath.\n Fails if the path does not point to a callable object.\n\n >>> import my_module\n >>> from hydra.utils import get_method\n >>> assert get_method("my_module.my_function") is my_module.my_function\n """\n ...\n\n# Alias for get_method\nget_static_method = get_method\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/02deea7a.eec514b9.js b/assets/js/02deea7a.eec514b9.js deleted file mode 100644 index d9e55fde5b..0000000000 --- a/assets/js/02deea7a.eec514b9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4420],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(){return r=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,r({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=c(n),p=i,f=m["".concat(o,".").concat(p)]||m[p]||u[p]||r;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var d=2;d Any:\n """\n :param config: An config object describing what to call and what params to use.\n In addition to the parameters, the config must contain:\n _target_ : target class or callable name (str)\n And may contain:\n _args_: List-like of positional arguments to pass to the target\n _recursive_: Construct nested objects as well (bool).\n True by default.\n may be overridden via a _recursive_ key in\n the kwargs\n _convert_: Conversion strategy\n none : Passed objects are DictConfig and ListConfig, default\n partial : Passed objects are converted to dict and list, with\n the exception of Structured Configs (and their fields).\n object : Passed objects are converted to dict and list.\n Structured Configs are converted to instances of the\n backing dataclass / attr class.\n all : Passed objects are dicts, lists and primitives without\n a trace of OmegaConf containers. Structured configs\n are converted to dicts / lists too.\n _partial_: If True, return functools.partial wrapped method or object\n False by default. Configure per target.\n :param args: Optional positional parameters pass-through\n :param kwargs: Optional named parameters to override\n parameters in the config object. Parameters not present\n in the config objects are being passed as is to the target.\n IMPORTANT: dataclasses instances in kwargs are interpreted as config\n and cannot be used as passthrough\n :return: if _target_ is a class name: the instantiated object\n if _target_ is a callable: the return value of the call\n """\n\n# Alias for instantiate\ncall = instantiate\n'))),(0,o.mdx)("br",null),(0,o.mdx)("p",null,"The config passed to these functions must have a key called ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),", with the value of a fully qualified class name, class method, static method or callable.\nFor convenience, ",(0,o.mdx)("inlineCode",{parentName:"p"},"None")," config results in a ",(0,o.mdx)("inlineCode",{parentName:"p"},"None")," object."),(0,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"Named arguments")," : Config fields (except reserved fields like ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),") are passed as named arguments to the target.\nNamed arguments in the config can be overridden by passing named argument with the same name in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"Positional arguments")," : The config may contain a ",(0,o.mdx)("inlineCode",{parentName:"p"},"_args_")," field representing positional arguments to pass to the target.\nThe positional arguments can be overridden together by passing positional arguments in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,o.mdx)("h3",{id:"simple-usage"},"Simple usage"),(0,o.mdx)("p",null,"Your application might have an Optimizer class:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example class"',title:'"Example','class"':!0},"class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n")),(0,o.mdx)("div",{className:"row"},(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n\n\n\n\n"))),(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},"opt = instantiate(cfg.optimizer)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.01)\n\n# override parameters on the call-site\nopt = instantiate(cfg.optimizer, lr=0.2)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.2)\n")))),(0,o.mdx)("h3",{id:"recursive-instantiation"},"Recursive instantiation"),(0,o.mdx)("p",null,"Let's add a Dataset and a Trainer class. The trainer holds a Dataset and an Optimizer instances."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Additional classes"',title:'"Additional','classes"':!0},"class Dataset:\n name: str\n path: str\n\n def __init__(self, name: str, path: str) -> None:\n self.name = name\n self.path = path\n\n\nclass Trainer:\n def __init__(self, optimizer: Optimizer, dataset: Dataset) -> None:\n self.optimizer = optimizer\n self.dataset = dataset\n")),(0,o.mdx)("p",null,"With the following config, you can instantiate the whole thing with a single call:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Example config"',title:'"Example','config"':!0},"trainer:\n _target_: my_app.Trainer\n optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n dataset:\n _target_: my_app.Dataset\n name: Imagenet\n path: /datasets/imagenet\n")),(0,o.mdx)("p",null,"Hydra will instantiate nested objects recursively by default."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"trainer = instantiate(cfg.trainer)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.01),\n# dataset=Dataset(name=Imagenet, path=/datasets/imagenet)\n# )\n")),(0,o.mdx)("p",null,"You can override parameters for nested objects:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'trainer = instantiate(\n cfg.trainer,\n optimizer={"lr": 0.3},\n dataset={"name": "cifar10", "path": "/datasets/cifar10"},\n)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.3),\n# dataset=Dataset(name=cifar10, path=/datasets/cifar10)\n# )\n')),(0,o.mdx)("p",null,"Similarly, positional arguments of nested objects can be overridden:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'obj = instantiate(\n cfg.object,\n # pass 1 and 2 as positional arguments to the target object\n 1, 2, \n # pass 3 and 4 as positional arguments to a nested child object\n child={"_args_": [3, 4]},\n)\n')),(0,o.mdx)("h3",{id:"disable-recursive-instantiation"},"Disable recursive instantiation"),(0,o.mdx)("p",null,"You can disable recursive instantiation by setting ",(0,o.mdx)("inlineCode",{parentName:"p"},"_recursive_")," to ",(0,o.mdx)("inlineCode",{parentName:"p"},"False")," in the config node or in the call-site\nIn that case the Trainer object will receive an OmegaConf DictConfig for nested dataset and optimizer instead of the instantiated objects."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"optimizer = instantiate(cfg.trainer, _recursive_=False)\nprint(optimizer)\n")),(0,o.mdx)("p",null,"Output:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"Trainer(\n optimizer={\n '_target_': 'my_app.Optimizer', 'algo': 'SGD', 'lr': 0.01\n },\n dataset={\n '_target_': 'my_app.Dataset', 'name': 'Imagenet', 'path': '/datasets/imagenet'\n }\n)\n")),(0,o.mdx)("h3",{id:"parameter-conversion-strategies"},"Parameter conversion strategies"),(0,o.mdx)("p",null,"By default, the parameters passed to the target are either primitives (int,\nfloat, bool etc) or OmegaConf containers (",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig"),", ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig"),").\nOmegaConf containers have many advantages over primitive dicts and lists,\nincluding convenient attribute access for keys,\n",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html"},"duck-typing as instances of dataclasses or attrs classes"),", and\nsupport for ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#variable-interpolation"},"variable interpolation"),"\nand ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/custom_resolvers.html"},"custom resolvers"),".\nIf the callable targeted by ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate")," leverages OmegaConf's features, it\nwill make sense to pass ",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances directly to\nthat callable."),(0,o.mdx)("p",null,"That being said, in many cases it's desired to pass normal Python dicts and\nlists, rather than ",(0,o.mdx)("inlineCode",{parentName:"p"},"DictConfig")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances, as arguments to your\ncallable. You can change instantiate's argument conversion strategy using the\n",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," parameter. Supported values are:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"none"')," : Default behavior, Use OmegaConf containers"),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"partial"')," : Convert OmegaConf containers to dict and list, except\nStructured Configs, which remain as DictConfig instances."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"object"')," : Convert OmegaConf containers to dict and list, except Structured\nConfigs, which are converted to instances of the backing dataclass / attr\nclass using ",(0,o.mdx)("inlineCode",{parentName:"li"},"OmegaConf.to_object"),"."),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("inlineCode",{parentName:"li"},'"all"')," : Convert everything to primitive containers")),(0,o.mdx)("p",null,"The conversion strategy applies recursively to all subconfigs of the instantiation target.\nHere is an example demonstrating the various conversion strategies:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\nfrom omegaconf import DictConfig, OmegaConf\nfrom hydra.utils import instantiate\n\n@dataclass\nclass Foo:\n a: int = 123\n\nclass MyTarget:\n def __init__(self, foo, bar):\n self.foo = foo\n self.bar = bar\n\ncfg = OmegaConf.create(\n {\n "_target_": "__main__.MyTarget",\n "foo": Foo(),\n "bar": {"b": 456},\n }\n)\n\nobj_none = instantiate(cfg, _convert_="none")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_none.foo, DictConfig)\nassert isinstance(obj_none.bar, DictConfig)\n\nobj_partial = instantiate(cfg, _convert_="partial")\nassert isinstance(obj_partial, MyTarget)\nassert isinstance(obj_partial.foo, DictConfig)\nassert isinstance(obj_partial.bar, dict)\n\nobj_object = instantiate(cfg, _convert_="object")\nassert isinstance(obj_object, MyTarget)\nassert isinstance(obj_object.foo, Foo)\nassert isinstance(obj_object.bar, dict)\n\nobj_all = instantiate(cfg, _convert_="all")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_all.foo, dict)\nassert isinstance(obj_all.bar, dict)\n')),(0,o.mdx)("p",null,"Passing the ",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," keyword argument to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate")," has the same effect as defining\na ",(0,o.mdx)("inlineCode",{parentName:"p"},"_convert_")," attribute on your config object. Here is an example creating\ninstances of ",(0,o.mdx)("inlineCode",{parentName:"p"},"MyTarget")," that are equivalent to the above:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'cfg_none = OmegaConf.create({..., "_convert_": "none"})\nobj_none = instantiate(cfg_none)\n\ncfg_partial = OmegaConf.create({..., "_convert_": "partial"})\nobj_partial = instantiate(cfg_partial)\n\ncfg_object = OmegaConf.create({..., "_convert_": "object"})\nobj_object = instantiate(cfg_object)\n\ncfg_all = OmegaConf.create({..., "_convert_": "all"})\nobj_all = instantiate(cfg_all)\n')),(0,o.mdx)("h3",{id:"partial-instantiation"},"Partial Instantiation"),(0,o.mdx)("p",null,"Sometimes you may not set all parameters needed to instantiate an object from the configuration, in this case you can set\n",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_")," to be ",(0,o.mdx)("inlineCode",{parentName:"p"},"True")," to get a ",(0,o.mdx)("inlineCode",{parentName:"p"},"functools.partial")," wrapped object or method, then complete initializing the object in\nthe application code. Here is an example:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example classes"',title:'"Example','classes"':!0},'class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Optimizer(algo={self.algo},lr={self.lr})"\n\n\nclass Model:\n def __init__(self, optim_partial: Any, lr: float):\n super().__init__()\n self.optim = optim_partial(lr=lr)\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Model(Optimizer={self.optim},lr={self.lr})"\n')),(0,o.mdx)("div",{className:"row"},(0,o.mdx)("div",{className:"col col--5"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"model:\n _target_: my_app.Model\n optim_partial:\n _partial_: true\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n"))),(0,o.mdx)("div",{className:"col col--7"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},'model = instantiate(cfg.model)\nprint(model)\n# "Model(Optimizer=Optimizer(algo=SGD,lr=0.01),lr=0.01)\n')))),(0,o.mdx)("p",null,"If you are repeatedly instantiating the same config,\nusing ",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_=True")," may provide a significant speedup as compared with regular (non-partial) instantiation."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},"factory = instantiate(config, _partial_=True)\nobj = factory()\n")),(0,o.mdx)("p",null,"In the above example, repeatedly calling ",(0,o.mdx)("inlineCode",{parentName:"p"},"factory")," would be faster than repeatedly calling ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate(config)"),".\nA caveat of this approach is that the same keyword arguments would be re-used in each call to ",(0,o.mdx)("inlineCode",{parentName:"p"},"factory"),"."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'class Foo:\n ...\n\nclass Bar:\n def __init__(self, foo):\n self.foo = foo\n\nbar_conf = {\n "_target_": "__main__.Bar",\n "foo": {"_target_": "__main__.Foo"},\n}\n\nbar_factory = instantiate(bar_conf, _partial_=True)\nbar1 = bar_factory()\nbar2 = bar_factory()\n\nassert bar1 is not bar2\nassert bar1.foo is bar2.foo # the `Foo` instance is re-used here\n')),(0,o.mdx)("p",null,"This does not apply if ",(0,o.mdx)("inlineCode",{parentName:"p"},"_partial_=False"),",\nin which case a new ",(0,o.mdx)("inlineCode",{parentName:"p"},"Foo")," instance would be created with each call to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate"),"."),(0,o.mdx)("h3",{id:"instantiation-of-builtins"},"Instantiation of builtins"),(0,o.mdx)("p",null,"The value of ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_")," passed to ",(0,o.mdx)("inlineCode",{parentName:"p"},"instantiate"),' should be a "dotpath" pointing\nto some callable that can be looked up via a combination of ',(0,o.mdx)("inlineCode",{parentName:"p"},"import")," and ",(0,o.mdx)("inlineCode",{parentName:"p"},"getattr"),".\nIf you want to target one of Python's ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/functions.html"},"built-in functions")," (such as ",(0,o.mdx)("inlineCode",{parentName:"p"},"len")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"print")," or ",(0,o.mdx)("inlineCode",{parentName:"p"},"divmod"),"),\nyou will need to provide a dotpath looking up that function in Python's ",(0,o.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/builtins.html"},(0,o.mdx)("inlineCode",{parentName:"a"},"builtins"))," module."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import instantiate\n# instantiate({"_target_": "len"}, [1,2,3]) # this gives an InstantiationException\ninstantiate({"_target_": "builtins.len"}, [1,2,3]) # this works, returns the number 3\n')),(0,o.mdx)("h3",{id:"dotpath-lookup-machinery"},"Dotpath lookup machinery"),(0,o.mdx)("p",null,"Hydra looks up a given ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_")," by attempting to find a module that\ncorresponds to a prefix of the given dotpath and then looking for an object in\nthat module corresponding to the dotpath's tail. For example, to look up a ",(0,o.mdx)("inlineCode",{parentName:"p"},"_target_"),"\ngiven by the dotpath ",(0,o.mdx)("inlineCode",{parentName:"p"},'"my_module.my_nested_module.my_object"'),", hydra first locates\nthe module ",(0,o.mdx)("inlineCode",{parentName:"p"},"my_module.my_nested_module"),", then find ",(0,o.mdx)("inlineCode",{parentName:"p"},"my_object")," inside that nested module."),(0,o.mdx)("p",null,"Hydra exposes an API allowing direct use of this dotpath lookup machinery.\nThe following two functions, which can be imported from the ",(0,o.mdx)(u,{to:"hydra/utils.py",mdxType:"GithubLink"},"hydra.utils")," module,\naccept a string-typed dotpath as an argument and return the located class/callable/object:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python"},'def get_class(path: str) -> type:\n """\n Look up a class based on a dotpath.\n Fails if the path does not point to a class.\n\n >>> import my_module\n >>> from hydra.utils import get_class\n >>> assert get_class("my_module.MyClass") is my_module.MyClass\n """\n ...\n\ndef get_method(path: str) -> Callable[..., Any]:\n """\n Look up a callable based on a dotpath.\n Fails if the path does not point to a callable object.\n\n >>> import my_module\n >>> from hydra.utils import get_method\n >>> assert get_method("my_module.my_function") is my_module.my_function\n """\n ...\n\n# Alias for get_method\nget_static_method = get_method\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/03322abc.4a95b63c.js b/assets/js/03322abc.4a95b63c.js new file mode 100644 index 0000000000..1436978b2e --- /dev/null +++ b/assets/js/03322abc.4a95b63c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6790],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(i[t]=n[t]);return i}(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}var p=r.createContext({}),d=function(n){return function(e){var t=c(e.components);return r.createElement(n,o({},e,{components:t}))}},c=function(n){var e=r.useContext(p),t=e;return n&&(t="function"==typeof n?n(e):l(l({},e),n)),t},s=function(n){var e=c(n.components);return r.createElement(p.Provider,{value:e},n.children)},m={inlineCode:"code",wrapper:function(n){var e=n.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(n,e){var t=n.components,i=n.mdxType,o=n.originalType,a=n.parentName,p=u(n,["components","mdxType","originalType","parentName"]),d=c(t),s=i,g=d["".concat(a,".").concat(s)]||d[s]||m[s]||o;return t?r.createElement(g,l(l({ref:e},p),{},{components:t})):r.createElement(g,l({ref:e},p))}));function f(n,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof n||i){var o=t.length,a=new Array(o);a[0]=g;var l={};for(var u in e)hasOwnProperty.call(e,u)&&(l[u]=e[u]);l.originalType=n,l.mdxType="string"==typeof n?n:i,a[1]=l;for(var p=2;p=0||(i[t]=n[t]);return i}(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}var p=r.createContext({}),d=function(n){return function(e){var t=c(e.components);return r.createElement(n,o({},e,{components:t}))}},c=function(n){var e=r.useContext(p),t=e;return n&&(t="function"==typeof n?n(e):l(l({},e),n)),t},s=function(n){var e=c(n.components);return r.createElement(p.Provider,{value:e},n.children)},m={inlineCode:"code",wrapper:function(n){var e=n.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(n,e){var t=n.components,i=n.mdxType,o=n.originalType,a=n.parentName,p=u(n,["components","mdxType","originalType","parentName"]),d=c(t),s=i,g=d["".concat(a,".").concat(s)]||d[s]||m[s]||o;return t?r.createElement(g,l(l({ref:e},p),{},{components:t})):r.createElement(g,l({ref:e},p))}));function f(n,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof n||i){var o=t.length,a=new Array(o);a[0]=g;var l={};for(var u in e)hasOwnProperty.call(e,u)&&(l[u]=e[u]);l.originalType=n,l.mdxType="string"==typeof n?n:i,a[1]=l;for(var p=2;p=0||(i[t]=n[t]);return i}(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}var p=r.createContext({}),d=function(n){return function(e){var t=c(e.components);return r.createElement(n,o({},e,{components:t}))}},c=function(n){var e=r.useContext(p),t=e;return n&&(t="function"==typeof n?n(e):l(l({},e),n)),t},s=function(n){var e=c(n.components);return r.createElement(p.Provider,{value:e},n.children)},m={inlineCode:"code",wrapper:function(n){var e=n.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(n,e){var t=n.components,i=n.mdxType,o=n.originalType,a=n.parentName,p=u(n,["components","mdxType","originalType","parentName"]),d=c(t),s=i,g=d["".concat(a,".").concat(s)]||d[s]||m[s]||o;return t?r.createElement(g,l(l({ref:e},p),{},{components:t})):r.createElement(g,l({ref:e},p))}));function f(n,e){var t=arguments,i=e&&e.mdxType;if("string"==typeof n||i){var o=t.length,a=new Array(o);a[0]=g;var l={};for(var u in e)hasOwnProperty.call(e,u)&&(l[u]=e[u]);l.originalType=n,l.mdxType="string"==typeof n?n:i,a[1]=l;for(var p=2;p=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var d=a.createContext({}),m=function(e){return function(n){var t=p(n.components);return a.createElement(e,r({},n,{components:t}))}},p=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(d.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(t),c=i,f=m["".concat(o,".").concat(c)]||m[c]||u[c]||r;return t?a.createElement(f,s(s({ref:n},d),{},{components:t})):a.createElement(f,s({ref:n},d))}));function g(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var d=2;d Any:\n """\n :param config: An config object describing what to call and what params to use.\n In addition to the parameters, the config must contain:\n _target_ : target class or callable name (str)\n And may contain:\n _args_: List-like of positional arguments to pass to the target\n _recursive_: Construct nested objects as well (bool).\n True by default.\n may be overridden via a _recursive_ key in\n the kwargs\n _convert_: Conversion strategy\n none : Passed objects are DictConfig and ListConfig, default\n partial : Passed objects are converted to dict and list, with\n the exception of Structured Configs (and their fields).\n all : Passed objects are dicts, lists and primitives without\n a trace of OmegaConf containers\n :param args: Optional positional parameters pass-through\n :param kwargs: Optional named parameters to override\n parameters in the config object. Parameters not present\n in the config objects are being passed as is to the target.\n IMPORTANT: dataclasses instances in kwargs are interpreted as config\n and cannot be used as passthrough\n :return: if _target_ is a class name: the instantiated object\n if _target_ is a callable: the return value of the call\n """\n\n# Alias for instantiate\ncall = instantiate\n'))),(0,r.mdx)("br",null),(0,r.mdx)("p",null,"The config passed to these functions must have a key called ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_"),", with the value of a fully qualified class name, class method, static method or callable.\nFor convenience, ",(0,r.mdx)("inlineCode",{parentName:"p"},"None")," config results in a ",(0,r.mdx)("inlineCode",{parentName:"p"},"None")," object."),(0,r.mdx)("p",null,(0,r.mdx)("strong",{parentName:"p"},"Named arguments")," : Config fields (except reserved fields like ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_"),") are passed as named arguments to the target.\nNamed arguments in the config can be overridden by passing named argument with the same name in the ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,r.mdx)("p",null,(0,r.mdx)("strong",{parentName:"p"},"Positional arguments")," : The config may contain a ",(0,r.mdx)("inlineCode",{parentName:"p"},"_args_")," field representing positional arguments to pass to the target.\nThe positional arguments can be overridden together by passing positional arguments in the ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,r.mdx)("h3",{id:"simple-usage"},"Simple usage"),(0,r.mdx)("p",null,"Your application might have an Optimizer class:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example class"',title:'"Example','class"':!0},"class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n")),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--6"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n\n\n\n\n"))),(0,r.mdx)("div",{className:"col col--6"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},"opt = instantiate(cfg.optimizer)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.01)\n\n# override parameters on the call-site\nopt = instantiate(cfg.optimizer, lr=0.2)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.2)\n")))),(0,r.mdx)("h3",{id:"recursive-instantiation"},"Recursive instantiation"),(0,r.mdx)("p",null,"Let's add a Dataset and a Trainer class. The trainer holds a Dataset and an Optimizer instances."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Additional classes"',title:'"Additional','classes"':!0},"class Dataset:\n name: str\n path: str\n\n def __init__(self, name: str, path: str) -> None:\n self.name = name\n self.path = path\n\n\nclass Trainer:\n def __init__(self, optimizer: Optimizer, dataset: Dataset) -> None:\n self.optimizer = optimizer\n self.dataset = dataset\n")),(0,r.mdx)("p",null,"With the following config, you can instantiate the whole thing with a single call:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Example config"',title:'"Example','config"':!0},"trainer:\n _target_: my_app.Trainer\n optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n dataset:\n _target_: my_app.Dataset\n name: Imagenet\n path: /datasets/imagenet\n")),(0,r.mdx)("p",null,"Hydra will instantiate nested objects recursively by default."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"trainer = instantiate(cfg.trainer)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.01),\n# dataset=Dataset(name=Imagenet, path=/datasets/imagenet)\n# )\n")),(0,r.mdx)("p",null,"You can override parameters for nested objects:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'trainer = instantiate(\n cfg.trainer,\n optimizer={"lr": 0.3},\n dataset={"name": "cifar10", "path": "/datasets/cifar10"},\n)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.3),\n# dataset=Dataset(name=cifar10, path=/datasets/cifar10)\n# )\n')),(0,r.mdx)("p",null,"Similarly, positional arguments of nested objects can be overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'obj = instantiate(\n cfg.object,\n # pass 1 and 2 as positional arguments to the target object\n 1, 2, \n # pass 3 and 4 as positional arguments to a nested child object\n child={"_args_": [3, 4]},\n)\n')),(0,r.mdx)("h3",{id:"disable-recursive-instantiation"},"Disable recursive instantiation"),(0,r.mdx)("p",null,"You can disable recursive instantiation by setting ",(0,r.mdx)("inlineCode",{parentName:"p"},"_recursive_")," to ",(0,r.mdx)("inlineCode",{parentName:"p"},"False")," in the config node or in the call-site\nIn that case the Trainer object will receive an OmegaConf DictConfig for nested dataset and optimizer instead of the instantiated objects."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"optimizer = instantiate(cfg.trainer, _recursive_=False)\nprint(optimizer)\n")),(0,r.mdx)("p",null,"Output:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"Trainer(\n optimizer={\n '_target_': 'my_app.Optimizer', 'algo': 'SGD', 'lr': 0.01\n },\n dataset={\n '_target_': 'my_app.Dataset', 'name': 'Imagenet', 'path': '/datasets/imagenet'\n }\n)\n")),(0,r.mdx)("h2",{id:"parameter-conversion-strategies"},"Parameter conversion strategies"),(0,r.mdx)("p",null,"By default, the parameters passed to the target are either primitives (int,\nfloat, bool etc) or OmegaConf containers (",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig"),", ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig"),").\nOmegaConf containers have many advantages over primitive dicts and lists,\nincluding convenient attribute access for keys,\n",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html"},"duck-typing as instances of dataclasses or attrs classes"),", and\nsupport for ",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#variable-interpolation"},"variable interpolation"),"\nand ",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/custom_resolvers.html"},"custom resolvers"),".\nIf the callable targeted by ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate")," leverages OmegaConf's features, it\nwill make sense to pass ",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances directly to\nthat callable."),(0,r.mdx)("p",null,"That being said, in many cases it's desired to pass normal Python dicts and\nlists, rather than ",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances, as arguments to your\ncallable. You can change instantiate's argument conversion strategy using the\n",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," parameter. Supported values are:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"none"')," : Default behavior, Use OmegaConf containers"),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"partial"')," : Convert OmegaConf containers to dict and list, except Structured Configs."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"all"')," : Convert everything to primitive containers")),(0,r.mdx)("p",null,"The conversion strategy applies recursively to all subconfigs of the instantiation target.\nHere is an example demonstrating the various conversion strategies:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\nfrom omegaconf import DictConfig, OmegaConf\nfrom hydra.utils import instantiate\n\n@dataclass\nclass Foo:\n a: int = 123\n\nclass MyTarget:\n def __init__(self, foo, bar):\n self.foo = foo\n self.bar = bar\n\ncfg = OmegaConf.create(\n {\n "_target_": "__main__.MyTarget",\n "foo": Foo(),\n "bar": {"b": 456},\n }\n)\n\nobj_none = instantiate(cfg, _convert_="none")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_none.foo, DictConfig)\nassert isinstance(obj_none.bar, DictConfig)\n\nobj_partial = instantiate(cfg, _convert_="partial")\nassert isinstance(obj_partial, MyTarget)\nassert isinstance(obj_partial.foo, DictConfig)\nassert isinstance(obj_partial.bar, dict)\n\nobj_all = instantiate(cfg, _convert_="all")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_all.foo, dict)\nassert isinstance(obj_all.bar, dict)\n')),(0,r.mdx)("p",null,"Passing the ",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," keyword argument to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate")," has the same effect as defining\na ",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," attribute on your config object. Here is an example creating\ninstances of ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyTarget")," that are equivalent to the above:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'cfg_none = OmegaConf.create({..., "_convert_": "none"})\nobj_none = instantiate(cfg_none)\n\ncfg_partial = OmegaConf.create({..., "_convert_": "partial"})\nobj_partial = instantiate(cfg_partial)\n\ncfg_all = OmegaConf.create({..., "_convert_": "all"})\nobj_all = instantiate(cfg_all)\n')),(0,r.mdx)("h3",{id:"partial-instantiation-for-hydra-version--112"},"Partial Instantiation (for Hydra version >= 1.1.2)"),(0,r.mdx)("p",null,"Sometimes you may not set all parameters needed to instantiate an object from the configuration, in this case you can set\n",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_")," to be ",(0,r.mdx)("inlineCode",{parentName:"p"},"True")," to get a ",(0,r.mdx)("inlineCode",{parentName:"p"},"functools.partial")," wrapped object or method, then complete initializing the object in\nthe application code. Here is an example:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example classes"',title:'"Example','classes"':!0},'class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Optimizer(algo={self.algo},lr={self.lr})"\n\n\nclass Model:\n def __init__(self, optim_partial: Any, lr: float):\n super().__init__()\n self.optim = optim_partial(lr=lr)\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Model(Optimizer={self.optim},lr={self.lr})"\n')),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--5"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"model:\n _target_: my_app.Model\n optim_partial:\n _partial_: true\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n"))),(0,r.mdx)("div",{className:"col col--7"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},'model = instantiate(cfg.model)\nprint(model)\n# "Model(Optimizer=Optimizer(algo=SGD,lr=0.01),lr=0.01)\n')))),(0,r.mdx)("p",null,"If you are repeatedly instantiating the same config,\nusing ",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_=True")," may provide a significant speedup as compared with regular (non-partial) instantiation."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"factory = instantiate(config, _partial_=True)\nobj = factory()\n")),(0,r.mdx)("p",null,"In the above example, repeatedly calling ",(0,r.mdx)("inlineCode",{parentName:"p"},"factory")," would be faster than repeatedly calling ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate(config)"),".\nA caveat of this approach is that the same keyword arguments would be re-used in each call to ",(0,r.mdx)("inlineCode",{parentName:"p"},"factory"),"."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'class Foo:\n ...\n\nclass Bar:\n def __init__(self, foo):\n self.foo = foo\n\nbar_conf = {\n "_target_": "__main__.Bar",\n "foo": {"_target_": "__main__.Foo"},\n}\n\nbar_factory = instantiate(bar_conf, _partial_=True)\nbar1 = bar_factory()\nbar2 = bar_factory()\n\nassert bar1 is not bar2\nassert bar1.foo is bar2.foo # the `Foo` instance is re-used here\n')),(0,r.mdx)("p",null,"This does not apply if ",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_=False"),",\nin which case a new ",(0,r.mdx)("inlineCode",{parentName:"p"},"Foo")," instance would be created with each call to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate"),"."),(0,r.mdx)("h3",{id:"instantiation-of-builtins"},"Instantiation of builtins"),(0,r.mdx)("p",null,"The value of ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_")," passed to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate"),' should be a "dotpath" pointing\nto some callable that can be looked up via a combination of ',(0,r.mdx)("inlineCode",{parentName:"p"},"import")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"getattr"),".\nIf you want to target one of Python's ",(0,r.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/functions.html"},"built-in functions")," (such as ",(0,r.mdx)("inlineCode",{parentName:"p"},"len")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"print")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"divmod"),"),\nyou will need to provide a dotpath looking up that function in Python's ",(0,r.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/builtins.html"},(0,r.mdx)("inlineCode",{parentName:"a"},"builtins"))," module."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import instantiate\n# instantiate({"_target_": "len"}, [1,2,3]) # this gives an InstantiationException\ninstantiate({"_target_": "builtins.len"}, [1,2,3]) # this works, returns the number 3\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/05d1ea85.cef66cab.js b/assets/js/05d1ea85.cef66cab.js deleted file mode 100644 index 50b5f3a6b4..0000000000 --- a/assets/js/05d1ea85.cef66cab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[491],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return d},MDXProvider:function(){return c},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return m}});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var d=a.createContext({}),m=function(e){return function(n){var t=p(n.components);return a.createElement(e,r({},n,{components:t}))}},p=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(d.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(t),c=i,f=m["".concat(o,".").concat(c)]||m[c]||u[c]||r;return t?a.createElement(f,s(s({ref:n},d),{},{components:t})):a.createElement(f,s({ref:n},d))}));function g(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var d=2;d Any:\n """\n :param config: An config object describing what to call and what params to use.\n In addition to the parameters, the config must contain:\n _target_ : target class or callable name (str)\n And may contain:\n _args_: List-like of positional arguments to pass to the target\n _recursive_: Construct nested objects as well (bool).\n True by default.\n may be overridden via a _recursive_ key in\n the kwargs\n _convert_: Conversion strategy\n none : Passed objects are DictConfig and ListConfig, default\n partial : Passed objects are converted to dict and list, with\n the exception of Structured Configs (and their fields).\n all : Passed objects are dicts, lists and primitives without\n a trace of OmegaConf containers\n :param args: Optional positional parameters pass-through\n :param kwargs: Optional named parameters to override\n parameters in the config object. Parameters not present\n in the config objects are being passed as is to the target.\n IMPORTANT: dataclasses instances in kwargs are interpreted as config\n and cannot be used as passthrough\n :return: if _target_ is a class name: the instantiated object\n if _target_ is a callable: the return value of the call\n """\n\n# Alias for instantiate\ncall = instantiate\n'))),(0,r.mdx)("br",null),(0,r.mdx)("p",null,"The config passed to these functions must have a key called ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_"),", with the value of a fully qualified class name, class method, static method or callable.\nFor convenience, ",(0,r.mdx)("inlineCode",{parentName:"p"},"None")," config results in a ",(0,r.mdx)("inlineCode",{parentName:"p"},"None")," object."),(0,r.mdx)("p",null,(0,r.mdx)("strong",{parentName:"p"},"Named arguments")," : Config fields (except reserved fields like ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_"),") are passed as named arguments to the target.\nNamed arguments in the config can be overridden by passing named argument with the same name in the ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,r.mdx)("p",null,(0,r.mdx)("strong",{parentName:"p"},"Positional arguments")," : The config may contain a ",(0,r.mdx)("inlineCode",{parentName:"p"},"_args_")," field representing positional arguments to pass to the target.\nThe positional arguments can be overridden together by passing positional arguments in the ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate()")," call-site."),(0,r.mdx)("h3",{id:"simple-usage"},"Simple usage"),(0,r.mdx)("p",null,"Your application might have an Optimizer class:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example class"',title:'"Example','class"':!0},"class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n")),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--6"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n\n\n\n\n"))),(0,r.mdx)("div",{className:"col col--6"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},"opt = instantiate(cfg.optimizer)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.01)\n\n# override parameters on the call-site\nopt = instantiate(cfg.optimizer, lr=0.2)\nprint(opt)\n# Optimizer(algo=SGD,lr=0.2)\n")))),(0,r.mdx)("h3",{id:"recursive-instantiation"},"Recursive instantiation"),(0,r.mdx)("p",null,"Let's add a Dataset and a Trainer class. The trainer holds a Dataset and an Optimizer instances."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Additional classes"',title:'"Additional','classes"':!0},"class Dataset:\n name: str\n path: str\n\n def __init__(self, name: str, path: str) -> None:\n self.name = name\n self.path = path\n\n\nclass Trainer:\n def __init__(self, optimizer: Optimizer, dataset: Dataset) -> None:\n self.optimizer = optimizer\n self.dataset = dataset\n")),(0,r.mdx)("p",null,"With the following config, you can instantiate the whole thing with a single call:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Example config"',title:'"Example','config"':!0},"trainer:\n _target_: my_app.Trainer\n optimizer:\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n dataset:\n _target_: my_app.Dataset\n name: Imagenet\n path: /datasets/imagenet\n")),(0,r.mdx)("p",null,"Hydra will instantiate nested objects recursively by default."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"trainer = instantiate(cfg.trainer)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.01),\n# dataset=Dataset(name=Imagenet, path=/datasets/imagenet)\n# )\n")),(0,r.mdx)("p",null,"You can override parameters for nested objects:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'trainer = instantiate(\n cfg.trainer,\n optimizer={"lr": 0.3},\n dataset={"name": "cifar10", "path": "/datasets/cifar10"},\n)\nprint(trainer)\n# Trainer(\n# optimizer=Optimizer(algo=SGD,lr=0.3),\n# dataset=Dataset(name=cifar10, path=/datasets/cifar10)\n# )\n')),(0,r.mdx)("p",null,"Similarly, positional arguments of nested objects can be overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'obj = instantiate(\n cfg.object,\n # pass 1 and 2 as positional arguments to the target object\n 1, 2, \n # pass 3 and 4 as positional arguments to a nested child object\n child={"_args_": [3, 4]},\n)\n')),(0,r.mdx)("h3",{id:"disable-recursive-instantiation"},"Disable recursive instantiation"),(0,r.mdx)("p",null,"You can disable recursive instantiation by setting ",(0,r.mdx)("inlineCode",{parentName:"p"},"_recursive_")," to ",(0,r.mdx)("inlineCode",{parentName:"p"},"False")," in the config node or in the call-site\nIn that case the Trainer object will receive an OmegaConf DictConfig for nested dataset and optimizer instead of the instantiated objects."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"optimizer = instantiate(cfg.trainer, _recursive_=False)\nprint(optimizer)\n")),(0,r.mdx)("p",null,"Output:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"Trainer(\n optimizer={\n '_target_': 'my_app.Optimizer', 'algo': 'SGD', 'lr': 0.01\n },\n dataset={\n '_target_': 'my_app.Dataset', 'name': 'Imagenet', 'path': '/datasets/imagenet'\n }\n)\n")),(0,r.mdx)("h2",{id:"parameter-conversion-strategies"},"Parameter conversion strategies"),(0,r.mdx)("p",null,"By default, the parameters passed to the target are either primitives (int,\nfloat, bool etc) or OmegaConf containers (",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig"),", ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig"),").\nOmegaConf containers have many advantages over primitive dicts and lists,\nincluding convenient attribute access for keys,\n",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html"},"duck-typing as instances of dataclasses or attrs classes"),", and\nsupport for ",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#variable-interpolation"},"variable interpolation"),"\nand ",(0,r.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/custom_resolvers.html"},"custom resolvers"),".\nIf the callable targeted by ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate")," leverages OmegaConf's features, it\nwill make sense to pass ",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances directly to\nthat callable."),(0,r.mdx)("p",null,"That being said, in many cases it's desired to pass normal Python dicts and\nlists, rather than ",(0,r.mdx)("inlineCode",{parentName:"p"},"DictConfig")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"ListConfig")," instances, as arguments to your\ncallable. You can change instantiate's argument conversion strategy using the\n",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," parameter. Supported values are:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"none"')," : Default behavior, Use OmegaConf containers"),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"partial"')," : Convert OmegaConf containers to dict and list, except Structured Configs."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},'"all"')," : Convert everything to primitive containers")),(0,r.mdx)("p",null,"The conversion strategy applies recursively to all subconfigs of the instantiation target.\nHere is an example demonstrating the various conversion strategies:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\nfrom omegaconf import DictConfig, OmegaConf\nfrom hydra.utils import instantiate\n\n@dataclass\nclass Foo:\n a: int = 123\n\nclass MyTarget:\n def __init__(self, foo, bar):\n self.foo = foo\n self.bar = bar\n\ncfg = OmegaConf.create(\n {\n "_target_": "__main__.MyTarget",\n "foo": Foo(),\n "bar": {"b": 456},\n }\n)\n\nobj_none = instantiate(cfg, _convert_="none")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_none.foo, DictConfig)\nassert isinstance(obj_none.bar, DictConfig)\n\nobj_partial = instantiate(cfg, _convert_="partial")\nassert isinstance(obj_partial, MyTarget)\nassert isinstance(obj_partial.foo, DictConfig)\nassert isinstance(obj_partial.bar, dict)\n\nobj_all = instantiate(cfg, _convert_="all")\nassert isinstance(obj_none, MyTarget)\nassert isinstance(obj_all.foo, dict)\nassert isinstance(obj_all.bar, dict)\n')),(0,r.mdx)("p",null,"Passing the ",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," keyword argument to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate")," has the same effect as defining\na ",(0,r.mdx)("inlineCode",{parentName:"p"},"_convert_")," attribute on your config object. Here is an example creating\ninstances of ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyTarget")," that are equivalent to the above:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'cfg_none = OmegaConf.create({..., "_convert_": "none"})\nobj_none = instantiate(cfg_none)\n\ncfg_partial = OmegaConf.create({..., "_convert_": "partial"})\nobj_partial = instantiate(cfg_partial)\n\ncfg_all = OmegaConf.create({..., "_convert_": "all"})\nobj_all = instantiate(cfg_all)\n')),(0,r.mdx)("h3",{id:"partial-instantiation-for-hydra-version--112"},"Partial Instantiation (for Hydra version >= 1.1.2)"),(0,r.mdx)("p",null,"Sometimes you may not set all parameters needed to instantiate an object from the configuration, in this case you can set\n",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_")," to be ",(0,r.mdx)("inlineCode",{parentName:"p"},"True")," to get a ",(0,r.mdx)("inlineCode",{parentName:"p"},"functools.partial")," wrapped object or method, then complete initializing the object in\nthe application code. Here is an example:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example classes"',title:'"Example','classes"':!0},'class Optimizer:\n algo: str\n lr: float\n\n def __init__(self, algo: str, lr: float) -> None:\n self.algo = algo\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Optimizer(algo={self.algo},lr={self.lr})"\n\n\nclass Model:\n def __init__(self, optim_partial: Any, lr: float):\n super().__init__()\n self.optim = optim_partial(lr=lr)\n self.lr = lr\n\n def __repr__(self) -> str:\n return f"Model(Optimizer={self.optim},lr={self.lr})"\n')),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--5"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Config"',title:'"Config"'},"model:\n _target_: my_app.Model\n optim_partial:\n _partial_: true\n _target_: my_app.Optimizer\n algo: SGD\n lr: 0.01\n"))),(0,r.mdx)("div",{className:"col col--7"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Instantiation"',title:'"Instantiation"'},'model = instantiate(cfg.model)\nprint(model)\n# "Model(Optimizer=Optimizer(algo=SGD,lr=0.01),lr=0.01)\n')))),(0,r.mdx)("p",null,"If you are repeatedly instantiating the same config,\nusing ",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_=True")," may provide a significant speedup as compared with regular (non-partial) instantiation."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},"factory = instantiate(config, _partial_=True)\nobj = factory()\n")),(0,r.mdx)("p",null,"In the above example, repeatedly calling ",(0,r.mdx)("inlineCode",{parentName:"p"},"factory")," would be faster than repeatedly calling ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate(config)"),".\nA caveat of this approach is that the same keyword arguments would be re-used in each call to ",(0,r.mdx)("inlineCode",{parentName:"p"},"factory"),"."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'class Foo:\n ...\n\nclass Bar:\n def __init__(self, foo):\n self.foo = foo\n\nbar_conf = {\n "_target_": "__main__.Bar",\n "foo": {"_target_": "__main__.Foo"},\n}\n\nbar_factory = instantiate(bar_conf, _partial_=True)\nbar1 = bar_factory()\nbar2 = bar_factory()\n\nassert bar1 is not bar2\nassert bar1.foo is bar2.foo # the `Foo` instance is re-used here\n')),(0,r.mdx)("p",null,"This does not apply if ",(0,r.mdx)("inlineCode",{parentName:"p"},"_partial_=False"),",\nin which case a new ",(0,r.mdx)("inlineCode",{parentName:"p"},"Foo")," instance would be created with each call to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate"),"."),(0,r.mdx)("h3",{id:"instantiation-of-builtins"},"Instantiation of builtins"),(0,r.mdx)("p",null,"The value of ",(0,r.mdx)("inlineCode",{parentName:"p"},"_target_")," passed to ",(0,r.mdx)("inlineCode",{parentName:"p"},"instantiate"),' should be a "dotpath" pointing\nto some callable that can be looked up via a combination of ',(0,r.mdx)("inlineCode",{parentName:"p"},"import")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"getattr"),".\nIf you want to target one of Python's ",(0,r.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/functions.html"},"built-in functions")," (such as ",(0,r.mdx)("inlineCode",{parentName:"p"},"len")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"print")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"divmod"),"),\nyou will need to provide a dotpath looking up that function in Python's ",(0,r.mdx)("a",{parentName:"p",href:"https://docs.python.org/3/library/builtins.html"},(0,r.mdx)("inlineCode",{parentName:"a"},"builtins"))," module."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import instantiate\n# instantiate({"_target_": "len"}, [1,2,3]) # this gives an InstantiationException\ninstantiate({"_target_": "builtins.len"}, [1,2,3]) # this works, returns the number 3\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/06056e6c.ee9716ff.js b/assets/js/06056e6c.28d8fa0e.js similarity index 59% rename from assets/js/06056e6c.ee9716ff.js rename to assets/js/06056e6c.28d8fa0e.js index 589261d901..c7b01cec62 100644 --- a/assets/js/06056e6c.ee9716ff.js +++ b/assets/js/06056e6c.28d8fa0e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5282],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return d},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){return function(t){var n=p(t.components);return r.createElement(e,i({},t,{components:n}))}},p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=p(n),d=o,m=s["".concat(a,".").concat(d)]||s[d]||f[d]||i;return n?r.createElement(m,c(c({ref:t},l),{},{components:n})):r.createElement(m,c({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){return function(t){var n=p(t.components);return r.createElement(e,a({},t,{components:n}))}},p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=p(n),d=o,m=s["".concat(i,".").concat(d)]||s[d]||f[d]||a;return n?r.createElement(m,c(c({ref:t},l),{},{components:n})):r.createElement(m,c({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=u(t.components);return r.createElement(e,i({},t,{components:n}))}},u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=u(n),d=o,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||i;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."),(0,i.mdx)("p",null,"Because the fish shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."),(0,i.mdx)("h4",{id:"zsh-instructions"},"Zsh instructions"),(0,i.mdx)("p",null,"Zsh is compatible with the existing Bash shell completion by appending"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"autoload -Uz bashcompinit && bashcompinit\n")),(0,i.mdx)("p",null,"to the ",(0,i.mdx)("inlineCode",{parentName:"p"},".zshrc")," file after ",(0,i.mdx)("inlineCode",{parentName:"p"},"compinit"),", restarting the shell and then using the commands provided for Bash."),(0,i.mdx)("p",null,"Because the zsh shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1269],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=u(t.components);return r.createElement(e,i({},t,{components:n}))}},u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=u(n),d=o,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||i;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."),(0,i.mdx)("p",null,"Because the fish shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."),(0,i.mdx)("h4",{id:"zsh-instructions"},"Zsh instructions"),(0,i.mdx)("p",null,"Zsh is compatible with the existing Bash shell completion by appending"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"autoload -Uz bashcompinit && bashcompinit\n")),(0,i.mdx)("p",null,"to the ",(0,i.mdx)("inlineCode",{parentName:"p"},".zshrc")," file after ",(0,i.mdx)("inlineCode",{parentName:"p"},"compinit"),", restarting the shell and then using the commands provided for Bash."),(0,i.mdx)("p",null,"Because the zsh shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/06963ee3.623e8789.js b/assets/js/06963ee3.623e8789.js deleted file mode 100644 index 38da41e407..0000000000 --- a/assets/js/06963ee3.623e8789.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4082],{3905:function(e,r,n){n.r(r),n.d(r,{MDXContext:function(){return l},MDXProvider:function(){return m},mdx:function(){return v},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(){return o=Object.assign||function(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){return function(r){var n=u(r.components);return t.createElement(e,o({},r,{components:n}))}},u=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},m=function(e){var r=u(e.components);return t.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},g=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),p=u(n),m=a,g=p["".concat(i,".").concat(m)]||p[m]||c[m]||o;return n?t.createElement(g,s(s({ref:r},l),{},{components:n})):t.createElement(g,s({ref:r},l))}));function v(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=g;var s={};for(var d in r)hasOwnProperty.call(r,d)&&(s[d]=r[d]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){return function(r){var n=u(r.components);return t.createElement(e,o({},r,{components:n}))}},u=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},m=function(e){var r=u(e.components);return t.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},g=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),p=u(n),m=a,g=p["".concat(i,".").concat(m)]||p[m]||c[m]||o;return n?t.createElement(g,s(s({ref:r},l),{},{components:n})):t.createElement(g,s({ref:r},l))}));function v(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=g;var s={};for(var d in r)hasOwnProperty.call(r,d)&&(s[d]=r[d]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=r,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||l;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--info defaults")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--cfg job")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,l.mdx)("h2",{id:"related-topics"},"Related topics"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/advanced/overriding_packages"},"Packages")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/07586c7f.389ee1bb.js b/assets/js/07586c7f.389ee1bb.js new file mode 100644 index 0000000000..2072b81a57 --- /dev/null +++ b/assets/js/07586c7f.389ee1bb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2469],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return c},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=r,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||l;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--info defaults")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--cfg job")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,l.mdx)("h2",{id:"related-topics"},"Related topics"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/advanced/overriding_packages"},"Packages")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a4b398d.8302eaed.js b/assets/js/0a4b398d.8302eaed.js new file mode 100644 index 0000000000..17488b6ab3 --- /dev/null +++ b/assets/js/0a4b398d.8302eaed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7086],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return s}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var m=r.createContext({}),s=function(e){return function(n){var t=c(n.components);return r.createElement(e,i({},n,{components:t}))}},c=function(e){var n=r.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(m.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),s=c(t),u=a,f=s["".concat(o,".").concat(u)]||s[u]||d[u]||i;return t?r.createElement(f,l(l({ref:n},m),{},{components:t})):r.createElement(f,l({ref:n},m))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m None:\n log.info(f"output_dir={HydraConfig.get().runtime.output_dir}")\n log.info(f"cfg.foo={cfg.foo}")\n')),(0,i.mdx)("p",null,"Run the example app:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py\n[2022-03-16 14:51:30,905][hydra.experimental.pickle_job_info_callback][INFO] - Saving job configs in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/config.pickle\n[2022-03-16 14:51:30,906][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:51:30,906][__main__][INFO] - cfg.foo=bar\n[2022-03-16 14:51:30,906][hydra.experimental.pickle_job_info_callback][INFO] - Saving job_return in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/job_return.pickle\n")),(0,i.mdx)("p",null,"The Callback saves ",(0,i.mdx)("inlineCode",{parentName:"p"},"config.pickle")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," sub dir, this is what we will use for rerun."),(0,i.mdx)("p",null,"Now rerun the app"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ OUTPUT_DIR=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/\n$ python my_app.py --experimental-rerun $OUTPUT_DIR/config.pickle\n/Users/jieru/workspace/hydra/hydra/main.py:23: UserWarning: Experimental rerun CLI option.\n warnings.warn(msg, UserWarning)\n[2022-03-16 14:59:21,666][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:59:21,666][__main__][INFO] - cfg.foo=bar\n")),(0,i.mdx)("p",null,"You will notice ",(0,i.mdx)("inlineCode",{parentName:"p"},"my_app.log")," is updated with the logging from the second run, but Callbacks are not called this time. Read on to learn more."),(0,i.mdx)("h3",{id:"important-notes"},"Important Notes"),(0,i.mdx)("p",null,"This is an experimental feature. Please reach out if you have any question. "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Only single run is supported."),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"--experimental-rerun")," cannot be used with other command-line options or overrides. They will simply be ignored."),(0,i.mdx)("li",{parentName:"ul"},"Rerun passes in a cfg_passthrough directly to your application, this means except for logging, no other ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main"),"\nfunctions are called (such as change working dir, or calling callbacks.) "),(0,i.mdx)("li",{parentName:"ul"},"The configs are preserved and reconstructed to the best efforts. Meaning we can only guarantee that the ",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg")," object\nitself passed in by ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main")," stays the same across runs. However, configs are resolved lazily. Meaning we cannot\nguarantee your application will behave the same if your application resolves configs during run time. In the following example,\n",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg.time_now")," will resolve to different value every run.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--5"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"time_now: ${now:%H-%M-%S}\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--7"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example function"',title:'"Example','function"':!0},'@hydra.main(version_base=None, config_path=".", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n val = cfg.time_now\n # the rest of the application\n')))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a7b70ce.ae5b7173.js b/assets/js/0a7b70ce.6fee88ee.js similarity index 61% rename from assets/js/0a7b70ce.ae5b7173.js rename to assets/js/0a7b70ce.6fee88ee.js index eab5e4b44b..411c89ec4d 100644 --- a/assets/js/0a7b70ce.ae5b7173.js +++ b/assets/js/0a7b70ce.6fee88ee.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7039],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){return function(t){var n=u(t.components);return i.createElement(e,o({},t,{components:n}))}},u=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return i.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},f=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=u(n),d=r,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||o;return n?i.createElement(f,c(c({ref:t},l),{},{components:n})):i.createElement(f,c({ref:t},l))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,a[1]=c;for(var l=2;l None:\n with initialize(version_base=None, config_path="../hydra_app/conf"):\n # config is relative to a module\n cfg = compose(config_name="config", overrides=["app.user=test_user"])\n assert cfg == {\n "app": {"user": "test_user", "num1": 10, "num2": 20},\n "db": {"host": "localhost", "port": 3306},\n }\n')),(0,o.mdx)("p",null,"For an idea about how to modify Hydra's search path when using ",(0,o.mdx)("inlineCode",{parentName:"p"},"compose")," in\nunit tests, see the page on\n",(0,o.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/search_path#overriding-hydrasearchpath-config"},"overriding the ",(0,o.mdx)("inlineCode",{parentName:"a"},"hydra.searchpath")," config"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7039],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){return function(t){var n=u(t.components);return i.createElement(e,o({},t,{components:n}))}},u=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return i.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},f=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=u(n),d=r,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||o;return n?i.createElement(f,c(c({ref:t},l),{},{components:n})):i.createElement(f,c({ref:t},l))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,a[1]=c;for(var l=2;l None:\n with initialize(version_base=None, config_path="../hydra_app/conf"):\n # config is relative to a module\n cfg = compose(config_name="config", overrides=["app.user=test_user"])\n assert cfg == {\n "app": {"user": "test_user", "num1": 10, "num2": 20},\n "db": {"host": "localhost", "port": 3306},\n }\n')),(0,o.mdx)("p",null,"For an idea about how to modify Hydra's search path when using ",(0,o.mdx)("inlineCode",{parentName:"p"},"compose")," in\nunit tests, see the page on\n",(0,o.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/search_path#overriding-hydrasearchpath-config"},"overriding the ",(0,o.mdx)("inlineCode",{parentName:"a"},"hydra.searchpath")," config"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0aa416e4.66f88d38.js b/assets/js/0aa416e4.66f88d38.js new file mode 100644 index 0000000000..7d433630cb --- /dev/null +++ b/assets/js/0aa416e4.66f88d38.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[440],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return p},MDXProvider:function(){return d},mdx:function(){return x},useMDXComponents:function(){return c},withMDXComponents:function(){return s}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),s=function(e){return function(n){var t=c(n.components);return r.createElement(e,i({},n,{components:t}))}},c=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=c(e.components);return r.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},g=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=m(e,["components","mdxType","originalType","parentName"]),s=c(t),d=a,g=s["".concat(l,".").concat(d)]||s[d]||u[d]||i;return t?r.createElement(g,o(o({ref:n},p),{},{components:t})):r.createElement(g,o({ref:n},p))}));function x(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=g;var o={};for(var m in n)hasOwnProperty.call(n,m)&&(o[m]=n[m]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.3/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.2.0.dev1\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n upscaling_speed: 1.0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n available_node_types:\n ray.head.default:\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n ray.worker.default:\n min_workers: 0\n max_workers: 2\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n InstanceMarketOptions:\n MarketType: spot\n head_node_type: ray.head.default\n file_mounts: {}\n initialization_commands: []\n cluster_synced_files: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0b3cc50a.f925b508.js b/assets/js/0b3cc50a.f925b508.js deleted file mode 100644 index 5cfe2ec416..0000000000 --- a/assets/js/0b3cc50a.f925b508.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8436],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=a(67294);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.3/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.2.0.dev1\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n upscaling_speed: 1.0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n available_node_types:\n ray.head.default:\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n ray.worker.default:\n min_workers: 0\n max_workers: 2\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n InstanceMarketOptions:\n MarketType: spot\n head_node_type: ray.head.default\n file_mounts: {}\n initialization_commands: []\n cluster_synced_files: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0e384e19.531edde4.js b/assets/js/0e384e19.531edde4.js deleted file mode 100644 index 47042f53f4..0000000000 --- a/assets/js/0e384e19.531edde4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9671],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return h},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(n),u=r,f=s["".concat(l,".").concat(u)]||s[u]||c[u]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var m in t)hasOwnProperty.call(t,m)&&(i[m]=t[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 conf\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 db\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 mysql.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 postgresql.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 __init__.py\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new config:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - db: mysql\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configurations easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/tutorials/basic/your_first_app/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0e384e19.de3b1a0e.js b/assets/js/0e384e19.de3b1a0e.js new file mode 100644 index 0000000000..7dff0c5efd --- /dev/null +++ b/assets/js/0e384e19.de3b1a0e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9671],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return h},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(n),u=r,f=s["".concat(l,".").concat(u)]||s[u]||c[u]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var m in t)hasOwnProperty.call(t,m)&&(i[m]=t[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 conf\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 db\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 mysql.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 postgresql.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 __init__.py\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new config:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - db: mysql\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configurations easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/tutorials/basic/your_first_app/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0e5950c6.8252b995.js b/assets/js/0e5950c6.392685fb.js similarity index 66% rename from assets/js/0e5950c6.8252b995.js rename to assets/js/0e5950c6.392685fb.js index dd62ebbb73..ceaf27e441 100644 --- a/assets/js/0e5950c6.8252b995.js +++ b/assets/js/0e5950c6.392685fb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2735],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return s},MDXProvider:function(){return l},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=p(t),l=o,h=u["".concat(a,".").concat(l)]||u[l]||f[l]||i;return t?n.createElement(h,c(c({ref:r},s),{},{components:t})):n.createElement(h,c({ref:r},s))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=h;var c={};for(var d in r)hasOwnProperty.call(r,d)&&(c[d]=r[d]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= "1.2" (or None),\nor otherwise will use the old behavior and default to ',(0,i.mdx)("inlineCode",{parentName:"p"},"True"),", with a warning being issued if ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," is not set."),(0,i.mdx)("p",null,"If you want to keep the old Hydra behavior, please set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," explicitly for your application."),(0,i.mdx)("p",null,"For more information about ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir"),",\nsee ",(0,i.mdx)("a",{parentName:"p",href:"/docs/tutorials/basic/running_your_app/working_directory#disable-changing-current-working-dir-to-jobs-output-dir"},"Output/Working directory"),"\nand ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/job#hydrajobchdir"},"Job Configuration - hydra.job.chdir"),"."))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2735],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return s},MDXProvider:function(){return l},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=p(t),l=o,h=u["".concat(a,".").concat(l)]||u[l]||f[l]||i;return t?n.createElement(h,c(c({ref:r},s),{},{components:t})):n.createElement(h,c({ref:r},s))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=h;var c={};for(var d in r)hasOwnProperty.call(r,d)&&(c[d]=r[d]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= "1.2" (or None),\nor otherwise will use the old behavior and default to ',(0,i.mdx)("inlineCode",{parentName:"p"},"True"),", with a warning being issued if ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," is not set."),(0,i.mdx)("p",null,"If you want to keep the old Hydra behavior, please set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," explicitly for your application."),(0,i.mdx)("p",null,"For more information about ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir"),",\nsee ",(0,i.mdx)("a",{parentName:"p",href:"/docs/tutorials/basic/running_your_app/working_directory#disable-changing-current-working-dir-to-jobs-output-dir"},"Output/Working directory"),"\nand ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/job#hydrajobchdir"},"Job Configuration - hydra.job.chdir"),"."))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0e71d84b.9a2cc699.js b/assets/js/0e71d84b.02f2bd4f.js similarity index 72% rename from assets/js/0e71d84b.9a2cc699.js rename to assets/js/0e71d84b.02f2bd4f.js index e3fcb7789a..78f04323ea 100644 --- a/assets/js/0e71d84b.9a2cc699.js +++ b/assets/js/0e71d84b.02f2bd4f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6141],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return u},MDXProvider:function(){return m},mdx:function(){return b},useMDXComponents:function(){return s},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),p=function(e){return function(t){var n=s(t.components);return r.createElement(e,i({},t,{components:n}))}},s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},m=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(n),m=o,f=p["".concat(a,".").concat(m)]||p[m]||d[m]||i;return n?r.createElement(f,c(c({ref:t},u),{},{components:n})):r.createElement(f,c({ref:t},u))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var u=2;u=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),p=function(e){return function(t){var n=s(t.components);return r.createElement(e,i({},t,{components:n}))}},s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},m=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(n),m=o,f=p["".concat(a,".").concat(m)]||p[m]||d[m]||i;return n?r.createElement(f,c(c({ref:t},u),{},{components:n})):r.createElement(f,c({ref:t},u))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var u=2;u=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),d=function(e){return function(t){var n=u(t.components);return r.createElement(e,o({},t,{components:n}))}},u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(n),p=a,f=d["".concat(i,".").concat(p)]||d[p]||m[p]||o;return n?r.createElement(f,c(c({ref:t},l),{},{components:n})):r.createElement(f,c({ref:t},l))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),d=function(e){return function(t){var n=u(t.components);return r.createElement(e,o({},t,{components:n}))}},u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(n),p=a,g=d["".concat(i,".").concat(p)]||d[p]||m[p]||o;return n?r.createElement(g,c(c({ref:t},l),{},{components:n})):r.createElement(g,c({ref:t},l))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=g;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=a.createContext({}),c=function(e){return function(n){var t=m(n.components);return a.createElement(e,o({},n,{components:t}))}},m=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=m(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),c=m(t),p=i,f=c["".concat(r,".").concat(p)]||c[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},s),{},{components:t})):a.createElement(f,l({ref:n},s))}));function g(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){return function(t){var n=m(t.components);return a.createElement(e,o({},t,{components:n}))}},m=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=m(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),c=m(n),p=i,f=c["".concat(r,".").concat(p)]||c[p]||u[p]||o;return n?a.createElement(f,l(l({ref:t},s),{},{components:n})):a.createElement(f,l({ref:t},s))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=f;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=a.createContext({}),c=function(e){return function(n){var t=m(n.components);return a.createElement(e,o({},n,{components:t}))}},m=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=m(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),c=m(t),p=i,f=c["".concat(r,".").concat(p)]||c[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},s),{},{components:t})):a.createElement(f,l({ref:n},s))}));function g(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),f=function(e){return function(n){var t=d(n.components);return r.createElement(e,a({},n,{components:t}))}},d=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(c.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),f=d(t),u=o,m=f["".concat(s,".").concat(u)]||f[u]||p[u]||a;return t?r.createElement(m,i(i({ref:n},c),{},{components:t})):r.createElement(m,i({ref:n},c))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c None:\n self.host = host\n self.user = user\n self.password = password\n\n def connect(self) -> None:\n print(f"MySQL connecting to {self.host}")\n\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, host: str, user: str, password: str, database: str) -> None:\n self.host = host\n self.user = user\n self.password = password\n self.database = database\n\n def connect(self) -> None:\n print(f"PostgreSQL connecting to {self.host}")\n')),(0,a.mdx)("p",null,"To support this, we can have a parallel config structure:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text"},"conf/\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 db\n \u251c\u2500\u2500 mysql.yaml\n \u2514\u2500\u2500 postgresql.yaml\n")),(0,a.mdx)("p",null,"Config files:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"_target_: my_app.MySQLConnection\nhost: localhost\nuser: root\npassword: 1234\n\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/postgresql.yaml"',title:'"db/postgresql.yaml"'},"_target_: my_app.PostgreSQLConnection\nhost: localhost\nuser: root\npassword: 1234\ndatabase: tutorial\n")))),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db: mysql\n")),(0,a.mdx)("p",null,"With this, you can instantiate the object from the configuration with a single line of code:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python"},'@hydra.main(config_path="conf", config_name="config")\ndef my_app(cfg):\n connection = hydra.utils.instantiate(cfg.db)\n connection.connect()\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/10c36d6f.432d15e4.js b/assets/js/10c36d6f.432d15e4.js new file mode 100644 index 0000000000..248763f742 --- /dev/null +++ b/assets/js/10c36d6f.432d15e4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2040],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return f}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),f=function(e){return function(n){var t=d(n.components);return r.createElement(e,a({},n,{components:t}))}},d=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(c.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),f=d(t),u=o,m=f["".concat(i,".").concat(u)]||f[u]||p[u]||a;return t?r.createElement(m,s(s({ref:n},c),{},{components:t})):r.createElement(m,s({ref:n},c))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=m;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c None:\n self.host = host\n self.user = user\n self.password = password\n\n def connect(self) -> None:\n print(f"MySQL connecting to {self.host}")\n\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, host: str, user: str, password: str, database: str) -> None:\n self.host = host\n self.user = user\n self.password = password\n self.database = database\n\n def connect(self) -> None:\n print(f"PostgreSQL connecting to {self.host}")\n')),(0,a.mdx)("p",null,"To support this, we can have a parallel config structure:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text"},"conf/\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 db\n \u251c\u2500\u2500 mysql.yaml\n \u2514\u2500\u2500 postgresql.yaml\n")),(0,a.mdx)("p",null,"Config files:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"_target_: my_app.MySQLConnection\nhost: localhost\nuser: root\npassword: 1234\n\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/postgresql.yaml"',title:'"db/postgresql.yaml"'},"_target_: my_app.PostgreSQLConnection\nhost: localhost\nuser: root\npassword: 1234\ndatabase: tutorial\n")))),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db: mysql\n")),(0,a.mdx)("p",null,"With this, you can instantiate the object from the configuration with a single line of code:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python"},'@hydra.main(config_path="conf", config_name="config")\ndef my_app(cfg):\n connection = hydra.utils.instantiate(cfg.db)\n connection.connect()\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/10dd8346.505405a0.js b/assets/js/10dd8346.505405a0.js new file mode 100644 index 0000000000..bc28c4c3e0 --- /dev/null +++ b/assets/js/10dd8346.505405a0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[282],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return l},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return u},withMDXComponents:function(){return c}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){return function(n){var t=u(n.components);return r.createElement(e,a({},n,{components:t}))}},u=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):p(p({},n),e)),t},m=function(e){var n=u(e.components);return r.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},g=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,g=c["".concat(i,".").concat(m)]||c[m]||d[m]||a;return t?r.createElement(g,p(p({ref:n},l),{},{components:t})):r.createElement(g,p({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=g;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("p",null,"Running ",(0,a.mdx)("inlineCode",{parentName:"p"},"my_app.py")," without requesting a configuration will print an empty config."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\n{}\n")),(0,a.mdx)("p",null,"Select an item from a config group with ",(0,a.mdx)("inlineCode",{parentName:"p"},"+GROUP=OPTION"),", e.g: "),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{2}","{2}":!0},"$ python my_app.py +db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,a.mdx)("p",null,"By default, the config group determines where the config content is placed inside the final config object.\nIn Hydra, the path to the config content is referred to as the config ",(0,a.mdx)("inlineCode",{parentName:"p"},"package"),".\nThe package of ",(0,a.mdx)("inlineCode",{parentName:"p"},"db/postgresql.yaml")," is ",(0,a.mdx)("inlineCode",{parentName:"p"},"db"),":"),(0,a.mdx)("p",null,"Like before, you can still override individual values in the resulting config:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,a.mdx)("h3",{id:"advanced-topics"},"Advanced topics"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Config content can be relocated via package overrides. See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.3/advanced/overriding_packages"},"Reference Manual/Packages"),". "),(0,a.mdx)("li",{parentName:"ul"},"Multiple options can be selected from the same Config Group by specifying them as a list.",(0,a.mdx)("br",{parentName:"li"}),"See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.3/patterns/select_multiple_configs_from_config_group"},"Common Patterns/Selecting multiple configs from a Config Group"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/10e059cb.39783cac.js b/assets/js/10e059cb.39783cac.js deleted file mode 100644 index a7289b489b..0000000000 --- a/assets/js/10e059cb.39783cac.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5517],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return s},MDXProvider:function(){return c},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return m}});var t=a(67294);function i(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(i[a]=e[a]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=t.createContext({}),m=function(e){return function(n){var a=p(n.components);return t.createElement(e,r({},n,{components:a}))}},p=function(e){var n=t.useContext(s),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},c=function(e){var n=p(e.components);return t.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),m=p(a),c=i,h=m["".concat(l,".").concat(c)]||m[c]||u[c]||r;return a?t.createElement(h,o(o({ref:n},s),{},{components:a})):t.createElement(h,o({ref:n},s))}));function g(e,n){var a=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var s=2;s=0||(i[a]=e[a]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=t.createContext({}),m=function(e){return function(n){var a=p(n.components);return t.createElement(e,r({},n,{components:a}))}},p=function(e){var n=t.useContext(s),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},c=function(e){var n=p(e.components);return t.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),m=p(a),c=i,h=m["".concat(l,".").concat(c)]||m[c]||u[c]||r;return a?t.createElement(h,o(o({ref:n},s),{},{components:a})):t.createElement(h,o({ref:n},s))}));function g(e,n){var a=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=a.length,l=new Array(r);l[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var s=2;s=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),u=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},f=function(e){var t=m(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=m(n),f=a,p=u["".concat(o,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(p,c(c({ref:t},l),{},{components:n})):r.createElement(p,c({ref:t},l))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=p;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n\n\n\n'))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Config directory"',title:'"Config','directory"':!0},"\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 db\n \u251c\u2500\u2500 prod.yaml\n \u251c\u2500\u2500 qa.yaml\n \u2514\u2500\u2500 staging.yaml\n")),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db: staging\n")),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/staging.yaml"',title:'"db/staging.yaml"'},"# @package _group_\ndriver: mysql\nhost: mysql001.staging\nuser: root\npassword: root\n")))),(0,i.mdx)("p",null,"In the above example, the 3 yaml files has the structure compatible with the ",(0,i.mdx)("inlineCode",{parentName:"p"},"Config")," dataclass.\nYou can have as many such configs as you want."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Output"',title:'"Output"'},"$ python my_app.py db=prod\ndb:\n driver: mysql\n host: mysql001.prod\n user: root\n password: '1234'\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9670],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return f},mdx:function(){return g},useMDXComponents:function(){return m},withMDXComponents:function(){return u}});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),u=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},f=function(e){var t=m(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=m(n),f=a,p=u["".concat(o,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(p,c(c({ref:t},l),{},{components:n})):r.createElement(p,c({ref:t},l))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=p;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n\n\n\n'))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Config directory"',title:'"Config','directory"':!0},"\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 db\n \u251c\u2500\u2500 prod.yaml\n \u251c\u2500\u2500 qa.yaml\n \u2514\u2500\u2500 staging.yaml\n")),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db: staging\n")),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/staging.yaml"',title:'"db/staging.yaml"'},"# @package _group_\ndriver: mysql\nhost: mysql001.staging\nuser: root\npassword: root\n")))),(0,i.mdx)("p",null,"In the above example, the 3 yaml files has the structure compatible with the ",(0,i.mdx)("inlineCode",{parentName:"p"},"Config")," dataclass.\nYou can have as many such configs as you want."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Output"',title:'"Output"'},"$ python my_app.py db=prod\ndb:\n driver: mysql\n host: mysql001.prod\n user: root\n password: '1234'\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/120f5b8b.7566b270.js b/assets/js/120f5b8b.817b362d.js similarity index 50% rename from assets/js/120f5b8b.7566b270.js rename to assets/js/120f5b8b.817b362d.js index a77760ba24..c9d0a2ab31 100644 --- a/assets/js/120f5b8b.7566b270.js +++ b/assets/js/120f5b8b.817b362d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6703],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return m},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),c=function(e){return function(t){var n=p(t.components);return r.createElement(e,a({},t,{components:n}))}},p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):u(u({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,f=c["".concat(i,".").concat(m)]||c[m]||d[m]||a;return n?r.createElement(f,u(u({ref:t},s),{},{components:n})):r.createElement(f,u({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var u={};for(var l in t)hasOwnProperty.call(t,l)&&(u[l]=t[l]);u.originalType=e,u.mdxType="string"==typeof e?e:o,i[1]=u;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){return function(t){var n=p(t.components);return r.createElement(e,a({},t,{components:n}))}},p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):u(u({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,f=c["".concat(i,".").concat(m)]||c[m]||d[m]||a;return n?r.createElement(f,u(u({ref:t},l),{},{components:n})):r.createElement(f,u({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u.mdxType="string"==typeof e?e:o,i[1]=u;for(var l=2;l=0||(l[t]=e[t]);return l}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t])}return l}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,r({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,l=e.mdxType,r=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=l,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||r;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,l=n&&n.mdxType;if("string"==typeof e||l){var r=t.length,i=new Array(r);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:l,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,r.mdx)("details",null,(0,r.mdx)("summary",null,"python my_app.py ",(0,r.mdx)("b",null,"--info defaults")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,r.mdx)("details",null,(0,r.mdx)("summary",null,"python my_app.py ",(0,r.mdx)("b",null,"--cfg job")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,r.mdx)("h2",{id:"related-topics"},"Related topics"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/advanced/overriding_packages"},"Packages")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/12111f85.d44f5bce.js b/assets/js/12111f85.d44f5bce.js deleted file mode 100644 index 671beaf452..0000000000 --- a/assets/js/12111f85.d44f5bce.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[277],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return c},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function l(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(l[t]=e[t]);return l}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t])}return l}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,r({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,l=e.mdxType,r=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=l,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||r;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,l=n&&n.mdxType;if("string"==typeof e||l){var r=t.length,i=new Array(r);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:l,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,r.mdx)("details",null,(0,r.mdx)("summary",null,"python my_app.py ",(0,r.mdx)("b",null,"--info defaults")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,r.mdx)("details",null,(0,r.mdx)("summary",null,"python my_app.py ",(0,r.mdx)("b",null,"--cfg job")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,r.mdx)("h2",{id:"related-topics"},"Related topics"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/advanced/overriding_packages"},"Packages")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("a",{parentName:"li",href:"/docs/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/13a26e00.59e5217b.js b/assets/js/13a26e00.59e5217b.js new file mode 100644 index 0000000000..00465de80c --- /dev/null +++ b/assets/js/13a26e00.59e5217b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[425],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=a(67294);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.1/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.1.0.dev3\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n head_node:\n InstanceType: m5.large\n ImageId: ami-008d8ed4bd7dc2485\n worker_nodes:\n InstanceType: m5.large\n ImageId: ami-008d8ed4bd7dc2485\n file_mounts: {}\n initialization_commands: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076\n --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/13a26e00.6e0890cd.js b/assets/js/13a26e00.6e0890cd.js deleted file mode 100644 index d278444a1c..0000000000 --- a/assets/js/13a26e00.6e0890cd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[425],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=a(67294);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.1/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.1.0.dev3\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n head_node:\n InstanceType: m5.large\n ImageId: ami-008d8ed4bd7dc2485\n worker_nodes:\n InstanceType: m5.large\n ImageId: ami-008d8ed4bd7dc2485\n file_mounts: {}\n initialization_commands: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076\n --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/14173c40.50b666cb.js b/assets/js/14173c40.50b666cb.js new file mode 100644 index 0000000000..058b26e410 --- /dev/null +++ b/assets/js/14173c40.50b666cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8318],{3905:function(e,n,r){r.r(n),r.d(n,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return s},withMDXComponents:function(){return c}});var t=r(67294);function a(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var m=t.createContext({}),c=function(e){return function(n){var r=s(n.components);return t.createElement(e,i({},n,{components:r}))}},s=function(e){var n=t.useContext(m),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},p=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=s(r),p=a,f=c["".concat(o,".").concat(p)]||c[p]||u[p]||i;return r?t.createElement(f,l(l({ref:n},m),{},{components:r})):t.createElement(f,l({ref:n},m))}));function g(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var m=t.createContext({}),c=function(e){return function(n){var r=s(n.components);return t.createElement(e,i({},n,{components:r}))}},s=function(e){var n=t.useContext(m),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},p=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=s(r),p=a,f=c["".concat(o,".").concat(p)]||c[p]||u[p]||i;return r?t.createElement(f,l(l({ref:n},m),{},{components:r})):t.createElement(f,l({ref:n},m))}));function g(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var m=t.createContext({}),c=function(e){return function(a){var n=d(a.components);return t.createElement(e,l({},a,{components:n}))}},d=function(e){var a=t.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):o(o({},a),e)),n},p=function(e){var a=d(e.components);return t.createElement(m.Provider,{value:a},e.children)},g={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=d(n),p=r,u=c["".concat(i,".").concat(p)]||c[p]||g[p]||l;return n?t.createElement(u,o(o({ref:a},m),{},{components:n})):t.createElement(u,o({ref:a},m))}));function f(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=u;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var m=2;m")," to demonstrate different cases:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config_group/config.yaml"',title:'"config_group/config.yaml"'},"defaults:\n - /server/db<@PACKAGE>: mysql\n")),(0,l.mdx)("p",null,"Without a package override, the resulting package is ",(0,l.mdx)("inlineCode",{parentName:"p"},"config_group.server.db"),".",(0,l.mdx)("br",{parentName:"p"}),"\n","With the ",(0,l.mdx)("strong",{parentName:"p"},"@","_","here","_")," keyword, The resulting package is the same as the containing config (",(0,l.mdx)("inlineCode",{parentName:"p"},"config_group"),"). "),(0,l.mdx)("h5",{id:"absolute-keywords"},"Absolute keywords:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("strong",{parentName:"li"},"@","_","group","_"),": ","_","group","_"," is the absolute default package of the config (",(0,l.mdx)("inlineCode",{parentName:"li"},"server.db"),")"),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("strong",{parentName:"li"},"@","_","global","_"),": The global package. Anything following ","_","global","_"," is absolute.",(0,l.mdx)("br",{parentName:"li"}),"e.g. ",(0,l.mdx)("strong",{parentName:"li"},"@","_","global","_",".foo")," becomes ",(0,l.mdx)("inlineCode",{parentName:"li"},"foo"),".")),(0,l.mdx)("h3",{id:"overriding-the-package-via-the-package-directive"},"Overriding the package via the package directive"),(0,l.mdx)("p",null,"The @package directive changes the package of a config file. The package specified by a @package directive is always absolute."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="server/db/mysql.yaml" {1}',title:'"server/db/mysql.yaml"',"{1}":!0},"# @package foo.bar\nname: mysql\n")),(0,l.mdx)("p",null,"To change the package to the global (empty) package, use the keyword ",(0,l.mdx)("inlineCode",{parentName:"p"},"_global_"),"."),(0,l.mdx)("h3",{id:"using-a-config-group-more-than-once"},"Using a config group more than once"),(0,l.mdx)("p",null,"The following example adds the ",(0,l.mdx)("inlineCode",{parentName:"p"},"server/db/mysql")," config in the packages ",(0,l.mdx)("inlineCode",{parentName:"p"},"src")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"dst"),"."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - server/db@src: mysql\n - server/db@dst: mysql\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="$ python my_app.py"',title:'"$',python:!0,'my_app.py"':!0},"src:\n name: mysql\ndst:\n name: mysql\n")))),(0,l.mdx)("p",null,"When overriding config groups with a non-default package, the package must be used:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="$ python my_app.py server/db@src=sqlite"',title:'"$',python:!0,"my_app.py":!0,"server/db@src":'sqlite"'},"src:\n name: sqlite\ndst:\n name: mysql\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/141a01e8.c9a4c975.js b/assets/js/141a01e8.c9a4c975.js new file mode 100644 index 0000000000..b488003aa0 --- /dev/null +++ b/assets/js/141a01e8.c9a4c975.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7240],{3905:function(e,a,n){n.r(a),n.d(a,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return f},useMDXComponents:function(){return d},withMDXComponents:function(){return c}});var t=n(67294);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(){return l=Object.assign||function(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var m=t.createContext({}),c=function(e){return function(a){var n=d(a.components);return t.createElement(e,l({},a,{components:n}))}},d=function(e){var a=t.useContext(m),n=a;return e&&(n="function"==typeof e?e(a):o(o({},a),e)),n},p=function(e){var a=d(e.components);return t.createElement(m.Provider,{value:a},e.children)},g={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=d(n),p=r,u=c["".concat(i,".").concat(p)]||c[p]||g[p]||l;return n?t.createElement(u,o(o({ref:a},m),{},{components:n})):t.createElement(u,o({ref:a},m))}));function f(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=u;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var m=2;m")," to demonstrate different cases:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config_group/config.yaml"',title:'"config_group/config.yaml"'},"defaults:\n - /server/db<@PACKAGE>: mysql\n")),(0,l.mdx)("p",null,"Without a package override, the resulting package is ",(0,l.mdx)("inlineCode",{parentName:"p"},"config_group.server.db"),".",(0,l.mdx)("br",{parentName:"p"}),"\n","With the ",(0,l.mdx)("strong",{parentName:"p"},"@","_","here","_")," keyword, The resulting package is the same as the containing config (",(0,l.mdx)("inlineCode",{parentName:"p"},"config_group"),"). "),(0,l.mdx)("h5",{id:"absolute-keywords"},"Absolute keywords:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("strong",{parentName:"li"},"@","_","group","_"),": ","_","group","_"," is the absolute default package of the config (",(0,l.mdx)("inlineCode",{parentName:"li"},"server.db"),")"),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("strong",{parentName:"li"},"@","_","global","_"),": The global package. Anything following ","_","global","_"," is absolute.",(0,l.mdx)("br",{parentName:"li"}),"e.g. ",(0,l.mdx)("strong",{parentName:"li"},"@","_","global","_",".foo")," becomes ",(0,l.mdx)("inlineCode",{parentName:"li"},"foo"),".")),(0,l.mdx)("h3",{id:"overriding-the-package-via-the-package-directive"},"Overriding the package via the package directive"),(0,l.mdx)("p",null,"The @package directive changes the package of a config file. The package specified by a @package directive is always absolute."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="server/db/mysql.yaml" {1}',title:'"server/db/mysql.yaml"',"{1}":!0},"# @package foo.bar\nname: mysql\n")),(0,l.mdx)("p",null,"To change the package to the global (empty) package, use the keyword ",(0,l.mdx)("inlineCode",{parentName:"p"},"_global_"),"."),(0,l.mdx)("h3",{id:"using-a-config-group-more-than-once"},"Using a config group more than once"),(0,l.mdx)("p",null,"The following example adds the ",(0,l.mdx)("inlineCode",{parentName:"p"},"server/db/mysql")," config in the packages ",(0,l.mdx)("inlineCode",{parentName:"p"},"src")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"dst"),"."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - server/db@src: mysql\n - server/db@dst: mysql\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="$ python my_app.py"',title:'"$',python:!0,'my_app.py"':!0},"src:\n name: mysql\ndst:\n name: mysql\n")))),(0,l.mdx)("p",null,"When overriding config groups with a non-default package, the package must be used:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="$ python my_app.py server/db@src=sqlite"',title:'"$',python:!0,"my_app.py":!0,"server/db@src":'sqlite"'},"src:\n name: sqlite\ndst:\n name: mysql\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1434836b.048d8a68.js b/assets/js/1434836b.048d8a68.js new file mode 100644 index 0000000000..88c42cebd5 --- /dev/null +++ b/assets/js/1434836b.048d8a68.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4564],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return m},withMDXComponents:function(){return p}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),p=function(e){return function(n){var t=m(n.components);return a.createElement(e,i({},n,{components:t}))}},m=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},u=function(e){var n=m(e.components);return a.createElement(c.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=m(t),u=r,f=p["".concat(o,".").concat(u)]||p[u]||s[u]||i;return t?a.createElement(f,d(d({ref:n},c),{},{components:t})):a.createElement(f,d({ref:n},c))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=f;var d={};for(var l in n)hasOwnProperty.call(n,l)&&(d[l]=n[l]);d.originalType=e,d.mdxType="string"==typeof e?e:r,o[1]=d;for(var c=2;ccase 1:",id:"example-for-case-1",children:[{value:"Before",id:"before",children:[],level:4},{value:"After",id:"after",children:[],level:4}],level:3},{value:"Example for case 2:",id:"example-for-case-2",children:[],level:3}],level:2}],m={toc:p};function u(e){var n=e.components,t=(0,r.Z)(e,o);return(0,i.mdx)("wrapper",(0,a.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("h2",{id:"adding-an-package-directive"},"Adding an @package directive"),(0,i.mdx)("p",null,"Hydra 1.0 introduces the concept of a config ",(0,i.mdx)("inlineCode",{parentName:"p"},"package"),". A ",(0,i.mdx)("inlineCode",{parentName:"p"},"package")," is the common parent\npath of all nodes in the config file."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In Hydra 0.11, there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),' ("")'),(0,i.mdx)("li",{parentName:"ul"},"In Hydra 1.1 the default will be ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_")," (the name of the config group)."),(0,i.mdx)("li",{parentName:"ul"},"Hydra 1.0 maintains the implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")," and issues a warning for\nany config group file without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive.")),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to these configs now, you guarantee that your configs\nwill not break when you upgrade to Hydra 1.1."),(0,i.mdx)("p",null,"The ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," directive is described in details ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/overriding_packages"},"here"),". "),(0,i.mdx)("h2",{id:"upgrade-instructions"},"Upgrade instructions:"),(0,i.mdx)("h3",{id:"recommended-10-seconds-per-config-file"},"Recommended (~10 seconds per config file):"),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 1"),": For config files where the common parent path matches the config group name: "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _group_")," to the top of every config group file"),(0,i.mdx)("li",{parentName:"ul"},"Remove the common parent path config file like in the example below.")),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 2"),": For files without a common parent path:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _global_"),".")),(0,i.mdx)("h3",{id:"alternative-not-recommended"},"Alternative (not recommended):"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you do not want to restructure the config at this time use ",(0,i.mdx)("inlineCode",{parentName:"li"},"Case 2")," for all your config files.")),(0,i.mdx)("h3",{id:"example-for-case-1"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 1"),":"),(0,i.mdx)("h4",{id:"before"},"Before"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"db:\n driver: mysql\n host: localhost\n port: 3306\n")),(0,i.mdx)("h4",{id:"after"},"After"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"# @package _group_\ndriver: mysql\nhost: localhost\nport: 3306\n")),(0,i.mdx)("p",null,"The interpretations of the before and after files are identical."),(0,i.mdx)("h3",{id:"example-for-case-2"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 2"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="env/prod.yaml"',title:'"env/prod.yaml"'},"# @package _global_\ndb:\n driver: mysql\n host: 10.0.0.11\n port: 3306\n\nwebserver:\n host: 10.0.0.11\n port: 443\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1434836b.38f413ec.js b/assets/js/1434836b.38f413ec.js deleted file mode 100644 index a4e21eefa5..0000000000 --- a/assets/js/1434836b.38f413ec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4564],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return m},withMDXComponents:function(){return p}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),p=function(e){return function(n){var t=m(n.components);return r.createElement(e,i({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},u=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=m(t),u=a,f=p["".concat(o,".").concat(u)]||p[u]||s[u]||i;return t?r.createElement(f,d(d({ref:n},c),{},{components:t})):r.createElement(f,d({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var d={};for(var l in n)hasOwnProperty.call(n,l)&&(d[l]=n[l]);d.originalType=e,d.mdxType="string"==typeof e?e:a,o[1]=d;for(var c=2;ccase 1:",id:"example-for-case-1",children:[{value:"Before",id:"before",children:[],level:4},{value:"After",id:"after",children:[],level:4}],level:3},{value:"Example for case 2:",id:"example-for-case-2",children:[],level:3}],level:2}],m={toc:p};function u(e){var n=e.components,t=(0,a.Z)(e,o);return(0,i.mdx)("wrapper",(0,r.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("h2",{id:"adding-an-package-directive"},"Adding an @package directive"),(0,i.mdx)("p",null,"Hydra 1.0 introduces the concept of a config ",(0,i.mdx)("inlineCode",{parentName:"p"},"package"),". A ",(0,i.mdx)("inlineCode",{parentName:"p"},"package")," is the common parent\npath of all nodes in the config file."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In Hydra 0.11, there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),' ("")'),(0,i.mdx)("li",{parentName:"ul"},"In Hydra 1.1 the default will be ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_")," (the name of the config group)."),(0,i.mdx)("li",{parentName:"ul"},"Hydra 1.0 maintains the implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")," and issues a warning for\nany config group file without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive.")),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to these configs now, you guarantee that your configs\nwill not break when you upgrade to Hydra 1.1."),(0,i.mdx)("p",null,"The ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," directive is described in details ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/overriding_packages"},"here"),". "),(0,i.mdx)("h2",{id:"upgrade-instructions"},"Upgrade instructions:"),(0,i.mdx)("h3",{id:"recommended-10-seconds-per-config-file"},"Recommended (~10 seconds per config file):"),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 1"),": For config files where the common parent path matches the config group name: "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _group_")," to the top of every config group file"),(0,i.mdx)("li",{parentName:"ul"},"Remove the common parent path config file like in the example below.")),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 2"),": For files without a common parent path:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _global_"),".")),(0,i.mdx)("h3",{id:"alternative-not-recommended"},"Alternative (not recommended):"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you do not want to restructure the config at this time use ",(0,i.mdx)("inlineCode",{parentName:"li"},"Case 2")," for all your config files.")),(0,i.mdx)("h3",{id:"example-for-case-1"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 1"),":"),(0,i.mdx)("h4",{id:"before"},"Before"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"db:\n driver: mysql\n host: localhost\n port: 3306\n")),(0,i.mdx)("h4",{id:"after"},"After"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"# @package _group_\ndriver: mysql\nhost: localhost\nport: 3306\n")),(0,i.mdx)("p",null,"The interpretations of the before and after files are identical."),(0,i.mdx)("h3",{id:"example-for-case-2"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 2"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="env/prod.yaml"',title:'"env/prod.yaml"'},"# @package _global_\ndb:\n driver: mysql\n host: 10.0.0.11\n port: 3306\n\nwebserver:\n host: 10.0.0.11\n port: 443\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1443f4ed.71e5fa51.js b/assets/js/1443f4ed.71e5fa51.js new file mode 100644 index 0000000000..06e84f2fc4 --- /dev/null +++ b/assets/js/1443f4ed.71e5fa51.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5009],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return d},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return m}});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=r.createContext({}),m=function(e){return function(n){var t=s(n.components);return r.createElement(e,a({},n,{components:t}))}},s=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=s(e.components);return r.createElement(u.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},g=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),m=s(t),d=i,g=m["".concat(l,".").concat(d)]||m[d]||p[d]||a;return t?r.createElement(g,o(o({ref:n},u),{},{components:t})):r.createElement(g,o({ref:n},u))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,l=new Array(a);l[0]=g;var o={};for(var c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);o.originalType=e,o.mdxType="string"==typeof e?e:i,l[1]=o;for(var u=2;u=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=a.createContext({}),m=function(e){return function(n){var t=d(n.components);return a.createElement(e,o({},n,{components:t}))}},d=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=d(t),p=i,f=m["".concat(r,".").concat(p)]||m[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n version_base: Optional[str],\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param version_base: compatibility level to use.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(\n config_module: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(\n config_dir: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1483e3dc.e80dee6f.js b/assets/js/1483e3dc.e80dee6f.js new file mode 100644 index 0000000000..468e7ffd9c --- /dev/null +++ b/assets/js/1483e3dc.e80dee6f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6258],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return h},useMDXComponents:function(){return d},withMDXComponents:function(){return c}});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var m=a.createContext({}),c=function(e){return function(n){var t=d(n.components);return a.createElement(e,o({},n,{components:t}))}},d=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=d(t),p=i,f=c["".concat(r,".").concat(p)]||c[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},m),{},{components:t})):a.createElement(f,l({ref:n},m))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var m=2;m DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n version_base: Optional[str],\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param version_base: compatibility level to use.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(\n config_module: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(\n config_dir: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1564a8d3.b865df6c.js b/assets/js/1564a8d3.b865df6c.js new file mode 100644 index 0000000000..0bd72483d1 --- /dev/null +++ b/assets/js/1564a8d3.b865df6c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1905],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=a(67294);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.2/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.2.0.dev1\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n upscaling_speed: 1.0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n available_node_types:\n ray.head.default:\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n ray.worker.default:\n min_workers: 0\n max_workers: 2\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n InstanceMarketOptions:\n MarketType: spot\n head_node_type: ray.head.default\n file_mounts: {}\n initialization_commands: []\n cluster_synced_files: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1564a8d3.c62cc72c.js b/assets/js/1564a8d3.c62cc72c.js deleted file mode 100644 index 95981e599e..0000000000 --- a/assets/js/1564a8d3.c62cc72c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1905],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var r=a(67294);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var m=r.createContext({}),c=function(e){return function(n){var a=p(n.components);return r.createElement(e,l({},n,{components:a}))}},p=function(e){var n=r.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=p(e.components);return r.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,l=e.originalType,i=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=p(a),s=t,h=c["".concat(i,".").concat(s)]||c[s]||u[s]||l;return a?r.createElement(h,o(o({ref:n},m),{},{components:a})):r.createElement(h,o({ref:n},m))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:t,i[1]=o;for(var m=2;mray_aws launcher",id:"ray_aws-launcher",children:[{value:"Examples",id:"examples",children:[{value:"Manage Cluster LifeCycle",id:"manage-cluster-lifecycle",children:[],level:5},{value:"Configure Ray Logging",id:"configure-ray-logging",children:[],level:5}],level:4}],level:3},{value:"ray launcher",id:"ray-launcher",children:[],level:3},{value:"Configure ray.init() and ray.remote()",id:"configure-rayinit-and-rayremote",children:[],level:3}],s={toc:p};function u(e){var n=e.components,a=(0,t.Z)(e,o);return(0,l.mdx)("wrapper",(0,r.Z)({},s,a,{components:n,mdxType:"MDXLayout"}),(0,l.mdx)("p",null,(0,l.mdx)("a",{parentName:"p",href:"https://pypi.org/project/hydra-ray-launcher/"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/v/hydra-ray-launcher",alt:"PyPI"})),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/l/hydra-ray-launcher",alt:"PyPI - License"}),"\n",(0,l.mdx)("img",{parentName:"p",src:"https://img.shields.io/pypi/pyversions/hydra-ray-launcher",alt:"PyPI - Python Version"}),"\n",(0,l.mdx)("a",{parentName:"p",href:"https://pypistats.org/packages/hydra-ray-launcher"},(0,l.mdx)("img",{parentName:"a",src:"https://img.shields.io/pypi/dm/hydra-ray-launcher.svg",alt:"PyPI - Downloads"})),(0,l.mdx)(i.T,{text:"Example application",to:"plugins/hydra_ray_launcher/examples",mdxType:"ExampleGithubLink"}),(0,l.mdx)(i.T,{text:"Plugin source",to:"plugins/hydra_ray_launcher",mdxType:"ExampleGithubLink"})),(0,l.mdx)("p",null,"The Ray Launcher plugin provides 2 launchers: ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launches jobs remotely on AWS and is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"ray autoscaler sdk"),". ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launches jobs on your local machine or existing ray cluster. "),(0,l.mdx)("h3",{id:"installation"},"Installation"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ pip install hydra-ray-launcher --upgrade\n")),(0,l.mdx)("h3",{id:"usage"},"Usage"),(0,l.mdx)("p",null,"Once installed, add ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray_aws")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher=ray")," to your command line. Alternatively, override ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra/launcher")," in your config:"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - override hydra/launcher: ray_aws\n")),(0,l.mdx)("p",null,"There are several standard approaches for configuring plugins. Check ",(0,l.mdx)("a",{parentName:"p",href:"/docs/1.2/patterns/configuring_plugins"},"this page")," for more information."),(0,l.mdx)("h3",{id:"ray_aws-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray_aws")," launcher"),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},(0,l.mdx)("inlineCode",{parentName:"p"},"ray_aws")," launcher is built on top of ray's ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/releases-1.3.0/cluster/sdk.html"},"autoscaler sdk"),". To get started, you need to\n",(0,l.mdx)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"config your AWS credentials"),".\n",(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects your AWS credentials have certain permissions for ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/ec2"},(0,l.mdx)("inlineCode",{parentName:"a"},"EC2"))," and ",(0,l.mdx)("a",{parentName:"p",href:"https://aws.amazon.com/iam"},(0,l.mdx)("inlineCode",{parentName:"a"},"IAM")),". Read ",(0,l.mdx)("a",{parentName:"p",href:"https://github.com/ray-project/ray/issues/9327"},"this")," for more information."))),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray autoscaler sdk")," expects a configuration for the EC2 cluster; we've schematized the configs in ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py",mdxType:"GithubLink"},"here")),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Discover ray_aws launcher's config"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/launcher=ray_aws --cfg hydra -p hydra.launcher\n# @package hydra.launcher\n# @package hydra.launcher\n_target_: hydra_plugins.hydra_ray_launcher.ray_aws_launcher.RayAWSLauncher\nenv_setup:\n pip_packages:\n omegaconf: ${ray_pkg_version:omegaconf}\n hydra_core: ${ray_pkg_version:hydra}\n ray: ${ray_pkg_version:ray}\n cloudpickle: ${ray_pkg_version:cloudpickle}\n pickle5: 0.0.11\n hydra_ray_launcher: 1.2.0.dev1\n commands:\n - conda create -n hydra_${python_version:micro} python=${python_version:micro} -y\n - echo 'export PATH=\"$HOME/anaconda3/envs/hydra_${python_version:micro}/bin:$PATH\"'\n >> ~/.bashrc\nray:\n init:\n address: null\n remote: {}\n cluster:\n cluster_name: default\n min_workers: 0\n upscaling_speed: 1.0\n max_workers: 1\n initial_workers: 0\n autoscaling_mode: default\n target_utilization_fraction: 0.8\n idle_timeout_minutes: 5\n docker:\n image: ''\n container_name: ''\n pull_before_run: true\n run_options: []\n provider:\n type: aws\n region: us-west-2\n availability_zone: us-west-2a,us-west-2b\n cache_stopped_nodes: false\n key_pair:\n key_name: hydra-${oc.env:USER,user}\n auth:\n ssh_user: ubuntu\n available_node_types:\n ray.head.default:\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n ray.worker.default:\n min_workers: 0\n max_workers: 2\n resources: {}\n node_config:\n InstanceType: m5.large\n ImageId: ami-0a2363a9cff180a64\n InstanceMarketOptions:\n MarketType: spot\n head_node_type: ray.head.default\n file_mounts: {}\n initialization_commands: []\n cluster_synced_files: []\n setup_commands: []\n head_setup_commands: []\n worker_setup_commands: []\n head_start_ray_commands:\n - ray stop\n - ulimit -n 65536;ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml\n worker_start_ray_commands:\n - ray stop\n - ulimit -n 65536; ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076\n run_env: auto\nstop_cluster: true\nsync_up:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nsync_down:\n source_dir: null\n target_dir: null\n include: []\n exclude: []\nlogging:\n log_style: auto\n color_mode: auto\n verbosity: 0\ncreate_update_cluster:\n no_restart: false\n restart_only: false\n no_config_cache: false\nteardown_cluster:\n workers_only: false\n keep_min_workers: false\n"))),(0,l.mdx)("h4",{id:"examples"},"Examples"),(0,l.mdx)("p",null,"The following examples can be found ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples",mdxType:"GithubLink"},"here"),"."),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Simple app"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun task=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : task=1\n[HYDRA] #1 : task=2\n[HYDRA] #2 : task=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmpqqg4v4i7/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=3374) [__main__][INFO] - Executing task 1\n(pid=3374) [__main__][INFO] - Executing task 2\n(pid=3374) [__main__][INFO] - Executing task 3\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"Upload & Download from remote cluster"),(0,l.mdx)("p",null,"If your application is dependent on multiple modules, you can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_up")," to upload dependency modules to the remote cluster.\nYou can also configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.sync_down")," to download output from remote cluster if needed. This functionality is built on top of ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"include")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"exclude")," is consistent with how it works in ",(0,l.mdx)("inlineCode",{parentName:"p"},"rsync"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python train.py --multirun random_seed=1,2,3\n[HYDRA] Ray Launcher is launching 3 jobs, \n[HYDRA] #0 : random_seed=1\n[HYDRA] #1 : random_seed=2\n[HYDRA] #2 : random_seed=3\n[HYDRA] Pickle for jobs: /var/folders/n_/9qzct77j68j6n9lh0lw3vjqcn96zxl/T/tmptdkye9of/job_spec.pkl\nCluster: default\n...\nINFO services.py:1172 -- View the Ray dashboard at http://localhost:8265\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\n(pid=1772) [__main__][INFO] - Start training...\n(pid=1772) [INFO] - Init my model\n(pid=1772) [INFO] - Created dir for checkpoints. dir=checkpoint\nLoaded cached provider configuration\n...\n[HYDRA] Output: receiving file list ... done\n16-32-25/\n16-32-25/0/\n16-32-25/0/checkpoint/\n16-32-25/0/checkpoint/checkpoint_1.pt\n16-32-25/1/\n16-32-25/1/checkpoint/\n16-32-25/1/checkpoint/checkpoint_2.pt\n16-32-25/2/\n16-32-25/2/checkpoint/\n16-32-25/2/checkpoint/checkpoint_3.pt\n...\n[HYDRA] Stopping cluster now. (stop_cluster=true)\n[HYDRA] Deleted the cluster (provider.cache_stopped_nodes=false)\nDestroying cluster. Confirm [y/N]: y [automatic, due to --yes]\n...\nNo nodes remaining.\n\n"))),(0,l.mdx)("h5",{id:"manage-cluster-lifecycle"},"Manage Cluster LifeCycle"),(0,l.mdx)("p",null,"You can manage the Ray EC2 cluster lifecycle by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default setting (no need to specify on commandline): delete cluster after job finishes remotely:"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=true\nhydra.launcher.ray.cluster.provider.cache_stopped_nodes=false\nhydra.launcher.teardown_cluster.workers_only=false\nhydra.launcher.teardown_cluster.keep_min_workers=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep cluster running after jobs finishes remotely"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.stop_cluster=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Power off EC2 instances and control node termination using ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.provider.cache_stopped_nodes"),"\nand ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.teardown_cluster.workers_only")),(0,l.mdx)("table",{parentName:"li"},(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null},"cache_stopped_nodes"),(0,l.mdx)("th",{parentName:"tr",align:null},"workers_only"),(0,l.mdx)("th",{parentName:"tr",align:null},"behavior"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"All nodes are terminated")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps head node running and terminates only worker node")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops both of them")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"Keeps both head node and worker node and stops only worker node"))))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Keep ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.cluster.min_workers")," worker nodes\nand delete the rest of the worker nodes"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.teardown_cluster.keep_min_workers=true\n")))),(0,l.mdx)("p",null,"Additionally, you can configure how to create or update the cluster:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: run setup commands, restart Ray and use\nthe config cache if available"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=false\nhydra.launcher.create_update_cluster.restart_only=false\nhydra.launcher.create_update_cluster.no_config_cache=false\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip restarting Ray services when updating the cluster config"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_restart=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Skip running setup commands and only restart Ray (cannot be used with\n",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.create_update_cluster.no_restart"),")"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.restart_only=true\n"))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Fully resolve all environment settings from the cloud provider again"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.create_update_cluster.no_config_cache=true\n")))),(0,l.mdx)("h5",{id:"configure-ray-logging"},"Configure Ray Logging"),(0,l.mdx)("p",null,"You can manage Ray specific logging by configuring the flags provided by the plugin:"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Default config: use minimal verbosity and automatically\ndetect whether to use pretty-print and color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="auto"\nhydra.launcher.logging.color_mode="auto"\nhydra.launcher.logging.verbosity=0\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable pretty-print"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.log_style="record"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Disable color mode"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},'hydra.launcher.logging.color_mode="false"\n'))),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("p",{parentName:"li"},"Increase Ray logging verbosity"),(0,l.mdx)("pre",{parentName:"li"},(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"hydra.launcher.logging.verbosity=3\n")))),(0,l.mdx)("h3",{id:"ray-launcher"},(0,l.mdx)("inlineCode",{parentName:"h3"},"ray")," launcher"),(0,l.mdx)("p",null,(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher lets you launch application on your ray cluster or local machine. You can easily config how your jobs are executed by changing ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," launcher's configuration here\n",(0,l.mdx)("inlineCode",{parentName:"p"},"~/hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/conf/hydra/launcher/ray.yaml")),(0,l.mdx)("p",null," The ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple",mdxType:"GithubLink"},"example application")," starts a new ray cluster."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-16-28\n[HYDRA] Initializing ray with config: {}\nINFO services.py:1164 -- View the Ray dashboard at http://127.0.0.1:8266\n[HYDRA] #0 : \n(pid=97801) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("p",null,"You can run the example application on your existing ray cluster as well by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init.address"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py --multirun hydra/launcher=ray hydra.launcher.ray.init.address=localhost:6379'\n[HYDRA] Ray Launcher is launching 1 jobs, sweep output dir: multirun/2020-11-10/15-13-32\n[HYDRA] Initializing ray with config: {'num_cpus': None, 'num_gpus': None, 'address': 'localhost:6379'}\nINFO worker.py:633 -- Connecting to existing Ray cluster at address: 10.30.99.17:6379\n[HYDRA] #0 : \n(pid=93358) [__main__][INFO] - Executing task 1\n")),(0,l.mdx)("h3",{id:"configure-rayinit-and-rayremote"},"Configure ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.init()")," and ",(0,l.mdx)("inlineCode",{parentName:"h3"},"ray.remote()")),(0,l.mdx)("p",null,"Ray launcher is built on top of ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-init"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.init()")),"\nand ",(0,l.mdx)("a",{parentName:"p",href:"https://docs.ray.io/en/master/package-ref.html?highlight=ray.remote#ray-remote"},(0,l.mdx)("inlineCode",{parentName:"a"},"ray.remote()")),".\nYou can configure ",(0,l.mdx)("inlineCode",{parentName:"p"},"ray")," by overriding ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.init")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"hydra.launcher.ray.remote"),".\nCheck out an ",(0,l.mdx)(i.Z,{to:"plugins/hydra_ray_launcher/examples/simple/config.yaml",mdxType:"GithubLink"},"example config"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/16568db6.464e2262.js b/assets/js/16568db6.464e2262.js new file mode 100644 index 0000000000..32050f3efc --- /dev/null +++ b/assets/js/16568db6.464e2262.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9728],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return h},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(n),u=r,f=s["".concat(i,".").concat(u)]||s[u]||c[u]||o;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=f;var l={};for(var m in t)hasOwnProperty.call(t,m)&&(l[m]=t[m]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 conf\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 db\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 mysql.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 postgresql.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 __init__.py\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new config:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - db: mysql\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configuration easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/1.3/tutorials/basic/your_first_app/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/16568db6.8d45b6ad.js b/assets/js/16568db6.8d45b6ad.js deleted file mode 100644 index 6427cb66df..0000000000 --- a/assets/js/16568db6.8d45b6ad.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9728],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return h},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(n),u=r,f=s["".concat(l,".").concat(u)]||s[u]||c[u]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var m in t)hasOwnProperty.call(t,m)&&(i[m]=t[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 conf\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 db\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 mysql.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 postgresql.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 __init__.py\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new config:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - db: mysql\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configuration easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/1.3/tutorials/basic/your_first_app/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1760e2a5.2496cc98.js b/assets/js/1760e2a5.2496cc98.js deleted file mode 100644 index 6ba711bc74..0000000000 --- a/assets/js/1760e2a5.2496cc98.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7799],{3905:function(e,n,r){r.r(n),r.d(n,{MDXContext:function(){return p},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return c},withMDXComponents:function(){return s}});var t=r(67294);function a(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=c(n.components);return t.createElement(e,l({},n,{components:r}))}},c=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},d=function(e){var n=c(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},b=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=c(r),d=a,b=s["".concat(i,".").concat(d)]||s[d]||m[d]||l;return r?t.createElement(b,o(o({ref:n},p),{},{components:r})):t.createElement(b,o({ref:n},p))}));function h(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=b;var o={};for(var u in n)hasOwnProperty.call(n,u)&&(o[u]=n[u]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=c(n.components);return t.createElement(e,l({},n,{components:r}))}},c=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},d=function(e){var n=c(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},b=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=c(r),d=a,b=s["".concat(i,".").concat(d)]||s[d]||m[d]||l;return r?t.createElement(b,o(o({ref:n},p),{},{components:r})):t.createElement(b,o({ref:n},p))}));function h(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=b;var o={};for(var u in n)hasOwnProperty.call(n,u)&&(o[u]=n[u]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=d(n),l=o,f=u["".concat(i,".").concat(l)]||u[l]||m[l]||a;return n?r.createElement(f,c(c({ref:t},p),{},{components:n})):r.createElement(f,c({ref:t},p))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var p=2;p=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=d(n),l=o,f=u["".concat(i,".").concat(l)]||u[l]||m[l]||a;return n?r.createElement(f,c(c({ref:t},p),{},{components:n})):r.createElement(f,c({ref:t},p))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var p=2;p=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var d=a.createContext({}),s=function(e){return function(n){var t=c(n.components);return a.createElement(e,o({},n,{components:t}))}},c=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return a.createElement(d.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=c(t),u=i,h=s["".concat(r,".").concat(u)]||s[u]||p[u]||o;return t?a.createElement(h,l(l({ref:n},d),{},{components:t})):a.createElement(h,l({ref:n},d))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=h;var l={};for(var m in n)hasOwnProperty.call(n,m)&&(l[m]=n[m]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var d=2;d=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var d=a.createContext({}),s=function(e){return function(n){var t=c(n.components);return a.createElement(e,o({},n,{components:t}))}},c=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return a.createElement(d.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=c(t),u=i,h=s["".concat(r,".").concat(u)]||s[u]||p[u]||o;return t?a.createElement(h,l(l({ref:n},d),{},{components:t})):a.createElement(h,l({ref:n},d))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=h;var l={};for(var m in n)hasOwnProperty.call(n,m)&&(l[m]=n[m]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var d=2;d=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){return function(t){var n=f(t.components);return r.createElement(e,i({},t,{components:n}))}},f=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=f(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},b=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),l=f(n),p=o,b=l["".concat(a,".").concat(p)]||l[p]||d[p]||i;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=b;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){return function(t){var n=f(t.components);return r.createElement(e,i({},t,{components:n}))}},f=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=f(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},b=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),l=f(n),p=o,b=l["".concat(a,".").concat(p)]||l[p]||d[p]||i;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=b;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=t.createContext({}),c=function(e){return function(n){var r=u(n.components);return t.createElement(e,i({},n,{components:r}))}},u=function(e){var n=t.useContext(s),r=n;return e&&(r="function"==typeof e?e(n):p(p({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,f=c["".concat(a,".").concat(d)]||c[d]||m[d]||i;return r?t.createElement(f,p(p({ref:n},s),{},{components:r})):t.createElement(f,p({ref:n},s))}));function h(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var s=2;s=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=t.createContext({}),c=function(e){return function(n){var r=u(n.components);return t.createElement(e,i({},n,{components:r}))}},u=function(e){var n=t.useContext(s),r=n;return e&&(r="function"==typeof e?e(n):p(p({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,f=c["".concat(a,".").concat(d)]||c[d]||m[d]||i;return r?t.createElement(f,p(p({ref:n},s),{},{components:r})):t.createElement(f,p({ref:n},s))}));function h(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var s=2;s=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(l=0;l=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var d=l.createContext({}),s=function(e){return function(n){var a=m(n.components);return l.createElement(e,r({},n,{components:a}))}},m=function(e){var n=l.useContext(d),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},p=function(e){var n=m(e.components);return l.createElement(d.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return l.createElement(l.Fragment,{},n)}},f=l.forwardRef((function(e,n){var a=e.components,t=e.mdxType,r=e.originalType,o=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),s=m(a),p=t,f=s["".concat(o,".").concat(p)]||s[p]||u[p]||r;return a?l.createElement(f,i(i({ref:n},d),{},{components:a})):l.createElement(f,i({ref:n},d))}));function b(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var r=a.length,o=new Array(r);o[0]=f;var i={};for(var c in n)hasOwnProperty.call(n,c)&&(i[c]=n[c]);i.originalType=e,i.mdxType="string"==typeof e?e:t,o[1]=i;for(var d=2;d None:\n """\n Called in RUN mode before job/application code starts. `config` is composed with overrides.\n Some `hydra.runtime` configs are not populated yet.\n See hydra.core.utils.run_job for more info.\n """\n ...\n\n def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in RUN mode after job/application code returns.\n """\n ...\n\n def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in MULTIRUN mode before any job starts.\n When using a launcher, this will be executed on local machine before any Sweeper/Launcher is initialized.\n """\n ...\n\n def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in MULTIRUN mode after all jobs returns.\n When using a launcher, this will be executed on local machine.\n """\n ...\n\n def on_job_start(self, config: DictConfig, *, task_function: TaskFunction, **kwargs: Any) -> None:\n """\n Called in both RUN and MULTIRUN modes, once for each Hydra job (before running application code).\n This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n on the remote server along with your application code. The `task_function` argument is the function\n decorated with `@hydra.main`.\n """\n ...\n\n def on_job_end(\n self, config: DictConfig, job_return: JobReturn, **kwargs: Any\n ) -> None:\n """\n Called in both RUN and MULTIRUN modes, once for each Hydra job (after running\n application code).\n This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n on the remote server after your application code.\n\n `job_return` contains info that could be useful for logging or post-processing.\n See hydra.core.utils.JobReturn for more.\n """\n ...\n'))),(0,r.mdx)("h3",{id:"configure-callback"},"Configure Callback"),(0,r.mdx)("p",null,"Say we have ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback")," so after every job ends we can upload a certain file to a S3 bucket.\nFor simplicity we include this Callback class within the application, in real life you should have the\nCallback in a separate file.\nRunning the application, we can see our custom method ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_end")," was called."),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--9"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py"',title:'"my_app.py"'},'class MyCallback(Callback):\n def __init__(self, bucket: str, file_path: str) -> None:\n self.bucket = bucket\n self.file_path = file_path\n\n def on_job_end(self, config: DictConfig, **kwargs: Any) -> None:\n print(f"Job ended,uploading...")\n # uploading...\n\n@hydra.main(version_base=None, config_path="conf", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,r.mdx)("div",{className:"col col--3"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="output"',title:'"output"'},"\n$ python my_app.py\nfoo: bar\n\nJob ended,uploading...\n\n\n\n\n\n\n\n\n\n\n\n")))),(0,r.mdx)("p",null,"Now let's take a look at the configurations. "),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--4"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="$ tree conf"',title:'"$',tree:!0,'conf"':!0},"conf\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 hydra\n \u2514\u2500\u2500 callbacks\n \u2514\u2500\u2500 my_callback.yaml\n\n\n"))),(0,r.mdx)("div",{className:"col col--3"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - /hydra/callbacks:\n - my_callback\n\nfoo: bar\n\n\n"))),(0,r.mdx)("div",{className:"col col--5"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="conf/hydra/callbacks/my_callback.yaml"',title:'"conf/hydra/callbacks/my_callback.yaml"'},"# @package _global_\nhydra:\n callbacks:\n my_callback:\n _target_: my_app.MyCallback\n bucket: my_s3_bucket\n file_path: ./test.pt\n")))),(0,r.mdx)("h3",{id:"callback-ordering"},"Callback ordering"),(0,r.mdx)("p",null,"The ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_run_start")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_multirun_start")," method will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_start")," (called once for each job).\nAfter each job ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_end")," is called, and finally either ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_run_end")," or\n",(0,r.mdx)("inlineCode",{parentName:"p"},"on_multirun_end")," is called one time before the application exits."),(0,r.mdx)("p",null,"In the ",(0,r.mdx)("inlineCode",{parentName:"p"},"hydra.callbacks")," section of your config, you can use a list to register multiple callbacks. They will be called in the final composed order for ",(0,r.mdx)("inlineCode",{parentName:"p"},"start")," events and\nin reversed order for ",(0,r.mdx)("inlineCode",{parentName:"p"},"end")," events. So, for example, suppose we have the following composed config:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py --cfg hydra -p hydra.callbacks"',title:'"python',"my_app.py":!0,"--cfg":!0,hydra:!0,"-p":!0,'hydra.callbacks"':!0},"# @package hydra.callbacks\nmy_callback1:\n _target_: my_app.MyCallback1\n param1: val1\nmy_callback2:\n _target_: my_app.MyCallback2\n param2: val2\n")),(0,r.mdx)("p",null,"Before each job starts, ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback1.on_job_start")," will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback2.on_job_start"),".\nAfter each job ends, ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback2.on_job_end")," will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback1.on_job_end"),"."),(0,r.mdx)("h3",{id:"example-callbacks"},"Example callbacks"),(0,r.mdx)("p",null,"We've included some example callbacks ",(0,r.mdx)(o.Z,{to:"hydra/experimental/callbacks.py",mdxType:"GithubLink"},"here"),":"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"LogJobReturnCallback")," is especially useful for logging errors when running on a remote cluster (e.g. slurm.) "),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"PickleJobInfoCallback")," can be used to reproduce a Hydra job. See ",(0,r.mdx)("a",{parentName:"li",href:"/docs/experimental/rerun"},"here")," for more.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/18954878.962e6c9f.js b/assets/js/18954878.962e6c9f.js new file mode 100644 index 0000000000..c4bd81f2e2 --- /dev/null +++ b/assets/js/18954878.962e6c9f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7280],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return d},MDXProvider:function(){return p},mdx:function(){return b},useMDXComponents:function(){return m},withMDXComponents:function(){return s}});var t=a(67294);function l(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(l[a]=e[a]);return l}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var d=t.createContext({}),s=function(e){return function(n){var a=m(n.components);return t.createElement(e,r({},n,{components:a}))}},m=function(e){var n=t.useContext(d),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},p=function(e){var n=m(e.components);return t.createElement(d.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var a=e.components,l=e.mdxType,r=e.originalType,o=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),s=m(a),p=l,f=s["".concat(o,".").concat(p)]||s[p]||u[p]||r;return a?t.createElement(f,i(i({ref:n},d),{},{components:a})):t.createElement(f,i({ref:n},d))}));function b(e,n){var a=arguments,l=n&&n.mdxType;if("string"==typeof e||l){var r=a.length,o=new Array(r);o[0]=f;var i={};for(var c in n)hasOwnProperty.call(n,c)&&(i[c]=n[c]);i.originalType=e,i.mdxType="string"==typeof e?e:l,o[1]=i;for(var d=2;d None:\n """\n Called in RUN mode before job/application code starts. `config` is composed with overrides.\n Some `hydra.runtime` configs are not populated yet.\n See hydra.core.utils.run_job for more info.\n """\n ...\n\n def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in RUN mode after job/application code returns.\n """\n ...\n\n def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in MULTIRUN mode before any job starts.\n When using a launcher, this will be executed on local machine before any Sweeper/Launcher is initialized.\n """\n ...\n\n def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:\n """\n Called in MULTIRUN mode after all jobs returns.\n When using a launcher, this will be executed on local machine.\n """\n ...\n\n def on_job_start(self, config: DictConfig, *, task_function: TaskFunction, **kwargs: Any) -> None:\n """\n Called in both RUN and MULTIRUN modes, once for each Hydra job (before running application code).\n This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n on the remote server along with your application code. The `task_function` argument is the function\n decorated with `@hydra.main`.\n """\n ...\n\n def on_job_end(\n self, config: DictConfig, job_return: JobReturn, **kwargs: Any\n ) -> None:\n """\n Called in both RUN and MULTIRUN modes, once for each Hydra job (after running\n application code).\n This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n on the remote server after your application code.\n\n `job_return` contains info that could be useful for logging or post-processing.\n See hydra.core.utils.JobReturn for more.\n """\n ...\n'))),(0,r.mdx)("h3",{id:"configure-callback"},"Configure Callback"),(0,r.mdx)("p",null,"Say we have ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback")," so after every job ends we can upload a certain file to a S3 bucket.\nFor simplicity we include this Callback class within the application, in real life you should have the\nCallback in a separate file.\nRunning the application, we can see our custom method ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_end")," was called."),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--9"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py"',title:'"my_app.py"'},'class MyCallback(Callback):\n def __init__(self, bucket: str, file_path: str) -> None:\n self.bucket = bucket\n self.file_path = file_path\n\n def on_job_end(self, config: DictConfig, **kwargs: Any) -> None:\n print(f"Job ended,uploading...")\n # uploading...\n\n@hydra.main(version_base=None, config_path="conf", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,r.mdx)("div",{className:"col col--3"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="output"',title:'"output"'},"\n$ python my_app.py\nfoo: bar\n\nJob ended,uploading...\n\n\n\n\n\n\n\n\n\n\n\n")))),(0,r.mdx)("p",null,"Now let's take a look at the configurations. "),(0,r.mdx)("div",{className:"row"},(0,r.mdx)("div",{className:"col col--4"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="$ tree conf"',title:'"$',tree:!0,'conf"':!0},"conf\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 hydra\n \u2514\u2500\u2500 callbacks\n \u2514\u2500\u2500 my_callback.yaml\n\n\n"))),(0,r.mdx)("div",{className:"col col--3"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="conf/config.yaml"',title:'"conf/config.yaml"'},"defaults:\n - /hydra/callbacks:\n - my_callback\n\nfoo: bar\n\n\n"))),(0,r.mdx)("div",{className:"col col--5"},(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="conf/hydra/callbacks/my_callback.yaml"',title:'"conf/hydra/callbacks/my_callback.yaml"'},"# @package _global_\nhydra:\n callbacks:\n my_callback:\n _target_: my_app.MyCallback\n bucket: my_s3_bucket\n file_path: ./test.pt\n")))),(0,r.mdx)("h3",{id:"callback-ordering"},"Callback ordering"),(0,r.mdx)("p",null,"The ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_run_start")," or ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_multirun_start")," method will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_start")," (called once for each job).\nAfter each job ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_job_end")," is called, and finally either ",(0,r.mdx)("inlineCode",{parentName:"p"},"on_run_end")," or\n",(0,r.mdx)("inlineCode",{parentName:"p"},"on_multirun_end")," is called one time before the application exits."),(0,r.mdx)("p",null,"In the ",(0,r.mdx)("inlineCode",{parentName:"p"},"hydra.callbacks")," section of your config, you can use a list to register multiple callbacks. They will be called in the final composed order for ",(0,r.mdx)("inlineCode",{parentName:"p"},"start")," events and\nin reversed order for ",(0,r.mdx)("inlineCode",{parentName:"p"},"end")," events. So, for example, suppose we have the following composed config:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py --cfg hydra -p hydra.callbacks"',title:'"python',"my_app.py":!0,"--cfg":!0,hydra:!0,"-p":!0,'hydra.callbacks"':!0},"# @package hydra.callbacks\nmy_callback1:\n _target_: my_app.MyCallback1\n param1: val1\nmy_callback2:\n _target_: my_app.MyCallback2\n param2: val2\n")),(0,r.mdx)("p",null,"Before each job starts, ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback1.on_job_start")," will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback2.on_job_start"),".\nAfter each job ends, ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback2.on_job_end")," will get called first,\nfollowed by ",(0,r.mdx)("inlineCode",{parentName:"p"},"MyCallback1.on_job_end"),"."),(0,r.mdx)("h3",{id:"example-callbacks"},"Example callbacks"),(0,r.mdx)("p",null,"We've included some example callbacks ",(0,r.mdx)(o.Z,{to:"hydra/experimental/callbacks.py",mdxType:"GithubLink"},"here"),":"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"LogJobReturnCallback")," is especially useful for logging errors when running on a remote cluster (e.g. slurm.) "),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"PickleJobInfoCallback")," can be used to reproduce a Hydra job. See ",(0,r.mdx)("a",{parentName:"li",href:"/docs/experimental/rerun"},"here")," for more.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/18d93f34.0ae73cbd.js b/assets/js/18d93f34.0ae73cbd.js deleted file mode 100644 index 7ca290cc18..0000000000 --- a/assets/js/18d93f34.0ae73cbd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6358],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return p},mdx:function(){return h},useMDXComponents:function(){return m},withMDXComponents:function(){return u}});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),u=function(e){return function(n){var t=m(n.components);return o.createElement(e,i({},n,{components:t}))}},m=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return o.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,a=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=m(t),p=r,f=u["".concat(a,".").concat(p)]||u[p]||d[p]||i;return t?o.createElement(f,s(s({ref:n},c),{},{components:t})):o.createElement(f,s({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var c=2;c=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),u=function(e){return function(n){var t=m(n.components);return o.createElement(e,a({},n,{components:t}))}},m=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return o.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=m(t),p=r,f=u["".concat(i,".").concat(p)]||u[p]||d[p]||a;return t?o.createElement(f,s(s({ref:n},c),{},{components:t})):o.createElement(f,s({ref:n},c))}));function y(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){return function(t){var n=s(t.components);return r.createElement(e,i({},t,{components:n}))}},s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=s(n),d=o,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||i;return n?r.createElement(f,c(c({ref:t},l),{},{components:n})):r.createElement(f,c({ref:t},l))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l --hydra-help"),".\nCurrently, Bash and Fish are supported. We are relying on the community to implement completion plugins for additional shells."),(0,i.mdx)("p",null,"Fish support requires version >= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2472],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return m},mdx:function(){return b},useMDXComponents:function(){return s},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){return function(t){var n=s(t.components);return r.createElement(e,i({},t,{components:n}))}},s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},m=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=s(n),m=o,f=p["".concat(a,".").concat(m)]||p[m]||d[m]||i;return n?r.createElement(f,c(c({ref:t},l),{},{components:n})):r.createElement(f,c({ref:t},l))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l --hydra-help"),".\nCurrently, Bash and Fish are supported. We are relying on the community to implement completion plugins for additional shells."),(0,i.mdx)("p",null,"Fish support requires version >= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1c10768b.5b32cf67.js b/assets/js/1c10768b.5b32cf67.js new file mode 100644 index 0000000000..7bc9b22deb --- /dev/null +++ b/assets/js/1c10768b.5b32cf67.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1921],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return p},MDXProvider:function(){return c},mdx:function(){return v},useMDXComponents:function(){return m},withMDXComponents:function(){return d}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=m(n),c=o,f=d["".concat(a,".").concat(c)]||d[c]||u[c]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function v(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var d=r.createContext({}),p=function(e){return function(t){var n=c(t.components);return r.createElement(e,i({},t,{components:n}))}},c=function(e){var t=r.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},m=function(e){var t=c(e.components);return r.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(a,".").concat(m)]||p[m]||u[m]||i;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function v(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var d=2;d=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var d=a.createContext({}),m=function(e){return function(n){var t=u(n.components);return a.createElement(e,i({},n,{components:t}))}},u=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=u(e.components);return a.createElement(d.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,f=m["".concat(o,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(f,l(l({ref:n},d),{},{components:t})):a.createElement(f,l({ref:n},d))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"When you run the updated application, MySQL is loaded by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,i.mdx)("p",null,"You can have multiple items in the defaults list, e.g."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - db: mysql\n - db/mysql/engine: innodb\n")),(0,i.mdx)("p",null,"The defaults are ordered:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If multiple configs define the same value, the last one wins. "),(0,i.mdx)("li",{parentName:"ul"},"If multiple configs contribute to the same dictionary, the result is the combined dictionary.")),(0,i.mdx)("h4",{id:"overriding-a-config-group-default"},"Overriding a config group default"),(0,i.mdx)("p",null,"You can still load PostgreSQL, and override individual values."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,i.mdx)("p",null,"You can remove a default entry from the defaults list by prefixing it with ~:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py ~db\n{}\n")),(0,i.mdx)("h3",{id:"composition-order-of-primary-config"},"Composition order of primary config"),(0,i.mdx)("p",null,"Your primary config can contain both config values and a Defaults List.\nIn such cases, you should add the ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," keyword to your defaults list to specify the composition order of the config file relative to the items in the defaults list."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you want your primary config to override the values of configs from the Defaults List, append ",(0,i.mdx)("inlineCode",{parentName:"li"},"_self_")," to the end of the Defaults List."),(0,i.mdx)("li",{parentName:"ul"},"If you want the configs from the Defaults List to override the values in your primary config, insert ",(0,i.mdx)("inlineCode",{parentName:"li"},"_self_")," as the first item in your Defaults List.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml" {3}',title:'"config.yaml"',"{3}":!0},"defaults:\n - db: mysql\n - _self_\n\ndb:\n user: root\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Result config: db.user from config.yaml" {4}',title:'"Result',"config:":!0,"db.user":!0,from:!0,'config.yaml"':!0,"{4}":!0},"db:\n driver: mysql # db/mysql.yaml\n pass: secret # db/mysql.yaml \n user: root # config.yaml\n\n\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml" {2}',title:'"config.yaml"',"{2}":!0},"defaults:\n - _self_\n - db: mysql\n\ndb:\n user: root\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Result config: All values from db/mysql" {4}',title:'"Result',"config:":!0,All:!0,values:!0,from:!0,'db/mysql"':!0,"{4}":!0},"db:\n driver: mysql # db/mysql.yaml\n pass: secret # db/mysql.yaml\n user: omry # db/mysql.yaml\n\n\n")))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/defaults_list#composition-order"},"Composition Order")," for more information."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The default composition order changed between Hydra 1.0 and Hydra 1.1."),(0,i.mdx)("ul",{parentName:"div"},(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.0"),": Configs from the defaults list are overriding the primary config"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.1"),": A config is overriding the configs from the defaults list.")),(0,i.mdx)("p",{parentName:"div"},"To mitigate confusion, Hydra 1.1 issue a warning if the primary config contains both Default List and Config values, and ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," is not specified in the Defaults List.",(0,i.mdx)("br",{parentName:"p"}),"\n","The warning will disappear if you add ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," to the Defaults List based on the desired behavior."))),(0,i.mdx)("h3",{id:"non-config-group-defaults"},"Non-config group defaults"),(0,i.mdx)("p",null,"Sometimes a config file does not belong in any config group.\nYou can still load it by default. Here is an example for ",(0,i.mdx)("inlineCode",{parentName:"p"},"some_file.yaml"),"."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - some_file\n")),(0,i.mdx)("p",null,"Config files that are not part of a config group will always be loaded. They cannot be overridden.",(0,i.mdx)("br",{parentName:"p"}),"\n","Prefer using a config group."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"For more information about the Defaults List see ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/defaults_list"},"Reference Manual/The Defaults List"),"."))))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1c50c1b8.1bb94a2b.js b/assets/js/1c50c1b8.1bb94a2b.js new file mode 100644 index 0000000000..e694587d1e --- /dev/null +++ b/assets/js/1c50c1b8.1bb94a2b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3259],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return d},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return u},withMDXComponents:function(){return m}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var d=a.createContext({}),m=function(e){return function(n){var t=u(n.components);return a.createElement(e,i({},n,{components:t}))}},u=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=u(e.components);return a.createElement(d.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=u(t),p=r,f=m["".concat(o,".").concat(p)]||m[p]||c[p]||i;return t?a.createElement(f,l(l({ref:n},d),{},{components:t})):a.createElement(f,l({ref:n},d))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"When you run the updated application, MySQL is loaded by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,i.mdx)("p",null,"You can have multiple items in the defaults list, e.g."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - db: mysql\n - db/mysql/engine: innodb\n")),(0,i.mdx)("p",null,"The defaults are ordered:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If multiple configs define the same value, the last one wins. "),(0,i.mdx)("li",{parentName:"ul"},"If multiple configs contribute to the same dictionary, the result is the combined dictionary.")),(0,i.mdx)("h4",{id:"overriding-a-config-group-default"},"Overriding a config group default"),(0,i.mdx)("p",null,"You can still load PostgreSQL, and override individual values."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,i.mdx)("p",null,"You can remove a default entry from the defaults list by prefixing it with ~:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py ~db\n{}\n")),(0,i.mdx)("h3",{id:"composition-order-of-primary-config"},"Composition order of primary config"),(0,i.mdx)("p",null,"Your primary config can contain both config values and a Defaults List.\nIn such cases, you should add the ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," keyword to your defaults list to specify the composition order of the config file relative to the items in the defaults list."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you want your primary config to override the values of configs from the Defaults List, append ",(0,i.mdx)("inlineCode",{parentName:"li"},"_self_")," to the end of the Defaults List."),(0,i.mdx)("li",{parentName:"ul"},"If you want the configs from the Defaults List to override the values in your primary config, insert ",(0,i.mdx)("inlineCode",{parentName:"li"},"_self_")," as the first item in your Defaults List.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml" {3}',title:'"config.yaml"',"{3}":!0},"defaults:\n - db: mysql\n - _self_\n\ndb:\n user: root\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Result config: db.user from config.yaml" {4}',title:'"Result',"config:":!0,"db.user":!0,from:!0,'config.yaml"':!0,"{4}":!0},"db:\n driver: mysql # db/mysql.yaml\n pass: secret # db/mysql.yaml \n user: root # config.yaml\n\n\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml" {2}',title:'"config.yaml"',"{2}":!0},"defaults:\n - _self_\n - db: mysql\n\ndb:\n user: root\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Result config: All values from db/mysql" {4}',title:'"Result',"config:":!0,All:!0,values:!0,from:!0,'db/mysql"':!0,"{4}":!0},"db:\n driver: mysql # db/mysql.yaml\n pass: secret # db/mysql.yaml\n user: omry # db/mysql.yaml\n\n\n")))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/defaults_list#composition-order"},"Composition Order")," for more information."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The default composition order changed between Hydra 1.0 and Hydra 1.1."),(0,i.mdx)("ul",{parentName:"div"},(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.0"),": Configs from the defaults list are overriding the primary config"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.1"),": A config is overriding the configs from the defaults list.")),(0,i.mdx)("p",{parentName:"div"},"To mitigate confusion, Hydra 1.1 issue a warning if the primary config contains both Default List and Config values, and ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," is not specified in the Defaults List.",(0,i.mdx)("br",{parentName:"p"}),"\n","The warning will disappear if you add ",(0,i.mdx)("inlineCode",{parentName:"p"},"_self_")," to the Defaults List based on the desired behavior."))),(0,i.mdx)("h3",{id:"non-config-group-defaults"},"Non-config group defaults"),(0,i.mdx)("p",null,"Sometimes a config file does not belong in any config group.\nYou can still load it by default. Here is an example for ",(0,i.mdx)("inlineCode",{parentName:"p"},"some_file.yaml"),"."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - some_file\n")),(0,i.mdx)("p",null,"Config files that are not part of a config group will always be loaded. They cannot be overridden.",(0,i.mdx)("br",{parentName:"p"}),"\n","Prefer using a config group."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"For more information about the Defaults List see ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/defaults_list"},"Reference Manual/The Defaults List"),"."))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1d831f5a.4e829cea.js b/assets/js/1d831f5a.4e829cea.js new file mode 100644 index 0000000000..d321eb4a6c --- /dev/null +++ b/assets/js/1d831f5a.4e829cea.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4249],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return d},mdx:function(){return f},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=r.createContext({}),s=function(e){return function(n){var t=p(n.components);return r.createElement(e,i({},n,{components:t}))}},p=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(u.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),s=p(t),d=a,h=s["".concat(o,".").concat(d)]||s[d]||m[d]||i;return t?r.createElement(h,l(l({ref:n},u),{},{components:t})):r.createElement(h,l({ref:n},u))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=h;var l={};for(var c in n)hasOwnProperty.call(n,c)&&(l[c]=n[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var u=2;u=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),l=function(e){return function(n){var r=c(n.components);return t.createElement(e,o({},n,{components:r}))}},c=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},m=function(e){var n=c(e.components);return t.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=c(r),m=a,h=l["".concat(i,".").concat(m)]||l[m]||d[m]||o;return r?t.createElement(h,s(s({ref:n},p),{},{components:r})):t.createElement(h,s({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var u in n)hasOwnProperty.call(n,u)&&(s[u]=n[u]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),l=function(e){return function(n){var r=c(n.components);return t.createElement(e,o({},n,{components:r}))}},c=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},m=function(e){var n=c(e.components);return t.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=c(r),m=a,h=l["".concat(i,".").concat(m)]||l[m]||d[m]||o;return r?t.createElement(h,s(s({ref:n},p),{},{components:r})):t.createElement(h,s({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var u in n)hasOwnProperty.call(n,u)&&(s[u]=n[u]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var g=r.createContext({}),c=function(e){return function(n){var t=s(n.components);return r.createElement(e,i({},n,{components:t}))}},s=function(e){var n=r.useContext(g),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=s(e.components);return r.createElement(g.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,g=u(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,p=c["".concat(a,".").concat(m)]||c[m]||d[m]||i;return t?r.createElement(p,l(l({ref:n},g),{},{components:t})):r.createElement(p,l({ref:n},g))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=p;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var g=2;g=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),s=function(e){return function(n){var r=u(n.components);return t.createElement(e,l({},n,{components:r}))}},u=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):a(a({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(c.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,l=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),s=u(r),d=o,m=s["".concat(i,".").concat(d)]||s[d]||g[d]||l;return r?t.createElement(m,a(a({ref:n},c),{},{components:r})):t.createElement(m,a({ref:n},c))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var l=r.length,i=new Array(l);i[0]=m;var a={};for(var p in n)hasOwnProperty.call(n,p)&&(a[p]=n[p]);a.originalType=e,a.mdxType="string"==typeof e?e:o,i[1]=a;for(var c=2;c=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),s=function(e){return function(n){var r=u(n.components);return t.createElement(e,l({},n,{components:r}))}},u=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):a(a({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(c.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,l=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),s=u(r),d=o,m=s["".concat(i,".").concat(d)]||s[d]||g[d]||l;return r?t.createElement(m,a(a({ref:n},c),{},{components:r})):t.createElement(m,a({ref:n},c))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var l=r.length,i=new Array(l);i[0]=m;var a={};for(var p in n)hasOwnProperty.call(n,p)&&(a[p]=n[p]);a.originalType=e,a.mdxType="string"==typeof e?e:o,i[1]=a;for(var c=2;c=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,a({},t,{components:n}))}},m=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=m(e.components);return r.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=m(n),p=o,f=c["".concat(i,".").concat(p)]||c[p]||d[p]||a;return n?r.createElement(f,s(s({ref:t},u),{},{components:n})):r.createElement(f,s({ref:t},u))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var u=2;u=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=d(n),l=o,f=u["".concat(i,".").concat(l)]||u[l]||m[l]||a;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=d(n),l=o,f=u["".concat(i,".").concat(l)]||u[l]||m[l]||a;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),p=function(e){return function(n){var t=m(n.components);return r.createElement(e,i({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},s=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=m(t),s=a,f=p["".concat(o,".").concat(s)]||p[s]||u[s]||i;return t?r.createElement(f,d(d({ref:n},c),{},{components:t})):r.createElement(f,d({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var d={};for(var l in n)hasOwnProperty.call(n,l)&&(d[l]=n[l]);d.originalType=e,d.mdxType="string"==typeof e?e:a,o[1]=d;for(var c=2;ccase 1:",id:"example-for-case-1",children:[{value:"Before",id:"before",children:[],level:4},{value:"After",id:"after",children:[],level:4}],level:3},{value:"Example for case 2:",id:"example-for-case-2",children:[],level:3}],level:2}],m={toc:p};function s(e){var n=e.components,t=(0,a.Z)(e,o);return(0,i.mdx)("wrapper",(0,r.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("h2",{id:"adding-an-package-directive"},"Adding an @package directive"),(0,i.mdx)("p",null,"Hydra 1.0 introduces the concept of a config ",(0,i.mdx)("inlineCode",{parentName:"p"},"package"),". A ",(0,i.mdx)("inlineCode",{parentName:"p"},"package")," is the common parent\npath of all nodes in the config file."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In Hydra 0.11, there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),' ("")'),(0,i.mdx)("li",{parentName:"ul"},"In Hydra 1.1 the default will be ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_")," (the name of the config group)."),(0,i.mdx)("li",{parentName:"ul"},"Hydra 1.0 maintains the implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")," and issues a warning for\nany config group file without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive.")),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to these configs now, you guarantee that your configs\nwill not break when you upgrade to Hydra 1.1."),(0,i.mdx)("p",null,"The ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," directive is described in details ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.1/advanced/overriding_packages"},"here"),". "),(0,i.mdx)("h2",{id:"upgrade-instructions"},"Upgrade instructions:"),(0,i.mdx)("h3",{id:"recommended-10-seconds-per-config-file"},"Recommended (~10 seconds per config file):"),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 1"),": For config files where the common parent path matches the config group name: "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _group_")," to the top of every config group file"),(0,i.mdx)("li",{parentName:"ul"},"Remove the common parent path config file like in the example below.")),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 2"),": For files without a common parent path:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _global_"),".")),(0,i.mdx)("h3",{id:"alternative-not-recommended"},"Alternative (not recommended):"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you do not want to restructure the config at this time use ",(0,i.mdx)("inlineCode",{parentName:"li"},"Case 2")," for all your config files.")),(0,i.mdx)("h3",{id:"example-for-case-1"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 1"),":"),(0,i.mdx)("h4",{id:"before"},"Before"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"db:\n driver: mysql\n host: localhost\n port: 3306\n")),(0,i.mdx)("h4",{id:"after"},"After"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"# @package _group_\ndriver: mysql\nhost: localhost\nport: 3306\n")),(0,i.mdx)("p",null,"The interpretations of the before and after files are identical."),(0,i.mdx)("h3",{id:"example-for-case-2"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 2"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="env/prod.yaml"',title:'"env/prod.yaml"'},"# @package _global_\ndb:\n driver: mysql\n host: 10.0.0.11\n port: 3306\n\nwebserver:\n host: 10.0.0.11\n port: 443\n")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1f4529b5.d6adfa71.js b/assets/js/1f4529b5.d6adfa71.js new file mode 100644 index 0000000000..129601ac12 --- /dev/null +++ b/assets/js/1f4529b5.d6adfa71.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7951],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return s},mdx:function(){return g},useMDXComponents:function(){return m},withMDXComponents:function(){return p}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),p=function(e){return function(n){var t=m(n.components);return r.createElement(e,i({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},s=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=m(t),s=a,f=p["".concat(o,".").concat(s)]||p[s]||u[s]||i;return t?r.createElement(f,d(d({ref:n},c),{},{components:t})):r.createElement(f,d({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var d={};for(var l in n)hasOwnProperty.call(n,l)&&(d[l]=n[l]);d.originalType=e,d.mdxType="string"==typeof e?e:a,o[1]=d;for(var c=2;ccase 1:",id:"example-for-case-1",children:[{value:"Before",id:"before",children:[],level:4},{value:"After",id:"after",children:[],level:4}],level:3},{value:"Example for case 2:",id:"example-for-case-2",children:[],level:3}],level:2}],m={toc:p};function s(e){var n=e.components,t=(0,a.Z)(e,o);return(0,i.mdx)("wrapper",(0,r.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("h2",{id:"adding-an-package-directive"},"Adding an @package directive"),(0,i.mdx)("p",null,"Hydra 1.0 introduces the concept of a config ",(0,i.mdx)("inlineCode",{parentName:"p"},"package"),". A ",(0,i.mdx)("inlineCode",{parentName:"p"},"package")," is the common parent\npath of all nodes in the config file."),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In Hydra 0.11, there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),' ("")'),(0,i.mdx)("li",{parentName:"ul"},"In Hydra 1.1 the default will be ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_")," (the name of the config group)."),(0,i.mdx)("li",{parentName:"ul"},"Hydra 1.0 maintains the implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")," and issues a warning for\nany config group file without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive.")),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to these configs now, you guarantee that your configs\nwill not break when you upgrade to Hydra 1.1."),(0,i.mdx)("p",null,"The ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," directive is described in details ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.1/advanced/overriding_packages"},"here"),". "),(0,i.mdx)("h2",{id:"upgrade-instructions"},"Upgrade instructions:"),(0,i.mdx)("h3",{id:"recommended-10-seconds-per-config-file"},"Recommended (~10 seconds per config file):"),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 1"),": For config files where the common parent path matches the config group name: "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _group_")," to the top of every config group file"),(0,i.mdx)("li",{parentName:"ul"},"Remove the common parent path config file like in the example below.")),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"Case 2"),": For files without a common parent path:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Add ",(0,i.mdx)("inlineCode",{parentName:"li"},"# @package _global_"),".")),(0,i.mdx)("h3",{id:"alternative-not-recommended"},"Alternative (not recommended):"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"If you do not want to restructure the config at this time use ",(0,i.mdx)("inlineCode",{parentName:"li"},"Case 2")," for all your config files.")),(0,i.mdx)("h3",{id:"example-for-case-1"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 1"),":"),(0,i.mdx)("h4",{id:"before"},"Before"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"db:\n driver: mysql\n host: localhost\n port: 3306\n")),(0,i.mdx)("h4",{id:"after"},"After"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"# @package _group_\ndriver: mysql\nhost: localhost\nport: 3306\n")),(0,i.mdx)("p",null,"The interpretations of the before and after files are identical."),(0,i.mdx)("h3",{id:"example-for-case-2"},"Example for ",(0,i.mdx)("inlineCode",{parentName:"h3"},"case 2"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="env/prod.yaml"',title:'"env/prod.yaml"'},"# @package _global_\ndb:\n driver: mysql\n host: 10.0.0.11\n port: 3306\n\nwebserver:\n host: 10.0.0.11\n port: 443\n")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/208d083d.24ae8c46.js b/assets/js/208d083d.24ae8c46.js deleted file mode 100644 index 6eccccd7c9..0000000000 --- a/assets/js/208d083d.24ae8c46.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5868],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return d},mdx:function(){return f},useMDXComponents:function(){return c},withMDXComponents:function(){return p}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=r.createContext({}),p=function(e){return function(n){var t=c(n.components);return r.createElement(e,o({},n,{components:t}))}},c=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},d=function(e){var n=c(e.components);return r.createElement(u.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(t),d=a,h=p["".concat(i,".").concat(d)]||p[d]||m[d]||o;return t?r.createElement(h,s(s({ref:n},u),{},{components:t})):r.createElement(h,s({ref:n},u))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=h;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var u=2;u=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=r.createContext({}),p=function(e){return function(n){var t=c(n.components);return r.createElement(e,o({},n,{components:t}))}},c=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},d=function(e){var n=c(e.components);return r.createElement(u.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(t),d=a,h=p["".concat(i,".").concat(d)]||p[d]||m[d]||o;return t?r.createElement(h,s(s({ref:n},u),{},{components:t})):r.createElement(h,s({ref:n},u))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=h;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var u=2;u=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=p(t),l=o,h=u["".concat(a,".").concat(l)]||u[l]||f[l]||i;return t?n.createElement(h,c(c({ref:r},s),{},{components:t})):n.createElement(h,c({ref:r},s))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=h;var c={};for(var d in r)hasOwnProperty.call(r,d)&&(c[d]=r[d]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= "1.2" (or None),\nor otherwise will use the old behavior and default to ',(0,i.mdx)("inlineCode",{parentName:"p"},"True"),", with a warning being issued if ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," is not set."),(0,i.mdx)("p",null,"If you want to keep the old Hydra behavior, please set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," explicitly for your application."),(0,i.mdx)("p",null,"For more information about ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir"),",\nsee ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/tutorials/basic/running_your_app/working_directory#disable-changing-current-working-dir-to-jobs-output-dir"},"Output/Working directory"),"\nand ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/configure_hydra/job#hydrajobchdir"},"Job Configuration - hydra.job.chdir"),"."))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7303162f.290a5388.js b/assets/js/213609f5.1c7bc203.js similarity index 71% rename from assets/js/7303162f.290a5388.js rename to assets/js/213609f5.1c7bc203.js index 021c4e9b84..3e17e0b8ea 100644 --- a/assets/js/7303162f.290a5388.js +++ b/assets/js/213609f5.1c7bc203.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4894],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return s},MDXProvider:function(){return l},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=p(t),l=o,h=u["".concat(a,".").concat(l)]||u[l]||f[l]||i;return t?n.createElement(h,c(c({ref:r},s),{},{components:t})):n.createElement(h,c({ref:r},s))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=h;var c={};for(var d in r)hasOwnProperty.call(r,d)&&(c[d]=r[d]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= "1.2" (or None),\nor otherwise will use the old behavior and default to ',(0,i.mdx)("inlineCode",{parentName:"p"},"True"),", with a warning being issued if ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," is not set."),(0,i.mdx)("p",null,"If you want to keep the old Hydra behavior, please set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," explicitly for your application."),(0,i.mdx)("p",null,"For more information about ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir"),",\nsee ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/tutorials/basic/running_your_app/working_directory#disable-changing-current-working-dir-to-jobs-output-dir"},"Output/Working directory"),"\nand ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/configure_hydra/job#hydrajobchdir"},"Job Configuration - hydra.job.chdir"),"."))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5529],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return s},MDXProvider:function(){return l},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=p(t),l=o,h=u["".concat(a,".").concat(l)]||u[l]||f[l]||i;return t?n.createElement(h,c(c({ref:r},s),{},{components:t})):n.createElement(h,c({ref:r},s))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=h;var c={};for(var d in r)hasOwnProperty.call(r,d)&&(c[d]=r[d]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= "1.2" (or None),\nor otherwise will use the old behavior and default to ',(0,i.mdx)("inlineCode",{parentName:"p"},"True"),", with a warning being issued if ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," is not set."),(0,i.mdx)("p",null,"If you want to keep the old Hydra behavior, please set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," explicitly for your application."),(0,i.mdx)("p",null,"For more information about ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir"),",\nsee ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/tutorials/basic/running_your_app/working_directory#disable-changing-current-working-dir-to-jobs-output-dir"},"Output/Working directory"),"\nand ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/configure_hydra/job#hydrajobchdir"},"Job Configuration - hydra.job.chdir"),"."))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/215ac4d9.8199d115.js b/assets/js/215ac4d9.8199d115.js deleted file mode 100644 index e395dcbfcd..0000000000 --- a/assets/js/215ac4d9.8199d115.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2397],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return u},MDXProvider:function(){return p},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return c}});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,o({},t,{components:n}))}},m=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=m(e.components);return r.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=m(n),p=a,f=c["".concat(i,".").concat(p)]||c[p]||d[p]||o;return n?r.createElement(f,s(s({ref:t},u),{},{components:n})):r.createElement(f,s({ref:t},u))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var u=2;u=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,o({},t,{components:n}))}},m=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=m(e.components);return r.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=m(n),p=a,f=c["".concat(i,".").concat(p)]||c[p]||d[p]||o;return n?r.createElement(f,s(s({ref:t},u),{},{components:n})):r.createElement(f,s({ref:t},u))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var u=2;u=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=n.createContext({}),m=function(e){return function(a){var t=s(a.components);return n.createElement(e,o({},a,{components:t}))}},s=function(e){var a=n.useContext(c),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},p=function(e){var a=s(e.components);return n.createElement(c.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},g=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),m=s(t),p=r,g=m["".concat(i,".").concat(p)]||m[p]||u[p]||o;return t?n.createElement(g,l(l({ref:a},c),{},{components:t})):n.createElement(g,l({ref:a},c))}));function h(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=g;var l={};for(var d in a)hasOwnProperty.call(a,d)&&(l[d]=a[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=n.createContext({}),m=function(e){return function(a){var t=s(a.components);return n.createElement(e,o({},a,{components:t}))}},s=function(e){var a=n.useContext(c),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},p=function(e){var a=s(e.components);return n.createElement(c.Provider,{value:a},e.children)},u={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},g=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),m=s(t),p=r,g=m["".concat(i,".").concat(p)]||m[p]||u[p]||o;return t?n.createElement(g,l(l({ref:a},c),{},{components:t})):n.createElement(g,l({ref:a},c))}));function h(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=g;var l={};for(var d in a)hasOwnProperty.call(a,d)&&(l[d]=a[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var m=a.createContext({}),d=function(e){return function(n){var t=s(n.components);return a.createElement(e,o({},n,{components:t}))}},s=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=s(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,m=c(e,["components","mdxType","originalType","parentName"]),d=s(t),p=i,f=d["".concat(r,".").concat(p)]||d[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},m),{},{components:t})):a.createElement(f,l({ref:n},m))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var c in n)hasOwnProperty.call(n,c)&&(l[c]=n[c]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var m=2;m DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(config_module: str, job_name: str = "app") -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(config_dir: str, job_name: str = "app") -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2174f925.df7cad4a.js b/assets/js/2174f925.df7cad4a.js new file mode 100644 index 0000000000..c553e1e22b --- /dev/null +++ b/assets/js/2174f925.df7cad4a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5421],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return h},useMDXComponents:function(){return s},withMDXComponents:function(){return d}});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var m=a.createContext({}),d=function(e){return function(n){var t=s(n.components);return a.createElement(e,o({},n,{components:t}))}},s=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=s(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,m=c(e,["components","mdxType","originalType","parentName"]),d=s(t),p=i,f=d["".concat(r,".").concat(p)]||d[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},m),{},{components:t})):a.createElement(f,l({ref:n},m))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var c in n)hasOwnProperty.call(n,c)&&(l[c]=n[c]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var m=2;m DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(config_module: str, job_name: str = "app") -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(config_dir: str, job_name: str = "app") -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21854093.03799f7b.js b/assets/js/21854093.03799f7b.js new file mode 100644 index 0000000000..934eb012ba --- /dev/null +++ b/assets/js/21854093.03799f7b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6884],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,s=m(e,["components","mdxType","originalType","parentName"]),c=p(n),u=r,g=c["".concat(l,".").concat(u)]||c[u]||d[u]||o;return n?a.createElement(g,i(i({ref:t},s),{},{components:n})):a.createElement(g,i({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=g;var i={};for(var m in t)hasOwnProperty.call(t,m)&&(i[m]=t[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(o.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(t),u=r,c=s["".concat(d,".").concat(u)]||s[u]||g[u]||l;return t?a.createElement(c,i(i({ref:n},o),{},{components:t})):a.createElement(c,i({ref:n},o))}));function x(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,d=new Array(l);d[0]=c;var i={};for(var m in n)hasOwnProperty.call(n,m)&&(i[m]=n[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,d[1]=i;for(var o=2;o bool:\n ...\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Calling function"',title:'"Calling','function"':!0},"func(10,foo) # Positional only\nfunc(a=10,b=foo) # Named only\nfunc(10,b=foo) # Mixed\nfunc(a=10,foo) # Error\n")))),(0,l.mdx)("p",null,"Note the lack of quotes in the examples above. Despite some similarities, this is ",(0,l.mdx)("strong",{parentName:"p"},"not Python"),"."),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},"Hydra supports very specific functions. If you would like to have\nanother function added, please file an issue and explain the use case."))),(0,l.mdx)("h2",{id:"sweeps"},"Sweeps"),(0,l.mdx)("p",null,"Sweep overrides are used by Sweepers to determine what to do. For example,\none can instruct the Basic Sweeper to sweep over all combinations of the\nranges ",(0,l.mdx)("inlineCode",{parentName:"p"},"num1=range(0,3)")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"num2=range(0,3)")," - resulting in ",(0,l.mdx)("inlineCode",{parentName:"p"},"9")," jobs, each getting a\ndifferent pair of numbers from ",(0,l.mdx)("inlineCode",{parentName:"p"},"0"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"1")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"2"),"."),(0,l.mdx)("h3",{id:"choice-sweep"},"Choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def choice(\n *args: Union[str, int, float, bool, Dict[Any, Any], List[Any], ChoiceSweep]\n) -> ChoiceSweep:\n """\n A choice sweep over the specified values\n """\n')),(0,l.mdx)("p",null,"Choice sweeps are the most common sweeps.\nA choice sweep is described in one of two equivalent forms."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"db=mysql,postgresql # a comma separated list of two or more elements. \ndb=choice(mysql,postgresql) # choice\n")),(0,l.mdx)("h3",{id:"glob-choice-sweep"},"Glob choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def glob(\n include: Union[List[str], str], exclude: Optional[Union[List[str], str]] = None\n) -> Glob:\n """\n A glob selects from all options in the config group.\n inputs are in glob format. e.g: *, foo*, *foo.\n :param include: a string or a list of strings to use as include globs\n :param exclude: a string or a list of strings to use as exclude globs\n :return: A Glob object\n """\n')),(0,l.mdx)("p",null,"Assuming the config group ",(0,l.mdx)("strong",{parentName:"p"},"schema")," with the options ",(0,l.mdx)("strong",{parentName:"p"},"school"),", ",(0,l.mdx)("strong",{parentName:"p"},"support")," and ",(0,l.mdx)("strong",{parentName:"p"},"warehouse"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"schema=glob(*) # school,support,warehouse\nschema=glob(*,exclude=support) # school,warehouse\nschema=glob([s*,w*],exclude=school) # support,warehouse\n")),(0,l.mdx)("h3",{id:"range-sweep"},"Range sweep"),(0,l.mdx)("p",null,"Unlike Python, Hydra's range can be used with both integer and floating-point numbers.\nIn both cases, the range represents a discrete list of values."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def range(\n start: Union[int, float], stop: Union[int, float], step: Union[int, float] = 1\n) -> RangeSweep:\n """\n Range is defines a sweeep over a range of integer or floating-point values.\n For a positive step, the contents of a range r are determined by the formula\n r[i] = start + step*i where i >= 0 and r[i] < stop.\n For a negative step, the contents of the range are still determined by the formula\n r[i] = start + step*i, but the constraints are i >= 0 and r[i] > stop.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"num=range(0,5) # 0,1,2,3,4\nnum=range(0,5,2) # 0,2,4\nnum=range(0,10,3.3) # 0.0,3.3,6.6,9.9\n")),(0,l.mdx)("h3",{id:"interval-sweep"},"Interval sweep"),(0,l.mdx)("p",null,"An interval sweep represents all the floating point value between two values.\nThis is used by optimizing sweepers like Ax and Nevergrad. The basic sweeper does not support interval."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def interval(start: Union[int, float], end: Union[int, float]) -> IntervalSweep:\n """\n A continuous interval between two floating point values.\n value=interval(x,y) is interpreted as x <= value < y\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"interval(1.0,5.0) # 1.0 <= x < 5.0\ninterval(1,5) # 1.0 <= x < 5.0, auto-cast to floats\n")),(0,l.mdx)("h3",{id:"tag"},"Tag"),(0,l.mdx)("p",null,"With tags you can add arbitrary metadata to a sweep. The metadata can be used by advanced sweepers."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def tag(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None) -> Sweep:\n """\n Tags the sweep with a list of string tags.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"tag(log,interval(0,1)) # 1.0 <= x < 1.0, tags=[log]\ntag(foo,bar,interval(0,1)) # 1.0 <= x < 1.0, tags=[foo,bar]\n")),(0,l.mdx)("h2",{id:"reordering-lists-and-sweeps"},"Reordering lists and sweeps"),(0,l.mdx)("h3",{id:"sort"},"sort"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def sort(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n reverse: bool = False,\n) -> Any:\n """\n Sort an input list or sweep.\n reverse=True reverses the order\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"# sweep\nsort(1,3,2) # ChoiceSweep(1,2,3)\nsort(1,3,2,reverse=true) # ChoiceSweep(3,2,1)\nsort(choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(sweep=choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(choice(1,2,3),reverse=true) # ChoiceSweep(3,2,1)\nsort(range(10,1)) # range in ascending order\nsort(range(1,10),reverse=true) # range in descending order\n\n# lists\nsort([1,3,2]) # [1,2,3]\nsort(list=[1,3,2]) # [1,2,3]\nsort(list=[1,3,2], reverse=true) # [3,2,1]\n\n# single value returned as is\nsort(1) # 1\n")),(0,l.mdx)("h3",{id:"shuffle"},"shuffle"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def shuffle(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n) -> Union[List[Any], ChoiceSweep, RangeSweep]:\n """\n Shuffle input list or sweep (does not support interval)\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"shuffle(a,b,c) # shuffled a,b,c\nshuffle(choice(a,b,c)), shuffle(sweep=choice(a,b,c)) # shuffled choice(a,b,c)\nshuffle(range(1,10)) # shuffled range(1,10)\nshuffle([a,b,c]), shuffle(list=[a,b,c]) # shuffled list [a,b,c] \n")),(0,l.mdx)("h2",{id:"type-casting"},"Type casting"),(0,l.mdx)("p",null,"You can cast values and sweeps to ",(0,l.mdx)("inlineCode",{parentName:"p"},"int"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"float"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"bool")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"str"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example"',title:'"Example"'},"int(3.14) # 3 (int)\nint(value=3.14) # 3 (int)\nfloat(10) # 10.0 (float)\nstr(10) # \"10\" (str)\nbool(1) # true (bool)\nfloat(range(1,10)) # range(1.0,10.0)\nstr([1,2,3]) # ['1','2','3']\nstr({a:10}) # {a:'10'}\n")),(0,l.mdx)("p",null,"Below are pseudo code snippets that illustrates the differences between Python's casting and Hydra's casting."),(0,l.mdx)("h4",{id:"casting-string-to-bool"},"Casting string to bool"),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def bool(value: Any) -> bool:\n if isinstance(value, str):\n return len(value) > 0\n else:\n return bool(value)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},'def bool(s: str) -> bool:\n if isinstance(value, str):\n if value.lower() == "false":\n return False\n elif value.lower() == "true":\n return True\n else:\n raise ValueError()\n return bool(value)\n')))),(0,l.mdx)("h4",{id:"casting-lists"},"Casting lists"),(0,l.mdx)("p",null,"Casting lists results in a list where each element is recursively cast.\nFailure to cast an element in the list fails the cast of the list."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, list):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(v, list):\n return list(map(cast_int, v))\n else:\n return int(v)\n\n\n")))),(0,l.mdx)("h4",{id:"casting-dicts"},"Casting dicts"),(0,l.mdx)("p",null,"Casting dicts results in a dict where values are recursively cast, but keys are unchanged.\nFailure to cast a value in the dict fails the cast of the entire dict."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n return apply_to_values(\n value, cast_int\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h4",{id:"casting-ranges"},"Casting ranges"),(0,l.mdx)("p",null,"Ranges can be cast to float or int, resulting in start, stop and step being cast and thus the range elements being cast."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n raise TypeError()\n else:\n return int(v)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n return RangeSweep(\n start=cast_int(value.start),\n stop=cast_int(value.stop),\n step=cast_int(value.step),\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h3",{id:"conversion-matrix"},"Conversion matrix"),(0,l.mdx)("p",null,"Below is the conversion matrix from various inputs to all supported types.\nInput are grouped by type."),(0,l.mdx)("table",null,(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null}),(0,l.mdx)("th",{parentName:"tr",align:null},"int()"),(0,l.mdx)("th",{parentName:"tr",align:null},"float()"),(0,l.mdx)("th",{parentName:"tr",align:null},"str()"),(0,l.mdx)("th",{parentName:"tr",align:null},"bool()"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018inf\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018nan\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"1,000,000"),(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u20181000000.0\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d (empty string)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"1"),(0,l.mdx)("td",{parentName:"tr",align:null},"1.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0.0,1.0,2.0]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[false,true,true]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1.0,","[2.0]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c1\u201d,","[\u201c2\u201d]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[true,","[true]","]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[a,1]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201ca\u201d,\u201d1\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10.0}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a: true}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0.0,1.0,2.-]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[false,true,true]","}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10,b:xyz}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d,b:\u201dxyz\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0.0,1.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c0\u201d,\u201c1\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(false,true)")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(a,b)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201ca\u201d,\u201db\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(1,a)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c1\u201d,\u201da\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0, 10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21edddaf.ba823e57.js b/assets/js/21edddaf.ba823e57.js new file mode 100644 index 0000000000..f1964947d9 --- /dev/null +++ b/assets/js/21edddaf.ba823e57.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5044],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return o},MDXProvider:function(){return u},mdx:function(){return x},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(o.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(t),u=r,c=s["".concat(d,".").concat(u)]||s[u]||g[u]||l;return t?a.createElement(c,i(i({ref:n},o),{},{components:t})):a.createElement(c,i({ref:n},o))}));function x(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,d=new Array(l);d[0]=c;var i={};for(var m in n)hasOwnProperty.call(n,m)&&(i[m]=n[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,d[1]=i;for(var o=2;o bool:\n ...\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Calling function"',title:'"Calling','function"':!0},"func(10,foo) # Positional only\nfunc(a=10,b=foo) # Named only\nfunc(10,b=foo) # Mixed\nfunc(a=10,foo) # Error\n")))),(0,l.mdx)("p",null,"Note the lack of quotes in the examples above. Despite some similarities, this is ",(0,l.mdx)("strong",{parentName:"p"},"not Python"),"."),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},"Hydra supports very specific functions. If you would like to have\nanother function added, please file an issue and explain the use case."))),(0,l.mdx)("h2",{id:"sweeps"},"Sweeps"),(0,l.mdx)("p",null,"Sweep overrides are used by Sweepers to determine what to do. For example,\none can instruct the Basic Sweeper to sweep over all combinations of the\nranges ",(0,l.mdx)("inlineCode",{parentName:"p"},"num1=range(0,3)")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"num2=range(0,3)")," - resulting in ",(0,l.mdx)("inlineCode",{parentName:"p"},"9")," jobs, each getting a\ndifferent pair of numbers from ",(0,l.mdx)("inlineCode",{parentName:"p"},"0"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"1")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"2"),"."),(0,l.mdx)("h3",{id:"choice-sweep"},"Choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def choice(\n *args: Union[str, int, float, bool, Dict[Any, Any], List[Any], ChoiceSweep]\n) -> ChoiceSweep:\n """\n A choice sweep over the specified values\n """\n')),(0,l.mdx)("p",null,"Choice sweeps are the most common sweeps.\nA choice sweep is described in one of two equivalent forms."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"db=mysql,postgresql # a comma separated list of two or more elements. \ndb=choice(mysql,postgresql) # choice\n")),(0,l.mdx)("h3",{id:"glob-choice-sweep"},"Glob choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def glob(\n include: Union[List[str], str], exclude: Optional[Union[List[str], str]] = None\n) -> Glob:\n """\n A glob selects from all options in the config group.\n inputs are in glob format. e.g: *, foo*, *foo.\n :param include: a string or a list of strings to use as include globs\n :param exclude: a string or a list of strings to use as exclude globs\n :return: A Glob object\n """\n')),(0,l.mdx)("p",null,"Assuming the config group ",(0,l.mdx)("strong",{parentName:"p"},"schema")," with the options ",(0,l.mdx)("strong",{parentName:"p"},"school"),", ",(0,l.mdx)("strong",{parentName:"p"},"support")," and ",(0,l.mdx)("strong",{parentName:"p"},"warehouse"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"schema=glob(*) # school,support,warehouse\nschema=glob(*,exclude=support) # school,warehouse\nschema=glob([s*,w*],exclude=school) # support,warehouse\n")),(0,l.mdx)("h3",{id:"range-sweep"},"Range sweep"),(0,l.mdx)("p",null,"Unlike Python, Hydra's range can be used with both integer and floating-point numbers.\nIn both cases, the range represents a discrete list of values."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def range(\n start: Union[int, float], stop: Union[int, float], step: Union[int, float] = 1\n) -> RangeSweep:\n """\n Range is defines a sweeep over a range of integer or floating-point values.\n For a positive step, the contents of a range r are determined by the formula\n r[i] = start + step*i where i >= 0 and r[i] < stop.\n For a negative step, the contents of the range are still determined by the formula\n r[i] = start + step*i, but the constraints are i >= 0 and r[i] > stop.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"num=range(0,5) # 0,1,2,3,4\nnum=range(0,5,2) # 0,2,4\nnum=range(0,10,3.3) # 0.0,3.3,6.6,9.9\n")),(0,l.mdx)("h3",{id:"interval-sweep"},"Interval sweep"),(0,l.mdx)("p",null,"An interval sweep represents all the floating point value between two values.\nThis is used by optimizing sweepers like Ax and Nevergrad. The basic sweeper does not support interval."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def interval(start: Union[int, float], end: Union[int, float]) -> IntervalSweep:\n """\n A continuous interval between two floating point values.\n value=interval(x,y) is interpreted as x <= value < y\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"interval(1.0,5.0) # 1.0 <= x < 5.0\ninterval(1,5) # 1.0 <= x < 5.0, auto-cast to floats\n")),(0,l.mdx)("h3",{id:"tag"},"Tag"),(0,l.mdx)("p",null,"With tags you can add arbitrary metadata to a sweep. The metadata can be used by advanced sweepers."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def tag(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None) -> Sweep:\n """\n Tags the sweep with a list of string tags.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"tag(log,interval(0,1)) # 1.0 <= x < 1.0, tags=[log]\ntag(foo,bar,interval(0,1)) # 1.0 <= x < 1.0, tags=[foo,bar]\n")),(0,l.mdx)("h2",{id:"reordering-lists-and-sweeps"},"Reordering lists and sweeps"),(0,l.mdx)("h3",{id:"sort"},"sort"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def sort(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n reverse: bool = False,\n) -> Any:\n """\n Sort an input list or sweep.\n reverse=True reverses the order\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"# sweep\nsort(1,3,2) # ChoiceSweep(1,2,3)\nsort(1,3,2,reverse=true) # ChoiceSweep(3,2,1)\nsort(choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(sweep=choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(choice(1,2,3),reverse=true) # ChoiceSweep(3,2,1)\nsort(range(10,1)) # range in ascending order\nsort(range(1,10),reverse=true) # range in descending order\n\n# lists\nsort([1,3,2]) # [1,2,3]\nsort(list=[1,3,2]) # [1,2,3]\nsort(list=[1,3,2], reverse=true) # [3,2,1]\n\n# single value returned as is\nsort(1) # 1\n")),(0,l.mdx)("h3",{id:"shuffle"},"shuffle"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def shuffle(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n) -> Union[List[Any], ChoiceSweep, RangeSweep]:\n """\n Shuffle input list or sweep (does not support interval)\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"shuffle(a,b,c) # shuffled a,b,c\nshuffle(choice(a,b,c)), shuffle(sweep=choice(a,b,c)) # shuffled choice(a,b,c)\nshuffle(range(1,10)) # shuffled range(1,10)\nshuffle([a,b,c]), shuffle(list=[a,b,c]) # shuffled list [a,b,c] \n")),(0,l.mdx)("h2",{id:"type-casting"},"Type casting"),(0,l.mdx)("p",null,"You can cast values and sweeps to ",(0,l.mdx)("inlineCode",{parentName:"p"},"int"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"float"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"bool")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"str"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example"',title:'"Example"'},"int(3.14) # 3 (int)\nint(value=3.14) # 3 (int)\nfloat(10) # 10.0 (float)\nstr(10) # \"10\" (str)\nbool(1) # true (bool)\nfloat(range(1,10)) # range(1.0,10.0)\nstr([1,2,3]) # ['1','2','3']\nstr({a:10}) # {a:'10'}\n")),(0,l.mdx)("p",null,"Below are pseudo code snippets that illustrates the differences between Python's casting and Hydra's casting."),(0,l.mdx)("h4",{id:"casting-string-to-bool"},"Casting string to bool"),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def bool(value: Any) -> bool:\n if isinstance(value, str):\n return len(value) > 0\n else:\n return bool(value)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},'def bool(s: str) -> bool:\n if isinstance(value, str):\n if value.lower() == "false":\n return False\n elif value.lower() == "true":\n return True\n else:\n raise ValueError()\n return bool(value)\n')))),(0,l.mdx)("h4",{id:"casting-lists"},"Casting lists"),(0,l.mdx)("p",null,"Casting lists results in a list where each element is recursively cast.\nFailure to cast an element in the list fails the cast of the list."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, list):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(v, list):\n return list(map(cast_int, v))\n else:\n return int(v)\n\n\n")))),(0,l.mdx)("h4",{id:"casting-dicts"},"Casting dicts"),(0,l.mdx)("p",null,"Casting dicts results in a dict where values are recursively cast, but keys are unchanged.\nFailure to cast a value in the dict fails the cast of the entire dict."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n return apply_to_values(\n value, cast_int\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h4",{id:"casting-ranges"},"Casting ranges"),(0,l.mdx)("p",null,"Ranges can be cast to float or int, resulting in start, stop and step being cast and thus the range elements being cast."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n raise TypeError()\n else:\n return int(v)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n return RangeSweep(\n start=cast_int(value.start),\n stop=cast_int(value.stop),\n step=cast_int(value.step),\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h3",{id:"conversion-matrix"},"Conversion matrix"),(0,l.mdx)("p",null,"Below is the conversion matrix from various inputs to all supported types.\nInput are grouped by type."),(0,l.mdx)("table",null,(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null}),(0,l.mdx)("th",{parentName:"tr",align:null},"int()"),(0,l.mdx)("th",{parentName:"tr",align:null},"float()"),(0,l.mdx)("th",{parentName:"tr",align:null},"str()"),(0,l.mdx)("th",{parentName:"tr",align:null},"bool()"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018inf\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018nan\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"1,000,000"),(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u20181000000.0\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d (empty string)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"1"),(0,l.mdx)("td",{parentName:"tr",align:null},"1.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0.0,1.0,2.0]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[false,true,true]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1.0,","[2.0]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c1\u201d,","[\u201c2\u201d]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[true,","[true]","]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[a,1]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201ca\u201d,\u201d1\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10.0}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a: true}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0.0,1.0,2.-]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[false,true,true]","}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10,b:xyz}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d,b:\u201dxyz\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0.0,1.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c0\u201d,\u201c1\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(false,true)")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(a,b)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201ca\u201d,\u201db\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(1,a)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c1\u201d,\u201da\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0, 10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2205f950.77e41aa3.js b/assets/js/2205f950.77e41aa3.js deleted file mode 100644 index 414aec8403..0000000000 --- a/assets/js/2205f950.77e41aa3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2768],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return s},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),m=function(e){return function(n){var t=c(n.components);return r.createElement(e,i({},n,{components:t}))}},c=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=c(t),u=a,f=m["".concat(o,".").concat(u)]||m[u]||d[u]||i;return t?r.createElement(f,l(l({ref:n},s),{},{components:t})):r.createElement(f,l({ref:n},s))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s None:\n log.info(f"output_dir={HydraConfig.get().runtime.output_dir}")\n log.info(f"cfg.foo={cfg.foo}")\n')),(0,i.mdx)("p",null,"Run the example app:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py\n[2022-03-16 14:51:30,905][hydra.experimental.pickle_job_info_callback][INFO] - Saving job configs in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/config.pickle\n[2022-03-16 14:51:30,906][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:51:30,906][__main__][INFO] - cfg.foo=bar\n[2022-03-16 14:51:30,906][hydra.experimental.pickle_job_info_callback][INFO] - Saving job_return in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/job_return.pickle\n")),(0,i.mdx)("p",null,"The Callback saves ",(0,i.mdx)("inlineCode",{parentName:"p"},"config.pickle")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," sub dir, this is what we will use for rerun."),(0,i.mdx)("p",null,"Now rerun the app"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ OUTPUT_DIR=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/\n$ python my_app.py --experimental-rerun $OUTPUT_DIR/config.pickle\n/Users/jieru/workspace/hydra/hydra/main.py:23: UserWarning: Experimental rerun CLI option.\n warnings.warn(msg, UserWarning)\n[2022-03-16 14:59:21,666][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:59:21,666][__main__][INFO] - cfg.foo=bar\n")),(0,i.mdx)("p",null,"You will notice ",(0,i.mdx)("inlineCode",{parentName:"p"},"my_app.log")," is updated with the logging from the second run, but Callbacks are not called this time. Read on to learn more."),(0,i.mdx)("h3",{id:"important-notes"},"Important Notes"),(0,i.mdx)("p",null,"This is an experimental feature. Please reach out if you have any question. "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Only single run is supported."),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"--experimental-rerun")," cannot be used with other command-line options or overrides. They will simply be ignored."),(0,i.mdx)("li",{parentName:"ul"},"Rerun passes in a cfg_passthrough directly to your application, this means except for logging, no other ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main"),"\nfunctions are called (such as change working dir, or calling callbacks.) "),(0,i.mdx)("li",{parentName:"ul"},"The configs are preserved and reconstructed to the best efforts. Meaning we can only guarantee that the ",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg")," object\nitself passed in by ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main")," stays the same across runs. However, configs are resolved lazily. Meaning we cannot\nguarantee your application will behave the same if your application resolves configs during run time. In the following example,\n",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg.time_now")," will resolve to different value every run.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--5"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"time_now: ${now:%H-%M-%S}\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--7"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example function"',title:'"Example','function"':!0},'@hydra.main(version_base=None, config_path=".", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n val = cfg.time_now\n # the rest of the application\n')))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a4b398d.24d71bf2.js b/assets/js/2205f950.b768e25f.js similarity index 78% rename from assets/js/0a4b398d.24d71bf2.js rename to assets/js/2205f950.b768e25f.js index 5b24b5d9dd..6b72b7f37e 100644 --- a/assets/js/0a4b398d.24d71bf2.js +++ b/assets/js/2205f950.b768e25f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7086],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return s}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var m=r.createContext({}),s=function(e){return function(n){var t=c(n.components);return r.createElement(e,i({},n,{components:t}))}},c=function(e){var n=r.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(m.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),s=c(t),u=a,f=s["".concat(o,".").concat(u)]||s[u]||d[u]||i;return t?r.createElement(f,l(l({ref:n},m),{},{components:t})):r.createElement(f,l({ref:n},m))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m None:\n log.info(f"output_dir={HydraConfig.get().runtime.output_dir}")\n log.info(f"cfg.foo={cfg.foo}")\n')),(0,i.mdx)("p",null,"Run the example app:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py\n[2022-03-16 14:51:30,905][hydra.experimental.pickle_job_info_callback][INFO] - Saving job configs in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/config.pickle\n[2022-03-16 14:51:30,906][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:51:30,906][__main__][INFO] - cfg.foo=bar\n[2022-03-16 14:51:30,906][hydra.experimental.pickle_job_info_callback][INFO] - Saving job_return in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/job_return.pickle\n")),(0,i.mdx)("p",null,"The Callback saves ",(0,i.mdx)("inlineCode",{parentName:"p"},"config.pickle")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," sub dir, this is what we will use for rerun."),(0,i.mdx)("p",null,"Now rerun the app"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ OUTPUT_DIR=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/\n$ python my_app.py --experimental-rerun $OUTPUT_DIR/config.pickle\n/Users/jieru/workspace/hydra/hydra/main.py:23: UserWarning: Experimental rerun CLI option.\n warnings.warn(msg, UserWarning)\n[2022-03-16 14:59:21,666][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:59:21,666][__main__][INFO] - cfg.foo=bar\n")),(0,i.mdx)("p",null,"You will notice ",(0,i.mdx)("inlineCode",{parentName:"p"},"my_app.log")," is updated with the logging from the second run, but Callbacks are not called this time. Read on to learn more."),(0,i.mdx)("h3",{id:"important-notes"},"Important Notes"),(0,i.mdx)("p",null,"This is an experimental feature. Please reach out if you have any question. "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Only single run is supported."),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"--experimental-rerun")," cannot be used with other command-line options or overrides. They will simply be ignored."),(0,i.mdx)("li",{parentName:"ul"},"Rerun passes in a cfg_passthrough directly to your application, this means except for logging, no other ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main"),"\nfunctions are called (such as change working dir, or calling callbacks.) "),(0,i.mdx)("li",{parentName:"ul"},"The configs are preserved and reconstructed to the best efforts. Meaning we can only guarantee that the ",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg")," object\nitself passed in by ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main")," stays the same across runs. However, configs are resolved lazily. Meaning we cannot\nguarantee your application will behave the same if your application resolves configs during run time. In the following example,\n",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg.time_now")," will resolve to different value every run.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--5"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"time_now: ${now:%H-%M-%S}\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--7"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example function"',title:'"Example','function"':!0},'@hydra.main(version_base=None, config_path=".", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n val = cfg.time_now\n # the rest of the application\n')))))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2768],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return s},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),m=function(e){return function(n){var t=c(n.components);return r.createElement(e,i({},n,{components:t}))}},c=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=c(t),u=a,f=m["".concat(o,".").concat(u)]||m[u]||d[u]||i;return t?r.createElement(f,l(l({ref:n},s),{},{components:t})):r.createElement(f,l({ref:n},s))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=f;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s None:\n log.info(f"output_dir={HydraConfig.get().runtime.output_dir}")\n log.info(f"cfg.foo={cfg.foo}")\n')),(0,i.mdx)("p",null,"Run the example app:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py\n[2022-03-16 14:51:30,905][hydra.experimental.pickle_job_info_callback][INFO] - Saving job configs in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/config.pickle\n[2022-03-16 14:51:30,906][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:51:30,906][__main__][INFO] - cfg.foo=bar\n[2022-03-16 14:51:30,906][hydra.experimental.pickle_job_info_callback][INFO] - Saving job_return in /Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/job_return.pickle\n")),(0,i.mdx)("p",null,"The Callback saves ",(0,i.mdx)("inlineCode",{parentName:"p"},"config.pickle")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," sub dir, this is what we will use for rerun."),(0,i.mdx)("p",null,"Now rerun the app"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ OUTPUT_DIR=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30/.hydra/\n$ python my_app.py --experimental-rerun $OUTPUT_DIR/config.pickle\n/Users/jieru/workspace/hydra/hydra/main.py:23: UserWarning: Experimental rerun CLI option.\n warnings.warn(msg, UserWarning)\n[2022-03-16 14:59:21,666][__main__][INFO] - Output_dir=/Users/jieru/workspace/hydra/examples/experimental/outputs/2022-03-16/14-51-30\n[2022-03-16 14:59:21,666][__main__][INFO] - cfg.foo=bar\n")),(0,i.mdx)("p",null,"You will notice ",(0,i.mdx)("inlineCode",{parentName:"p"},"my_app.log")," is updated with the logging from the second run, but Callbacks are not called this time. Read on to learn more."),(0,i.mdx)("h3",{id:"important-notes"},"Important Notes"),(0,i.mdx)("p",null,"This is an experimental feature. Please reach out if you have any question. "),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"Only single run is supported."),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"--experimental-rerun")," cannot be used with other command-line options or overrides. They will simply be ignored."),(0,i.mdx)("li",{parentName:"ul"},"Rerun passes in a cfg_passthrough directly to your application, this means except for logging, no other ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main"),"\nfunctions are called (such as change working dir, or calling callbacks.) "),(0,i.mdx)("li",{parentName:"ul"},"The configs are preserved and reconstructed to the best efforts. Meaning we can only guarantee that the ",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg")," object\nitself passed in by ",(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.main")," stays the same across runs. However, configs are resolved lazily. Meaning we cannot\nguarantee your application will behave the same if your application resolves configs during run time. In the following example,\n",(0,i.mdx)("inlineCode",{parentName:"li"},"cfg.time_now")," will resolve to different value every run.")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--5"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"time_now: ${now:%H-%M-%S}\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--7"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example function"',title:'"Example','function"':!0},'@hydra.main(version_base=None, config_path=".", config_name="config")\ndef my_app(cfg: DictConfig) -> None:\n val = cfg.time_now\n # the rest of the application\n')))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/22abb723.ff0ed002.js b/assets/js/22abb723.7a26085b.js similarity index 62% rename from assets/js/22abb723.ff0ed002.js rename to assets/js/22abb723.7a26085b.js index 91c56c7b3b..7f397ec906 100644 --- a/assets/js/22abb723.ff0ed002.js +++ b/assets/js/22abb723.7a26085b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7253],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return l},MDXProvider:function(){return f},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),u=function(e){return function(n){var t=p(n.components);return r.createElement(e,i({},n,{components:t}))}},p=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},f=function(e){var n=p(e.components);return r.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,d=u["".concat(a,".").concat(f)]||u[f]||m[f]||i;return t?r.createElement(d,c(c({ref:n},l),{},{components:t})):r.createElement(d,c({ref:n},l))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var c={};for(var s in n)hasOwnProperty.call(n,s)&&(c[s]=n[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),u=function(e){return function(n){var t=p(n.components);return r.createElement(e,i({},n,{components:t}))}},p=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},f=function(e){var n=p(e.components);return r.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,d=u["".concat(a,".").concat(f)]||u[f]||m[f]||i;return t?r.createElement(d,c(c({ref:n},l),{},{components:t})):r.createElement(d,c({ref:n},l))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var c={};for(var s in n)hasOwnProperty.call(n,s)&&(c[s]=n[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=d(t.components);return r.createElement(e,i({},t,{components:n}))}},d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=d(n),u=o,m=p["".concat(a,".").concat(u)]||p[u]||f[u]||i;return n?r.createElement(m,c(c({ref:t},s),{},{components:n})):r.createElement(m,c({ref:t},s))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s None:\n print(cfg)\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-shell",metastring:'script title="Output"',script:!0,title:'"Output"'},"$ python frozen.py data_bits=10\nError merging override data_bits=10\nCannot change read-only config container\n full_key: data_bits\n reference_type=Optional[SerialPort]\n object_type=SerialPort\n")))),(0,i.mdx)("div",{class:"alert alert--warning",role:"alert"},(0,i.mdx)("strong",null,"NOTE"),": A crafty user can find many ways around this. this is just making it harder to change things accidentally."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7040],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=d(t.components);return r.createElement(e,i({},t,{components:n}))}},d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=d(n),u=o,m=p["".concat(a,".").concat(u)]||p[u]||f[u]||i;return n?r.createElement(m,c(c({ref:t},s),{},{components:n})):r.createElement(m,c({ref:t},s))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s None:\n print(cfg)\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-shell",metastring:'script title="Output"',script:!0,title:'"Output"'},"$ python frozen.py data_bits=10\nError merging override data_bits=10\nCannot change read-only config container\n full_key: data_bits\n reference_type=Optional[SerialPort]\n object_type=SerialPort\n")))),(0,i.mdx)("div",{class:"alert alert--warning",role:"alert"},(0,i.mdx)("strong",null,"NOTE"),": A crafty user can find many ways around this. this is just making it harder to change things accidentally."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/240de8c7.1f2f385f.js b/assets/js/240de8c7.1f2f385f.js new file mode 100644 index 0000000000..ee4c9cb8ad --- /dev/null +++ b/assets/js/240de8c7.1f2f385f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1257],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return p},MDXProvider:function(){return m},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return c}});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=o.createContext({}),c=function(e){return function(n){var t=d(n.components);return o.createElement(e,a({},n,{components:t}))}},d=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},m=function(e){var n=d(e.components);return o.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||a;return t?o.createElement(f,s(s({ref:n},p),{},{components:t})):o.createElement(f,s({ref:n},p))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var p=2;p None:\n """\n Stores a config node into the repository\n :param name: config name\n :param node: config node, can be DictConfig, ListConfig,\n Structured configs and even dict and list\n :param group: config group, subgroup separator is \'/\',\n for example hydra/launcher\n :param package: Config node parent hierarchy.\n Child separator is \'.\', for example foo.bar.baz\n :param provider: the name of the module/app providing this config.\n Helps debugging.\n """\n ...\n')),(0,a.mdx)("h3",{id:"configstore-and-yaml-input-configs"},"ConfigStore and YAML input configs"),(0,a.mdx)("p",null,(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," has feature parity with YAML input configs. On top of that, it also provides typing validation.\n",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," can be used alone or together with YAML. We will see more examples later in this series of tutorials.\nFor now, let's see how the ",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," API translates into the YAML input configs, which we've become more familiar\nwith after the basic tutorials."),(0,a.mdx)("p",null,"Say we have a simple application and a ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," config group with a ",(0,a.mdx)("inlineCode",{parentName:"p"},"mysql")," option:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--5"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py"',title:'"my_app.py"'},'@hydra.main(version_base=None, config_path="conf")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,a.mdx)("div",{className:"col col--4"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Directory layout"',title:'"Directory','layout"':!0},"\u251c\u2500 conf\n\u2502 \u2514\u2500 db\n\u2502 \u2514\u2500 mysql.yaml\n\u2514\u2500\u2500 my_app.py\n\n\n\n"))),(0,a.mdx)("div",{className:"col col--3"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"driver: mysql\nuser: omry\npassword: secret\n\n\n\n\n")))),(0,a.mdx)("p",null,"What if we want to add an ",(0,a.mdx)("inlineCode",{parentName:"p"},"postgresql")," option now? Yes, we can easily add a ",(0,a.mdx)("inlineCode",{parentName:"p"},"db/postgresql.yaml")," config group option. But\nthat is not the only way! We can also use ",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," to make another config group option for ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," available to Hydra."),(0,a.mdx)("p",null,"To achieve this, we add a few lines (highlighted) in the above ",(0,a.mdx)("inlineCode",{parentName:"p"},"my_app.py")," file:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py" {1-9}',title:'"my_app.py"',"{1-9}":!0},'@dataclass\nclass PostgresSQLConfig:\n driver: str = "postgresql"\n user: str = "jieru"\n password: str = "secret"\n\ncs = ConfigStore.instance()\n# Registering the Config class with the name `postgresql` with the config group `db`\ncs.store(name="postgresql", group="db", node=PostgresSQLConfig)\n\n@hydra.main(version_base=None, config_path="conf")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("p",null,"Now that our application has access to both ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," config group options, let's run the application to verify:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py +db=mysql"',title:'"python',"my_app.py":!0,"+db":'mysql"'},"db:\n driver: mysql\n user: omry\n password: secret\n\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py +db=postgresql"',title:'"python',"my_app.py":!0,"+db":'postgresql"'},"db:\n driver: postgresql\n user: jieru\n password: secret\n\n")))),(0,a.mdx)("h3",{id:"example-node-values"},"Example node values"),(0,a.mdx)("p",null,"A few examples of supported node values parameters:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\n\nfrom hydra.core.config_store import ConfigStore\n\n@dataclass\nclass MySQLConfig:\n host: str = "localhost"\n port: int = 3306\n\ncs = ConfigStore.instance()\n\n# Using the type\ncs.store(name="config1", node=MySQLConfig)\n# Using an instance, overriding some default values\ncs.store(name="config2", node=MySQLConfig(host="test.db", port=3307))\n# Using a dictionary, forfeiting runtime type safety\ncs.store(name="config3", node={"host": "localhost", "port": 3308})\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/240de8c7.be5922a1.js b/assets/js/240de8c7.be5922a1.js deleted file mode 100644 index f95ed8cbb9..0000000000 --- a/assets/js/240de8c7.be5922a1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1257],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return p},MDXProvider:function(){return m},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return c}});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=o.createContext({}),c=function(e){return function(n){var t=d(n.components);return o.createElement(e,a({},n,{components:t}))}},d=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},m=function(e){var n=d(e.components);return o.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||a;return t?o.createElement(f,s(s({ref:n},p),{},{components:t})):o.createElement(f,s({ref:n},p))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var p=2;p None:\n """\n Stores a config node into the repository\n :param name: config name\n :param node: config node, can be DictConfig, ListConfig,\n Structured configs and even dict and list\n :param group: config group, subgroup separator is \'/\',\n for example hydra/launcher\n :param package: Config node parent hierarchy.\n Child separator is \'.\', for example foo.bar.baz\n :param provider: the name of the module/app providing this config.\n Helps debugging.\n """\n ...\n')),(0,a.mdx)("h3",{id:"configstore-and-yaml-input-configs"},"ConfigStore and YAML input configs"),(0,a.mdx)("p",null,(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," has feature parity with YAML input configs. On top of that, it also provides typing validation.\n",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," can be used alone or together with YAML. We will see more examples later in this series of tutorials.\nFor now, let's see how the ",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," API translates into the YAML input configs, which we've become more familiar\nwith after the basic tutorials."),(0,a.mdx)("p",null,"Say we have a simple application and a ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," config group with a ",(0,a.mdx)("inlineCode",{parentName:"p"},"mysql")," option:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--5"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py"',title:'"my_app.py"'},'@hydra.main(version_base=None, config_path="conf")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n'))),(0,a.mdx)("div",{className:"col col--4"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Directory layout"',title:'"Directory','layout"':!0},"\u251c\u2500 conf\n\u2502 \u2514\u2500 db\n\u2502 \u2514\u2500 mysql.yaml\n\u2514\u2500\u2500 my_app.py\n\n\n\n"))),(0,a.mdx)("div",{className:"col col--3"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml"',title:'"db/mysql.yaml"'},"driver: mysql\nuser: omry\npassword: secret\n\n\n\n\n")))),(0,a.mdx)("p",null,"What if we want to add an ",(0,a.mdx)("inlineCode",{parentName:"p"},"postgresql")," option now? Yes, we can easily add a ",(0,a.mdx)("inlineCode",{parentName:"p"},"db/postgresql.yaml")," config group option. But\nthat is not the only way! We can also use ",(0,a.mdx)("inlineCode",{parentName:"p"},"ConfigStore")," to make another config group option for ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," available to Hydra."),(0,a.mdx)("p",null,"To achieve this, we add a few lines (highlighted) in the above ",(0,a.mdx)("inlineCode",{parentName:"p"},"my_app.py")," file:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="my_app.py" {1-9}',title:'"my_app.py"',"{1-9}":!0},'@dataclass\nclass PostgresSQLConfig:\n driver: str = "postgresql"\n user: str = "jieru"\n password: str = "secret"\n\ncs = ConfigStore.instance()\n# Registering the Config class with the name `postgresql` with the config group `db`\ncs.store(name="postgresql", group="db", node=PostgresSQLConfig)\n\n@hydra.main(version_base=None, config_path="conf")\ndef my_app(cfg: DictConfig) -> None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("p",null,"Now that our application has access to both ",(0,a.mdx)("inlineCode",{parentName:"p"},"db")," config group options, let's run the application to verify:"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py +db=mysql"',title:'"python',"my_app.py":!0,"+db":'mysql"'},"db:\n driver: mysql\n user: omry\n password: secret\n\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-commandline",metastring:'title="python my_app.py +db=postgresql"',title:'"python',"my_app.py":!0,"+db":'postgresql"'},"db:\n driver: postgresql\n user: jieru\n password: secret\n\n")))),(0,a.mdx)("h3",{id:"example-node-values"},"Example node values"),(0,a.mdx)("p",null,"A few examples of supported node values parameters:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-python"},'from dataclasses import dataclass\n\nfrom hydra.core.config_store import ConfigStore\n\n@dataclass\nclass MySQLConfig:\n host: str = "localhost"\n port: int = 3306\n\ncs = ConfigStore.instance()\n\n# Using the type\ncs.store(name="config1", node=MySQLConfig)\n# Using an instance, overriding some default values\ncs.store(name="config2", node=MySQLConfig(host="test.db", port=3307))\n# Using a dictionary, forfeiting runtime type safety\ncs.store(name="config3", node={"host": "localhost", "port": 3308})\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/25a59092.92103ef2.js b/assets/js/25a59092.dc3ffbd4.js similarity index 58% rename from assets/js/25a59092.92103ef2.js rename to assets/js/25a59092.dc3ffbd4.js index 1d8ab62bc8..dcc090c5de 100644 --- a/assets/js/25a59092.92103ef2.js +++ b/assets/js/25a59092.dc3ffbd4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1908],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=u(t.components);return r.createElement(e,i({},t,{components:n}))}},u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=u(n),d=o,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||i;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."),(0,i.mdx)("p",null,"Because the fish shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."),(0,i.mdx)("h4",{id:"zsh-instructions"},"Zsh instructions"),(0,i.mdx)("p",null,"Zsh is compatible with the existing Bash shell completion by appending"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"autoload -Uz bashcompinit && bashcompinit\n")),(0,i.mdx)("p",null,"to the ",(0,i.mdx)("inlineCode",{parentName:"p"},".zshrc")," file after ",(0,i.mdx)("inlineCode",{parentName:"p"},"compinit"),", restarting the shell and then using the commands provided for Bash."),(0,i.mdx)("p",null,"Because the zsh shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1908],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return d},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return p}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){return function(t){var n=u(t.components);return r.createElement(e,i({},t,{components:n}))}},u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=u(n),d=o,f=p["".concat(a,".").concat(d)]||p[d]||m[d]||i;return n?r.createElement(f,c(c({ref:t},s),{},{components:n})):r.createElement(f,c({ref:t},s))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s= 3.1.2.\nPrevious versions will work but add an extra space after ",(0,i.mdx)("inlineCode",{parentName:"p"},"."),"."),(0,i.mdx)("p",null,"Because the fish shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."),(0,i.mdx)("h4",{id:"zsh-instructions"},"Zsh instructions"),(0,i.mdx)("p",null,"Zsh is compatible with the existing Bash shell completion by appending"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"autoload -Uz bashcompinit && bashcompinit\n")),(0,i.mdx)("p",null,"to the ",(0,i.mdx)("inlineCode",{parentName:"p"},".zshrc")," file after ",(0,i.mdx)("inlineCode",{parentName:"p"},"compinit"),", restarting the shell and then using the commands provided for Bash."),(0,i.mdx)("p",null,"Because the zsh shell implements special behavior for expanding words prefixed\nwith a tilde character '~', command-line completion does not work for\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic#modifying-the-defaults-list"},"tilde deletions"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2682ecde.1c0c75d6.js b/assets/js/2682ecde.1c0c75d6.js deleted file mode 100644 index 8a10a2621f..0000000000 --- a/assets/js/2682ecde.1c0c75d6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4500],{3905:function(e,n,r){r.r(n),r.d(n,{MDXContext:function(){return p},MDXProvider:function(){return c},mdx:function(){return f},useMDXComponents:function(){return d},withMDXComponents:function(){return s}});var t=r(67294);function a(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=d(n.components);return t.createElement(e,i({},n,{components:r}))}},d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(r),c=a,h=s["".concat(l,".").concat(c)]||s[c]||m[c]||i;return r?t.createElement(h,o(o({ref:n},p),{},{components:r})):t.createElement(h,o({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=h;var o={};for(var u in n)hasOwnProperty.call(n,u)&&(o[u]=n[u]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=d(n.components);return t.createElement(e,i({},n,{components:r}))}},d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(r),c=a,h=s["".concat(l,".").concat(c)]||s[c]||m[c]||i;return r?t.createElement(h,o(o({ref:n},p),{},{components:r})):t.createElement(h,o({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=h;var o={};for(var u in n)hasOwnProperty.call(n,u)&&(o[u]=n[u]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),s=function(e){return function(t){var n=d(t.components);return r.createElement(e,i({},t,{components:n}))}},d=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(u.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),s=d(n),p=o,f=s["".concat(l,".").concat(p)]||s[p]||m[p]||i;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var u=2;u=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),d=function(e){return function(t){var n=s(t.components);return r.createElement(e,i({},t,{components:n}))}},s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=s(n),p=o,f=d["".concat(l,".").concat(p)]||d[p]||m[p]||i;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var u=2;u=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=m(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=m(n),d=a,f=c["".concat(o,".").concat(d)]||c[d]||u[d]||i;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"In this example, Hydra creates an empty ",(0,i.mdx)("inlineCode",{parentName:"p"},"cfg")," object and passes it to the function annotated with ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main"),"."),(0,i.mdx)("p",null,"You can add config values via the command line. The ",(0,i.mdx)("inlineCode",{parentName:"p"},"+")," indicates that the field is new."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db.driver=mysql +db.user=omry +db.password=secret\ndb:\n driver: mysql\n user: omry\n password: secret\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/upgrades/version_base"},"version_base page")," for details on the version_base parameter."))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/hydra-command-line-flags"},"Hydra's command line flags")," and\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic"},"Basic Override Syntax")," for more information about the command line."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[922],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return d},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return c}});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=m(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=m(n),d=a,f=c["".concat(o,".").concat(d)]||c[d]||u[d]||i;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"In this example, Hydra creates an empty ",(0,i.mdx)("inlineCode",{parentName:"p"},"cfg")," object and passes it to the function annotated with ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main"),"."),(0,i.mdx)("p",null,"You can add config values via the command line. The ",(0,i.mdx)("inlineCode",{parentName:"p"},"+")," indicates that the field is new."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db.driver=mysql +db.user=omry +db.password=secret\ndb:\n driver: mysql\n user: omry\n password: secret\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/upgrades/version_base"},"version_base page")," for details on the version_base parameter."))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/hydra-command-line-flags"},"Hydra's command line flags")," and\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/basic"},"Basic Override Syntax")," for more information about the command line."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/27f5d38d.2ecff687.js b/assets/js/27f5d38d.2ecff687.js deleted file mode 100644 index 902a496b8c..0000000000 --- a/assets/js/27f5d38d.2ecff687.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[504],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return d},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return p},withMDXComponents:function(){return c}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var d=n.createContext({}),c=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(d),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},m=function(e){var r=p(e.components);return n.createElement(d.Provider,{value:r},e.children)},s={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,d=u(e,["components","mdxType","originalType","parentName"]),c=p(t),m=o,y=c["".concat(a,".").concat(m)]||c[m]||s[m]||i;return t?n.createElement(y,l(l({ref:r},d),{},{components:t})):n.createElement(y,l({ref:r},d))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var l={};for(var u in r)hasOwnProperty.call(r,u)&&(l[u]=r[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var d=2;d=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var d=n.createContext({}),c=function(e){return function(r){var t=p(r.components);return n.createElement(e,i({},r,{components:t}))}},p=function(e){var r=n.useContext(d),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},m=function(e){var r=p(e.components);return n.createElement(d.Provider,{value:r},e.children)},s={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,d=u(e,["components","mdxType","originalType","parentName"]),c=p(t),m=o,y=c["".concat(a,".").concat(m)]||c[m]||s[m]||i;return t?n.createElement(y,l(l({ref:r},d),{},{components:t})):n.createElement(y,l({ref:r},d))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var l={};for(var u in r)hasOwnProperty.call(r,u)&&(l[u]=r[u]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var d=2;d=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),p=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):l(l({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(a),u=r,h=p["".concat(o,".").concat(u)]||p[u]||c[u]||i;return a?t.createElement(h,l(l({ref:n},m),{},{components:a})):t.createElement(h,l({ref:n},m))}));function f(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=h;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var m=2;mhydra.mode (new in Hydra 1.2)",id:"configure-hydramode-new-in-hydra-12",children:[],level:3},{value:"--multirun (-m) from the command-line",id:"--multirun--m-from-the-command-line",children:[],level:3},{value:"Sweeping via hydra.sweeper.params",id:"sweeping-via-hydrasweeperparams",children:[],level:3},{value:"Additional sweep types",id:"additional-sweep-types",children:[],level:3},{value:"Sweeper",id:"sweeper",children:[],level:3},{value:"Launcher",id:"launcher",children:[],level:3}],u={toc:s};function c(e){var n=e.components,a=(0,r.Z)(e,l);return(0,i.mdx)("wrapper",(0,t.Z)({},u,a,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,"Sometimes you want to run the same application with multiple different configurations.",(0,i.mdx)("br",{parentName:"p"}),"\n","E.g. running a performance test on each of the databases with each of the schemas."),(0,i.mdx)("p",null,"You can multirun a Hydra application via either commandline or configuration:"),(0,i.mdx)("h3",{id:"configure-hydramode-new-in-hydra-12"},"Configure ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.mode")," (new in Hydra 1.2)"),(0,i.mdx)("p",null,"You can configure ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," in any supported way. The legal values are ",(0,i.mdx)("inlineCode",{parentName:"p"},"RUN")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"MULTIRUN"),".\nThe following shows how to override from the command-line and sweep over all combinations of the dbs and schemas.\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=MULTIRUN")," in your input config would make your application multi-run by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py hydra.mode=MULTIRUN db=mysql,postgresql schema=warehouse,support,school"',title:'"$',python:!0,"my_app.py":!0,"hydra.mode":"MULTIRUN",db:"mysql,postgresql",schema:'warehouse,support,school"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 6 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n[2021-01-20 17:25:03,755][HYDRA] #3 : db=postgresql schema=warehouse\n[2021-01-20 17:25:03,895][HYDRA] #4 : db=postgresql schema=support\n[2021-01-20 17:25:04,040][HYDRA] #5 : db=postgresql schema=school\n")),(0,i.mdx)("p",null,"The printed configurations have been omitted for brevity."),(0,i.mdx)("h3",{id:"--multirun--m-from-the-command-line"},(0,i.mdx)("inlineCode",{parentName:"h3"},"--multirun (-m)")," from the command-line"),(0,i.mdx)("p",null,"You can achieve the above from command-line as well:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"or "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py -m db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"You can access ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," at runtime to determine whether the application is in RUN or MULTIRUN mode. Check ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/configure_hydra/intro"},"here"),"\non how to access Hydra config at run time."),(0,i.mdx)("p",null,"If conflicts arise (e.g., ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=RUN")," and the application was run with ",(0,i.mdx)("inlineCode",{parentName:"p"},"--multirun"),"), Hydra will determine the value of ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode"),"\nat run time. The following table shows what runtime ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," value you'd get with different input configs and commandline combinations."),(0,i.mdx)("table",null,(0,i.mdx)("thead",{parentName:"table"},(0,i.mdx)("tr",{parentName:"thead"},(0,i.mdx)("th",{parentName:"tr",align:null}),(0,i.mdx)("th",{parentName:"tr",align:null},"No multirun commandline flag"),(0,i.mdx)("th",{parentName:"tr",align:null},"--multirun ( -m)"))),(0,i.mdx)("tbody",{parentName:"table"},(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN (with UserWarning)")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=None (default)"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")))),(0,i.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"Hydra composes configs lazily at job launching time. If you change code or configs after launching a job/sweep, the final\ncomposed configs might be impacted."))),(0,i.mdx)("h3",{id:"sweeping-via-hydrasweeperparams"},"Sweeping via ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.sweeper.params")),(0,i.mdx)(o.T,{to:"examples/tutorials/basic/running_your_hydra_app/5_basic_sweep",mdxType:"ExampleGithubLink"}),(0,i.mdx)("p",null,"You can also define sweeping in the input configs by overriding\n",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.sweeper.params"),". Using the above example, the same multirun could be achieved via the following config."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"hydra:\n sweeper:\n params:\n db: mysql,postgresql\n schema: warehouse,support,school\n")),(0,i.mdx)("p",null,"The syntax are consistent for both input configs and commandline overrides.\nIf a sweep is specified in both an input config and at the command line,\nthen the commandline sweep will take precedence over the sweep defined\nin the input config. If we run the same application with the above input config and a new commandline override:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py -m db=mysql"',title:'"$',python:!0,"my_app.py":!0,"-m":!0,db:'mysql"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 3 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The above configuration methods only apply to Hydra's default ",(0,i.mdx)("inlineCode",{parentName:"p"},"BasicSweeper")," for now. For other sweepers, please check out the\ncorresponding documentations."))),(0,i.mdx)("h3",{id:"additional-sweep-types"},"Additional sweep types"),(0,i.mdx)("p",null,"Hydra supports other kinds of sweeps, e.g.:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"x=range(1,10) # 1-9\nschema=glob(*) # warehouse,support,school\nschema=glob(*,exclude=w*) # support,school\n")),(0,i.mdx)("p",null,"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/override_grammar/extended"},"Extended Override syntax")," for details."),(0,i.mdx)("h3",{id:"sweeper"},"Sweeper"),(0,i.mdx)("p",null,"The default sweeping logic is built into Hydra. Additional sweepers are available as plugins.\nFor example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/plugins/ax_sweeper"},"Ax Sweeper")," can automatically find the best parameter combination!"),(0,i.mdx)("h3",{id:"launcher"},"Launcher"),(0,i.mdx)("p",null,"By default, Hydra runs your multi-run jobs locally and serially.\nOther launchers are available as plugins for launching in parallel and on different clusters. For example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/plugins/joblib_launcher"},"JobLib Launcher"),"\ncan execute the different parameter combinations in parallel on your local machine using multi-processing."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3525],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return p}});var t=a(67294);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),p=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):l(l({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(a),u=r,h=p["".concat(o,".").concat(u)]||p[u]||c[u]||i;return a?t.createElement(h,l(l({ref:n},m),{},{components:a})):t.createElement(h,l({ref:n},m))}));function f(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=h;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var m=2;mhydra.mode (new in Hydra 1.2)",id:"configure-hydramode-new-in-hydra-12",children:[],level:3},{value:"--multirun (-m) from the command-line",id:"--multirun--m-from-the-command-line",children:[],level:3},{value:"Sweeping via hydra.sweeper.params",id:"sweeping-via-hydrasweeperparams",children:[],level:3},{value:"Additional sweep types",id:"additional-sweep-types",children:[],level:3},{value:"Sweeper",id:"sweeper",children:[],level:3},{value:"Launcher",id:"launcher",children:[],level:3}],u={toc:s};function c(e){var n=e.components,a=(0,r.Z)(e,l);return(0,i.mdx)("wrapper",(0,t.Z)({},u,a,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,"Sometimes you want to run the same application with multiple different configurations.",(0,i.mdx)("br",{parentName:"p"}),"\n","E.g. running a performance test on each of the databases with each of the schemas."),(0,i.mdx)("p",null,"You can multirun a Hydra application via either commandline or configuration:"),(0,i.mdx)("h3",{id:"configure-hydramode-new-in-hydra-12"},"Configure ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.mode")," (new in Hydra 1.2)"),(0,i.mdx)("p",null,"You can configure ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," in any supported way. The legal values are ",(0,i.mdx)("inlineCode",{parentName:"p"},"RUN")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"MULTIRUN"),".\nThe following shows how to override from the command-line and sweep over all combinations of the dbs and schemas.\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=MULTIRUN")," in your input config would make your application multi-run by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py hydra.mode=MULTIRUN db=mysql,postgresql schema=warehouse,support,school"',title:'"$',python:!0,"my_app.py":!0,"hydra.mode":"MULTIRUN",db:"mysql,postgresql",schema:'warehouse,support,school"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 6 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n[2021-01-20 17:25:03,755][HYDRA] #3 : db=postgresql schema=warehouse\n[2021-01-20 17:25:03,895][HYDRA] #4 : db=postgresql schema=support\n[2021-01-20 17:25:04,040][HYDRA] #5 : db=postgresql schema=school\n")),(0,i.mdx)("p",null,"The printed configurations have been omitted for brevity."),(0,i.mdx)("h3",{id:"--multirun--m-from-the-command-line"},(0,i.mdx)("inlineCode",{parentName:"h3"},"--multirun (-m)")," from the command-line"),(0,i.mdx)("p",null,"You can achieve the above from command-line as well:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"or "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py -m db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"You can access ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," at runtime to determine whether the application is in RUN or MULTIRUN mode. Check ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/configure_hydra/intro"},"here"),"\non how to access Hydra config at run time."),(0,i.mdx)("p",null,"If conflicts arise (e.g., ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=RUN")," and the application was run with ",(0,i.mdx)("inlineCode",{parentName:"p"},"--multirun"),"), Hydra will determine the value of ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode"),"\nat run time. The following table shows what runtime ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," value you'd get with different input configs and commandline combinations."),(0,i.mdx)("table",null,(0,i.mdx)("thead",{parentName:"table"},(0,i.mdx)("tr",{parentName:"thead"},(0,i.mdx)("th",{parentName:"tr",align:null}),(0,i.mdx)("th",{parentName:"tr",align:null},"No multirun commandline flag"),(0,i.mdx)("th",{parentName:"tr",align:null},"--multirun ( -m)"))),(0,i.mdx)("tbody",{parentName:"table"},(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN (with UserWarning)")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=None (default)"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")))),(0,i.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"Hydra composes configs lazily at job launching time. If you change code or configs after launching a job/sweep, the final\ncomposed configs might be impacted."))),(0,i.mdx)("h3",{id:"sweeping-via-hydrasweeperparams"},"Sweeping via ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.sweeper.params")),(0,i.mdx)(o.T,{to:"examples/tutorials/basic/running_your_hydra_app/5_basic_sweep",mdxType:"ExampleGithubLink"}),(0,i.mdx)("p",null,"You can also define sweeping in the input configs by overriding\n",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.sweeper.params"),". Using the above example, the same multirun could be achieved via the following config."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"hydra:\n sweeper:\n params:\n db: mysql,postgresql\n schema: warehouse,support,school\n")),(0,i.mdx)("p",null,"The syntax are consistent for both input configs and commandline overrides.\nIf a sweep is specified in both an input config and at the command line,\nthen the commandline sweep will take precedence over the sweep defined\nin the input config. If we run the same application with the above input config and a new commandline override:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py -m db=mysql"',title:'"$',python:!0,"my_app.py":!0,"-m":!0,db:'mysql"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 3 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The above configuration methods only apply to Hydra's default ",(0,i.mdx)("inlineCode",{parentName:"p"},"BasicSweeper")," for now. For other sweepers, please check out the\ncorresponding documentations."))),(0,i.mdx)("h3",{id:"additional-sweep-types"},"Additional sweep types"),(0,i.mdx)("p",null,"Hydra supports other kinds of sweeps, e.g.:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"x=range(1,10) # 1-9\nschema=glob(*) # warehouse,support,school\nschema=glob(*,exclude=w*) # support,school\n")),(0,i.mdx)("p",null,"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/extended"},"Extended Override syntax")," for details."),(0,i.mdx)("h3",{id:"sweeper"},"Sweeper"),(0,i.mdx)("p",null,"The default sweeping logic is built into Hydra. Additional sweepers are available as plugins.\nFor example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/plugins/ax_sweeper"},"Ax Sweeper")," can automatically find the best parameter combination!"),(0,i.mdx)("h3",{id:"launcher"},"Launcher"),(0,i.mdx)("p",null,"By default, Hydra runs your multi-run jobs locally and serially.\nOther launchers are available as plugins for launching in parallel and on different clusters. For example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/plugins/joblib_launcher"},"JobLib Launcher"),"\ncan execute the different parameter combinations in parallel on your local machine using multi-processing."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/28a7fcb4.f476225b.js b/assets/js/28a7fcb4.f476225b.js deleted file mode 100644 index 34c23da0c4..0000000000 --- a/assets/js/28a7fcb4.f476225b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3525],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return p}});var t=a(67294);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),p=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):l(l({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(a),u=r,h=p["".concat(o,".").concat(u)]||p[u]||c[u]||i;return a?t.createElement(h,l(l({ref:n},m),{},{components:a})):t.createElement(h,l({ref:n},m))}));function f(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=h;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var m=2;mhydra.mode (new in Hydra 1.2)",id:"configure-hydramode-new-in-hydra-12",children:[],level:3},{value:"--multirun (-m) from the command-line",id:"--multirun--m-from-the-command-line",children:[],level:3},{value:"Sweeping via hydra.sweeper.params",id:"sweeping-via-hydrasweeperparams",children:[],level:3},{value:"Additional sweep types",id:"additional-sweep-types",children:[],level:3},{value:"Sweeper",id:"sweeper",children:[],level:3},{value:"Launcher",id:"launcher",children:[],level:3}],u={toc:s};function c(e){var n=e.components,a=(0,r.Z)(e,l);return(0,i.mdx)("wrapper",(0,t.Z)({},u,a,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,"Sometimes you want to run the same application with multiple different configurations.",(0,i.mdx)("br",{parentName:"p"}),"\n","E.g. running a performance test on each of the databases with each of the schemas."),(0,i.mdx)("p",null,"You can multirun a Hydra application via either commandline or configuration:"),(0,i.mdx)("h3",{id:"configure-hydramode-new-in-hydra-12"},"Configure ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.mode")," (new in Hydra 1.2)"),(0,i.mdx)("p",null,"You can configure ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," in any supported way. The legal values are ",(0,i.mdx)("inlineCode",{parentName:"p"},"RUN")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"MULTIRUN"),".\nThe following shows how to override from the command-line and sweep over all combinations of the dbs and schemas.\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=MULTIRUN")," in your input config would make your application multi-run by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py hydra.mode=MULTIRUN db=mysql,postgresql schema=warehouse,support,school"',title:'"$',python:!0,"my_app.py":!0,"hydra.mode":"MULTIRUN",db:"mysql,postgresql",schema:'warehouse,support,school"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 6 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n[2021-01-20 17:25:03,755][HYDRA] #3 : db=postgresql schema=warehouse\n[2021-01-20 17:25:03,895][HYDRA] #4 : db=postgresql schema=support\n[2021-01-20 17:25:04,040][HYDRA] #5 : db=postgresql schema=school\n")),(0,i.mdx)("p",null,"The printed configurations have been omitted for brevity."),(0,i.mdx)("h3",{id:"--multirun--m-from-the-command-line"},(0,i.mdx)("inlineCode",{parentName:"h3"},"--multirun (-m)")," from the command-line"),(0,i.mdx)("p",null,"You can achieve the above from command-line as well:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"or "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py -m db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"You can access ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," at runtime to determine whether the application is in RUN or MULTIRUN mode. Check ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/configure_hydra/intro"},"here"),"\non how to access Hydra config at run time."),(0,i.mdx)("p",null,"If conflicts arise (e.g., ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=RUN")," and the application was run with ",(0,i.mdx)("inlineCode",{parentName:"p"},"--multirun"),"), Hydra will determine the value of ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode"),"\nat run time. The following table shows what runtime ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," value you'd get with different input configs and commandline combinations."),(0,i.mdx)("table",null,(0,i.mdx)("thead",{parentName:"table"},(0,i.mdx)("tr",{parentName:"thead"},(0,i.mdx)("th",{parentName:"tr",align:null}),(0,i.mdx)("th",{parentName:"tr",align:null},"No multirun commandline flag"),(0,i.mdx)("th",{parentName:"tr",align:null},"--multirun ( -m)"))),(0,i.mdx)("tbody",{parentName:"table"},(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN (with UserWarning)")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=None (default)"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")))),(0,i.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"Hydra composes configs lazily at job launching time. If you change code or configs after launching a job/sweep, the final\ncomposed configs might be impacted."))),(0,i.mdx)("h3",{id:"sweeping-via-hydrasweeperparams"},"Sweeping via ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.sweeper.params")),(0,i.mdx)(o.T,{to:"examples/tutorials/basic/running_your_hydra_app/5_basic_sweep",mdxType:"ExampleGithubLink"}),(0,i.mdx)("p",null,"You can also define sweeping in the input configs by overriding\n",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.sweeper.params"),". Using the above example, the same multirun could be achieved via the following config."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"hydra:\n sweeper:\n params:\n db: mysql,postgresql\n schema: warehouse,support,school\n")),(0,i.mdx)("p",null,"The syntax are consistent for both input configs and commandline overrides.\nIf a sweep is specified in both an input config and at the command line,\nthen the commandline sweep will take precedence over the sweep defined\nin the input config. If we run the same application with the above input config and a new commandline override:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py -m db=mysql"',title:'"$',python:!0,"my_app.py":!0,"-m":!0,db:'mysql"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 3 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The above configuration methods only apply to Hydra's default ",(0,i.mdx)("inlineCode",{parentName:"p"},"BasicSweeper")," for now. For other sweepers, please check out the\ncorresponding documentations."))),(0,i.mdx)("h3",{id:"additional-sweep-types"},"Additional sweep types"),(0,i.mdx)("p",null,"Hydra supports other kinds of sweeps, e.g.:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"x=range(1,10) # 1-9\nschema=glob(*) # warehouse,support,school\nschema=glob(*,exclude=w*) # support,school\n")),(0,i.mdx)("p",null,"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/advanced/override_grammar/extended"},"Extended Override syntax")," for details."),(0,i.mdx)("h3",{id:"sweeper"},"Sweeper"),(0,i.mdx)("p",null,"The default sweeping logic is built into Hydra. Additional sweepers are available as plugins.\nFor example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/plugins/ax_sweeper"},"Ax Sweeper")," can automatically find the best parameter combination!"),(0,i.mdx)("h3",{id:"launcher"},"Launcher"),(0,i.mdx)("p",null,"By default, Hydra runs your multi-run jobs locally and serially.\nOther launchers are available as plugins for launching in parallel and on different clusters. For example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.2/plugins/joblib_launcher"},"JobLib Launcher"),"\ncan execute the different parameter combinations in parallel on your local machine using multi-processing."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/290e3655.1f92d1ad.js b/assets/js/290e3655.1f92d1ad.js new file mode 100644 index 0000000000..c18102f553 --- /dev/null +++ b/assets/js/290e3655.1f92d1ad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4599],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return p},MDXProvider:function(){return s},mdx:function(){return g},useMDXComponents:function(){return l},withMDXComponents:function(){return c}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),c=function(e){return function(r){var t=l(r.components);return n.createElement(e,i({},r,{components:t}))}},l=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):d(d({},r),e)),t},s=function(e){var r=l(e.components);return n.createElement(p.Provider,{value:r},e.children)},m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),c=l(t),s=o,y=c["".concat(a,".").concat(s)]||c[s]||m[s]||i;return t?n.createElement(y,d(d({ref:r},p),{},{components:t})):n.createElement(y,d({ref:r},p))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var d={};for(var u in r)hasOwnProperty.call(r,u)&&(d[u]=r[u]);d.originalType=e,d.mdxType="string"==typeof e?e:o,a[1]=d;for(var p=2;p None:\n print(f"Working directory : {os.getcwd()}")\n print(f"Output directory : {hydra.core.hydra_config.HydraConfig.get().runtime.output_dir}")\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ python my_app.py\nWorking directory : /home/omry/dev/hydra\nOutput directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-17\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra\nOutput directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-19\n")),(0,i.mdx)("p",null,"Let's take a look at one of the output directories:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ tree outputs/2019-09-25/15-16-17\noutputs/2019-09-25/15-16-17\n\u251c\u2500\u2500 .hydra\n\u2502 \u251c\u2500\u2500 config.yaml\n\u2502 \u251c\u2500\u2500 hydra.yaml\n\u2502 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("p",null,"We have the Hydra output directory (",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," by default), and the application log file.\nInside the Hydra output directory we have:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"config.yaml"),": A dump of the user specified configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.yaml"),": A dump of the Hydra configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"overrides.yaml"),": The command line overrides used")),(0,i.mdx)("p",null,"And in the main output directory:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"my_app.log"),": A log file created for this run")),(0,i.mdx)("p",null,"You can configure the name of the output directory using\nthe ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/workdir"},"customizing the working directory")," pattern."),(0,i.mdx)("h3",{id:"automatically-change-current-working-dir-to-jobs-output-dir"},"Automatically change current working dir to job's output dir"),(0,i.mdx)("p",null,"By setting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True"),", you can configure\nHydra's ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main")," decorator to change python's working directory by calling\n",(0,i.mdx)("inlineCode",{parentName:"p"},"os.chdir")," before passing control to the user's decorated main function.\nAs of Hydra v1.2, ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," defaults to ",(0,i.mdx)("inlineCode",{parentName:"p"},"False"),".\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," enables convenient use of the output directory to\nstore output for the application (For example, a database dump file)."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"# check current working dir\n$ pwd\n/home/jasha/dev/hydra\n\n# for Hydra >= 1.2, working dir remains unchanged by default\n$ python my_app.py\nWorking directory : /home/jasha/dev/hydra\nOutput directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-24\n\n# working dir changed to output dir\n$ python my_app.py hydra.job.chdir=True\nWorking directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-17\nOutput directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-17\n\n# output dir and files are still created even if `chdir` is disabled:\n$ tree -a outputs/2023-04-18/13-43-24/\noutputs/2023-04-18/13-43-24/\n\u251c\u2500\u2500 .hydra\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 hydra.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("h3",{id:"changing-or-disabling-hydras-output-subdir"},"Changing or disabling Hydra's output subdir"),(0,i.mdx)("p",null,"You can change the ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," subdirectory name by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir"),".\nYou can disable its creation by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir")," to ",(0,i.mdx)("inlineCode",{parentName:"p"},"null"),"."),(0,i.mdx)("h3",{id:"accessing-the-original-working-directory-in-your-application"},"Accessing the original working directory in your application"),(0,i.mdx)("p",null,"With ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True"),", you can still access the original working directory by importing ",(0,i.mdx)("inlineCode",{parentName:"p"},"get_original_cwd()")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"to_absolute_path()")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.utils"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import get_original_cwd, to_absolute_path\n\n@hydra.main(version_base=None)\ndef my_app(_cfg: DictConfig) -> None:\n print(f"Current working directory : {os.getcwd()}")\n print(f"Orig working directory : {get_original_cwd()}")\n print(f"to_absolute_path(\'foo\') : {to_absolute_path(\'foo\')}")\n print(f"to_absolute_path(\'/foo\') : {to_absolute_path(\'/foo\')}")\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python examples/tutorial/8_working_directory/original_cwd.py"',title:'"$',python:!0,'examples/tutorial/8_working_directory/original_cwd.py"':!0},"Current working directory : /Users/omry/dev/hydra/outputs/2019-10-23/10-53-03\nOriginal working directory : /Users/omry/dev/hydra\nto_absolute_path('foo') : /Users/omry/dev/hydra/foo\nto_absolute_path('/foo') : /foo\n")),(0,i.mdx)("p",null,"The name of the generated working directories can be ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/workdir"},"customized"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/290e3655.c970cd85.js b/assets/js/290e3655.c970cd85.js deleted file mode 100644 index 5b20415b9d..0000000000 --- a/assets/js/290e3655.c970cd85.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4599],{3905:function(e,r,t){t.r(r),t.d(r,{MDXContext:function(){return p},MDXProvider:function(){return s},mdx:function(){return g},useMDXComponents:function(){return l},withMDXComponents:function(){return c}});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),c=function(e){return function(r){var t=l(r.components);return n.createElement(e,i({},r,{components:t}))}},l=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):d(d({},r),e)),t},s=function(e){var r=l(e.components);return n.createElement(p.Provider,{value:r},e.children)},m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),c=l(t),s=o,y=c["".concat(a,".").concat(s)]||c[s]||m[s]||i;return t?n.createElement(y,d(d({ref:r},p),{},{components:t})):n.createElement(y,d({ref:r},p))}));function g(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var d={};for(var u in r)hasOwnProperty.call(r,u)&&(d[u]=r[u]);d.originalType=e,d.mdxType="string"==typeof e?e:o,a[1]=d;for(var p=2;p None:\n print(f"Working directory : {os.getcwd()}")\n print(f"Output directory : {hydra.core.hydra_config.HydraConfig.get().runtime.output_dir}")\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ python my_app.py\nWorking directory : /home/omry/dev/hydra\nOutput directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-17\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra\nOutput directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-19\n")),(0,i.mdx)("p",null,"Let's take a look at one of the output directories:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ tree outputs/2019-09-25/15-16-17\noutputs/2019-09-25/15-16-17\n\u251c\u2500\u2500 .hydra\n\u2502 \u251c\u2500\u2500 config.yaml\n\u2502 \u251c\u2500\u2500 hydra.yaml\n\u2502 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("p",null,"We have the Hydra output directory (",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," by default), and the application log file.\nInside the Hydra output directory we have:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"config.yaml"),": A dump of the user specified configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.yaml"),": A dump of the Hydra configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"overrides.yaml"),": The command line overrides used")),(0,i.mdx)("p",null,"And in the main output directory:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"my_app.log"),": A log file created for this run")),(0,i.mdx)("p",null,"You can configure the name of the output directory using\nthe ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/workdir"},"customizing the working directory")," pattern."),(0,i.mdx)("h3",{id:"automatically-change-current-working-dir-to-jobs-output-dir"},"Automatically change current working dir to job's output dir"),(0,i.mdx)("p",null,"By setting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True"),", you can configure\nHydra's ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main")," decorator to change python's working directory by calling\n",(0,i.mdx)("inlineCode",{parentName:"p"},"os.chdir")," before passing control to the user's decorated main function.\nAs of Hydra v1.2, ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir")," defaults to ",(0,i.mdx)("inlineCode",{parentName:"p"},"False"),".\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True")," enables convenient use of the output directory to\nstore output for the application (For example, a database dump file)."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"# check current working dir\n$ pwd\n/home/jasha/dev/hydra\n\n# for Hydra >= 1.2, working dir remains unchanged by default\n$ python my_app.py\nWorking directory : /home/jasha/dev/hydra\nOutput directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-24\n\n# working dir changed to output dir\n$ python my_app.py hydra.job.chdir=True\nWorking directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-17\nOutput directory : /home/jasha/dev/hydra/outputs/2023-04-18/13-43-17\n\n# output dir and files are still created even if `chdir` is disabled:\n$ tree -a outputs/2023-04-18/13-43-24/\noutputs/2023-04-18/13-43-24/\n\u251c\u2500\u2500 .hydra\n\u2502\xa0\xa0 \u251c\u2500\u2500 config.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 hydra.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("h3",{id:"changing-or-disabling-hydras-output-subdir"},"Changing or disabling Hydra's output subdir"),(0,i.mdx)("p",null,"You can change the ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," subdirectory name by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir"),".\nYou can disable its creation by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir")," to ",(0,i.mdx)("inlineCode",{parentName:"p"},"null"),"."),(0,i.mdx)("h3",{id:"accessing-the-original-working-directory-in-your-application"},"Accessing the original working directory in your application"),(0,i.mdx)("p",null,"With ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.job.chdir=True"),", you can still access the original working directory by importing ",(0,i.mdx)("inlineCode",{parentName:"p"},"get_original_cwd()")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"to_absolute_path()")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.utils"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import get_original_cwd, to_absolute_path\n\n@hydra.main(version_base=None)\ndef my_app(_cfg: DictConfig) -> None:\n print(f"Current working directory : {os.getcwd()}")\n print(f"Orig working directory : {get_original_cwd()}")\n print(f"to_absolute_path(\'foo\') : {to_absolute_path(\'foo\')}")\n print(f"to_absolute_path(\'/foo\') : {to_absolute_path(\'/foo\')}")\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python examples/tutorial/8_working_directory/original_cwd.py"',title:'"$',python:!0,'examples/tutorial/8_working_directory/original_cwd.py"':!0},"Current working directory : /Users/omry/dev/hydra/outputs/2019-10-23/10-53-03\nOriginal working directory : /Users/omry/dev/hydra\nto_absolute_path('foo') : /Users/omry/dev/hydra/foo\nto_absolute_path('/foo') : /foo\n")),(0,i.mdx)("p",null,"The name of the generated working directories can be ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/workdir"},"customized"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2c8fa177.ad6879b6.js b/assets/js/2c8fa177.fc8ba043.js similarity index 57% rename from assets/js/2c8fa177.ad6879b6.js rename to assets/js/2c8fa177.fc8ba043.js index c11fd35142..8de83457a2 100644 --- a/assets/js/2c8fa177.ad6879b6.js +++ b/assets/js/2c8fa177.fc8ba043.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9672],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return u}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),p=o,m=u["".concat(i,".").concat(p)]||u[p]||f[p]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l None:\n self.driver = driver\n self.host = host\n self.port = port\n\n def connect(self) -> None:\n print(f"{self.driver} connecting to {self.host}")\n\nclass MySQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int, timeout: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n self.timeout = timeout\n\n@dataclass\nclass DBConfig:\n driver: str = MISSING\n host: str = "localhost"\n port: int = 80\n\n@dataclass\nclass MySQLConfig(DBConfig):\n _target_: str = "my_app.MySQLConnection"\n driver: str = "MySQL"\n port: int = 1234\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n _target_: str = "my_app.PostgreSQLConnection"\n driver: str = "PostgreSQL"\n port: int = 5678\n timeout: int = 10\n\n@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [{"db": "mysql"}])\n db: DBConfig = MISSING\n\n\ncs = ConfigStore.instance()\ncs.store(name="config", node=Config)\ncs.store(group="db", name="mysql", node=MySQLConfig)\ncs.store(group="db", name="postgresql", node=PostGreSQLConfig)\n\n@hydra.main(version_base=None, config_name="config")\ndef my_app(cfg: Config) -> None:\n connection = instantiate(cfg.db)\n connection.connect()\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h4",{id:"sample-output"},"Sample Output"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py\nMySQL connecting to localhost:1234\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py db=postgresql\nPostgreSQL connecting to localhost:5678\n")))))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9672],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return d},withMDXComponents:function(){return u}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),p=o,m=u["".concat(i,".").concat(p)]||u[p]||f[p]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l None:\n self.driver = driver\n self.host = host\n self.port = port\n\n def connect(self) -> None:\n print(f"{self.driver} connecting to {self.host}")\n\nclass MySQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int, timeout: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n self.timeout = timeout\n\n@dataclass\nclass DBConfig:\n driver: str = MISSING\n host: str = "localhost"\n port: int = 80\n\n@dataclass\nclass MySQLConfig(DBConfig):\n _target_: str = "my_app.MySQLConnection"\n driver: str = "MySQL"\n port: int = 1234\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n _target_: str = "my_app.PostgreSQLConnection"\n driver: str = "PostgreSQL"\n port: int = 5678\n timeout: int = 10\n\n@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [{"db": "mysql"}])\n db: DBConfig = MISSING\n\n\ncs = ConfigStore.instance()\ncs.store(name="config", node=Config)\ncs.store(group="db", name="mysql", node=MySQLConfig)\ncs.store(group="db", name="postgresql", node=PostGreSQLConfig)\n\n@hydra.main(version_base=None, config_name="config")\ndef my_app(cfg: Config) -> None:\n connection = instantiate(cfg.db)\n connection.connect()\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h4",{id:"sample-output"},"Sample Output"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py\nMySQL connecting to localhost:1234\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py db=postgresql\nPostgreSQL connecting to localhost:5678\n")))))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2cac4d70.69fe625e.js b/assets/js/2cac4d70.69fe625e.js deleted file mode 100644 index ca4a1b00fa..0000000000 --- a/assets/js/2cac4d70.69fe625e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7226],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return p},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return u}});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),u=function(e){return function(t){var n=m(t.components);return r.createElement(e,a({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=m(n),s=i,f=u["".concat(o,".").concat(s)]||u[s]||d[s]||a;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function y(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var p=2;p None:\n # pork should be port!\n if cfg.pork == 80:\n print("Is this a webserver?!")\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h3",{id:"duck-typing-enables-static-type-checking"},"Duck-typing enables static type checking"),(0,a.mdx)("p",null,"Duck-typing the config object as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig")," enables static type checkers like ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy")," to catch\ntype errors before you run your code:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ mypy my_app_type_error.py"',title:'"$',mypy:!0,'my_app_type_error.py"':!0},'my_app_type_error.py:22: error: "MySQLConfig" has no attribute "pork"\nFound 1 error in 1 file (checked 1 source file)\n')),(0,a.mdx)("h3",{id:"structured-configs-enable-hydra-to-catch-type-errors-at-runtime"},"Structured Configs enable Hydra to catch type errors at runtime"),(0,a.mdx)("p",null,"If you forget to run ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy"),", Hydra will report the error at runtime:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app_type_error.py"',title:'"$',python:!0,'my_app_type_error.py"':!0},"Traceback (most recent call last):\n File \"my_app_type_error.py\", line 22, in my_app\n if cfg.pork == 80:\nomegaconf.errors.ConfigAttributeError: Key 'pork' not in 'MySQLConfig'\n full_key: pork\n object_type=MySQLConfig\n\nSet the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.\n")),(0,a.mdx)("p",null,"Hydra will also catch typos, or type errors in the command line:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"$ python my_app_type_error.py port=fail\nError merging override port=fail\nValue 'fail' could not be converted to Integer\n full_key: port\n object_type=MySQLConfig\n")),(0,a.mdx)("p",null,"We will see additional types of runtime errors that Hydra can catch later in this tutorial. Such as:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Trying to read or write a non existent field in your config object"),(0,a.mdx)("li",{parentName:"ul"},"Assigning a value that is incompatible with the declared type"),(0,a.mdx)("li",{parentName:"ul"},"Attempting to modify a ",(0,a.mdx)("a",{parentName:"li",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html#frozen"},"frozen config"))),(0,a.mdx)("h2",{id:"duck-typing"},"Duck typing"),(0,a.mdx)("p",null,"In the example above ",(0,a.mdx)("inlineCode",{parentName:"p"},"cfg")," is duck typed as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig"),".\nIt is actually an instance of ",(0,a.mdx)("inlineCode",{parentName:"p"},"DictConfig"),". The duck typing enables static type checking by tools like Mypy or PyCharm.\nThis reduces development time by catching coding errors before you run your application."),(0,a.mdx)("p",null,"The name ",(0,a.mdx)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Duck_typing"},"Duck typing"),' comes from the phrase "If it walks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck".\nIt can be useful when you care about the methods or attributes of an object, not the actual type of the object.'))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2cac4d70.bc1bbe25.js b/assets/js/2cac4d70.bc1bbe25.js new file mode 100644 index 0000000000..9c6fe5aa0c --- /dev/null +++ b/assets/js/2cac4d70.bc1bbe25.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7226],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return p},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return u}});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),u=function(e){return function(t){var n=m(t.components);return r.createElement(e,a({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=m(n),s=i,f=u["".concat(o,".").concat(s)]||u[s]||d[s]||a;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function y(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var p=2;p None:\n # pork should be port!\n if cfg.pork == 80:\n print("Is this a webserver?!")\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h3",{id:"duck-typing-enables-static-type-checking"},"Duck-typing enables static type checking"),(0,a.mdx)("p",null,"Duck-typing the config object as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig")," enables static type checkers like ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy")," to catch\ntype errors before you run your code:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ mypy my_app_type_error.py"',title:'"$',mypy:!0,'my_app_type_error.py"':!0},'my_app_type_error.py:22: error: "MySQLConfig" has no attribute "pork"\nFound 1 error in 1 file (checked 1 source file)\n')),(0,a.mdx)("h3",{id:"structured-configs-enable-hydra-to-catch-type-errors-at-runtime"},"Structured Configs enable Hydra to catch type errors at runtime"),(0,a.mdx)("p",null,"If you forget to run ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy"),", Hydra will report the error at runtime:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app_type_error.py"',title:'"$',python:!0,'my_app_type_error.py"':!0},"Traceback (most recent call last):\n File \"my_app_type_error.py\", line 22, in my_app\n if cfg.pork == 80:\nomegaconf.errors.ConfigAttributeError: Key 'pork' not in 'MySQLConfig'\n full_key: pork\n object_type=MySQLConfig\n\nSet the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.\n")),(0,a.mdx)("p",null,"Hydra will also catch typos, or type errors in the command line:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"$ python my_app_type_error.py port=fail\nError merging override port=fail\nValue 'fail' could not be converted to Integer\n full_key: port\n object_type=MySQLConfig\n")),(0,a.mdx)("p",null,"We will see additional types of runtime errors that Hydra can catch later in this tutorial. Such as:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Trying to read or write a non existent field in your config object"),(0,a.mdx)("li",{parentName:"ul"},"Assigning a value that is incompatible with the declared type"),(0,a.mdx)("li",{parentName:"ul"},"Attempting to modify a ",(0,a.mdx)("a",{parentName:"li",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html#frozen"},"frozen config"))),(0,a.mdx)("h2",{id:"duck-typing"},"Duck typing"),(0,a.mdx)("p",null,"In the example above ",(0,a.mdx)("inlineCode",{parentName:"p"},"cfg")," is duck typed as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig"),".\nIt is actually an instance of ",(0,a.mdx)("inlineCode",{parentName:"p"},"DictConfig"),". The duck typing enables static type checking by tools like Mypy or PyCharm.\nThis reduces development time by catching coding errors before you run your application."),(0,a.mdx)("p",null,"The name ",(0,a.mdx)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Duck_typing"},"Duck typing"),' comes from the phrase "If it walks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck".\nIt can be useful when you care about the methods or attributes of an object, not the actual type of the object.'))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2ceb009d.3aa5b9d0.js b/assets/js/2ceb009d.2f1e90ef.js similarity index 58% rename from assets/js/2ceb009d.3aa5b9d0.js rename to assets/js/2ceb009d.2f1e90ef.js index 220ff02420..58b45ee446 100644 --- a/assets/js/2ceb009d.3aa5b9d0.js +++ b/assets/js/2ceb009d.2f1e90ef.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5482],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return f},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return l}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=r.createContext({}),l=function(e){return function(n){var t=p(n.components);return r.createElement(e,i({},n,{components:t}))}},p=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},f=function(e){var n=p(e.components);return r.createElement(u.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=p(t),f=o,m=l["".concat(a,".").concat(f)]||l[f]||d[f]||i;return t?r.createElement(m,s(s({ref:n},u),{},{components:t})):r.createElement(m,s({ref:n},u))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var u=2;u None:\n """\n Stores a config node into the repository\n :param name: config name\n :param node: config node, can be DictConfig, ListConfig,\n Structured configs and even dict and list\n :param group: config group, subgroup separator is \'/\',\n for example hydra/launcher\n :param package: Config node parent hierarchy.\n Child separator is \'.\', for example foo.bar.baz\n :param provider: the name of the module/app providing this config.\n Helps debugging.\n """\n ...\n')),(0,i.mdx)("h3",{id:"example-node-values"},"Example node values"),(0,i.mdx)("p",null,"A few examples of supported node values parameters:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'@dataclass\nclass MySQLConfig:\n host: str = "localhost"\n port: int = 3306\n\n# Using the type\ncs.store(name="config1", node=MySQLConfig)\n# Using an instance, overriding some default values\ncs.store(name="config2", node=MySQLConfig(host="test.db", port=3307))\n# Using a dictionary, forfeiting runtime type safety\ncs.store(name="config3", node={"host": "localhost", "port": 3308})\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5482],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return f},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return l}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=r.createContext({}),l=function(e){return function(n){var t=p(n.components);return r.createElement(e,i({},n,{components:t}))}},p=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},f=function(e){var n=p(e.components);return r.createElement(u.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=p(t),f=o,m=l["".concat(a,".").concat(f)]||l[f]||d[f]||i;return t?r.createElement(m,s(s({ref:n},u),{},{components:t})):r.createElement(m,s({ref:n},u))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var u=2;u None:\n """\n Stores a config node into the repository\n :param name: config name\n :param node: config node, can be DictConfig, ListConfig,\n Structured configs and even dict and list\n :param group: config group, subgroup separator is \'/\',\n for example hydra/launcher\n :param package: Config node parent hierarchy.\n Child separator is \'.\', for example foo.bar.baz\n :param provider: the name of the module/app providing this config.\n Helps debugging.\n """\n ...\n')),(0,i.mdx)("h3",{id:"example-node-values"},"Example node values"),(0,i.mdx)("p",null,"A few examples of supported node values parameters:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'@dataclass\nclass MySQLConfig:\n host: str = "localhost"\n port: int = 3306\n\n# Using the type\ncs.store(name="config1", node=MySQLConfig)\n# Using an instance, overriding some default values\ncs.store(name="config2", node=MySQLConfig(host="test.db", port=3307))\n# Using a dictionary, forfeiting runtime type safety\ncs.store(name="config3", node={"host": "localhost", "port": 3308})\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2d3c34e0.bb17cd46.js b/assets/js/2d3c34e0.bb17cd46.js new file mode 100644 index 0000000000..6c21a7d445 --- /dev/null +++ b/assets/js/2d3c34e0.bb17cd46.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9280],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){return function(t){var n=p(t.components);return a.createElement(e,o({},t,{components:n}))}},p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(n),u=r,h=s["".concat(i,".").concat(u)]||s[u]||c[u]||o;return n?a.createElement(h,l(l({ref:t},d),{},{components:n})):a.createElement(h,l({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=h;var l={};for(var m in t)hasOwnProperty.call(t,m)&&(l[m]=t[m]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 db\n\u2502 \u251c\u2500\u2500 mysql.yaml\n\u2502 \u2514\u2500\u2500 postgresql.yaml\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - db: mysql\n# some other config options in your config file.\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use from the and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configuration easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\nwebsite:\n domain: example.com\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/0.11/tutorial/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2d3c34e0.fee18fab.js b/assets/js/2d3c34e0.fee18fab.js deleted file mode 100644 index 942739127b..0000000000 --- a/assets/js/2d3c34e0.fee18fab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9280],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var d=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,o({},n,{components:t}))}},p=function(e){var n=a.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(d.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),s=p(t),u=r,h=s["".concat(l,".").concat(u)]||s[u]||c[u]||o;return t?a.createElement(h,i(i({ref:n},d),{},{components:t})):a.createElement(h,i({ref:n},d))}));function f(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=h;var i={};for(var m in n)hasOwnProperty.call(n,m)&&(i[m]=n[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"You can learn more about OmegaConf ",(0,o.mdx)("a",{parentName:"p",href:"https://omegaconf.readthedocs.io/en/latest/usage.html#access-and-manipulation"},"here")," later."),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")," is loaded automatically when you run your application"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n pass: secret\n user: omry\n")),(0,o.mdx)("p",null,"You can override values in the loaded config from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{4-5}","{4-5}":!0},"$ python my_app.py db.user=root db.pass=1234\ndb:\n driver: mysql\n user: root\n pass: 1234\n")),(0,o.mdx)("h3",{id:"composition-example"},"Composition example"),(0,o.mdx)("p",null,"You may want to alternate between two different databases. To support this create a ",(0,o.mdx)("inlineCode",{parentName:"p"},"config group")," named db,\nand place one config file for each alternative inside:\nThe directory structure of our application now looks like:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"\u251c\u2500\u2500 db\n\u2502 \u251c\u2500\u2500 mysql.yaml\n\u2502 \u2514\u2500\u2500 postgresql.yaml\n\u251c\u2500\u2500 config.yaml\n\u2514\u2500\u2500 my_app.py\n")),(0,o.mdx)("p",null,"Here is the new ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml")),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"defaults:\n - db: mysql\n# some other config options in your config file.\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,(0,o.mdx)("inlineCode",{parentName:"p"},"defaults")," is a special directive telling Hydra to use db/mysql.yaml when composing the configuration object.\nThe resulting cfg object is a composition of configs from defaults with configs specified in your ",(0,o.mdx)("inlineCode",{parentName:"p"},"config.yaml"),"."),(0,o.mdx)("p",null,"You can now choose which database configuration to use from the and override values from the command line: "),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,"You can have as many config groups as you need."),(0,o.mdx)("h3",{id:"multirun"},"Multirun"),(0,o.mdx)("p",null,"You can run your function multiple times with different configuration easily with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"--multirun|-m")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"$ python my_app.py --multirun db=mysql,postgresql\n[HYDRA] Sweep output dir : multirun/2020-01-09/01-16-29\n[HYDRA] Launching 2 jobs locally\n[HYDRA] #0 : db=mysql\ndb:\n driver: mysql\n pass: secret\n user: omry\nwebsite:\n domain: example.com\n\n[HYDRA] #1 : db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\nwebsite:\n domain: example.com\n")),(0,o.mdx)("p",null,"There is a whole lot more to Hydra. Read the ",(0,o.mdx)("a",{parentName:"p",href:"/docs/0.11/tutorial/simple_cli"},"tutorial")," to learn more."),(0,o.mdx)("h2",{id:"other-stuff"},"Other stuff"),(0,o.mdx)("h3",{id:"community"},"Community"),(0,o.mdx)("p",null,"Ask questions on github or StackOverflow (Use the tag #fb-hydra):"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://github.com/facebookresearch/hydra/discussions"},"github")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://stackoverflow.com/questions/tagged/fb-hydra"},"StackOverflow"))),(0,o.mdx)("p",null,"Follow Hydra on Twitter and Facebook:"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://www.facebook.com/Hydra-Framework-109364473802509/"},"Facebook page")),(0,o.mdx)("li",{parentName:"ul"},(0,o.mdx)("a",{parentName:"li",href:"https://twitter.com/Hydra_Framework"},"Twitter"))),(0,o.mdx)("h3",{id:"citing-hydra"},"Citing Hydra"),(0,o.mdx)("p",null,"If you use Hydra in your research please use the following BibTeX entry:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text"},"@Misc{Yadan2019Hydra,\n author = {Omry Yadan},\n title = {Hydra - A framework for elegantly configuring complex applications},\n howpublished = {Github},\n year = {2019},\n url = {https://github.com/facebookresearch/hydra}\n}\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2d57dfba.2d50eb01.js b/assets/js/2d57dfba.2d50eb01.js new file mode 100644 index 0000000000..76f4b37028 --- /dev/null +++ b/assets/js/2d57dfba.2d50eb01.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2526],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return h},useMDXComponents:function(){return d},withMDXComponents:function(){return c}});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var m=a.createContext({}),c=function(e){return function(n){var t=d(n.components);return a.createElement(e,o({},n,{components:t}))}},d=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=d(t),p=i,f=c["".concat(r,".").concat(p)]||c[p]||u[p]||o;return t?a.createElement(f,l(l({ref:n},m),{},{components:t})):a.createElement(f,l({ref:n},m))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=f;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var m=2;m DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n version_base: Optional[str],\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param version_base: compatibility level to use.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(\n config_module: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(\n config_dir: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2d57dfba.57643a27.js b/assets/js/2d57dfba.57643a27.js deleted file mode 100644 index 2875cfd456..0000000000 --- a/assets/js/2d57dfba.57643a27.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2526],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return c},MDXProvider:function(){return p},mdx:function(){return f},useMDXComponents:function(){return d},withMDXComponents:function(){return m}});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=a.createContext({}),m=function(e){return function(n){var t=d(n.components);return a.createElement(e,o({},n,{components:t}))}},d=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=d(t),p=i,h=m["".concat(r,".").concat(p)]||m[p]||u[p]||o;return t?a.createElement(h,l(l({ref:n},c),{},{components:t})):a.createElement(h,l({ref:n},c))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=h;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c DictConfig:\n """\n :param config_name: the name of the config\n (usually the file name without the .yaml extension)\n :param overrides: list of overrides for config file\n :param return_hydra_config: True to return the hydra config node in the result\n :return: the composed config\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Relative initialization"',title:'"Relative','initialization"':!0},'def initialize(\n version_base: Optional[str],\n config_path: Optional[str] = None,\n job_name: Optional[str] = "app",\n caller_stack_depth: int = 1,\n) -> None:\n """\n Initializes Hydra and add the config_path to the config search path.\n config_path is relative to the parent of the caller.\n Hydra detects the caller type automatically at runtime.\n\n Supported callers:\n - Python scripts\n - Python modules\n - Unit tests\n - Jupyter notebooks.\n :param version_base: compatibility level to use.\n :param config_path: path relative to the parent of the caller\n :param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)\n :param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config module"',title:'"Initialzing',with:!0,config:!0,'module"':!0},'def initialize_config_module(\n config_module: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add the config_module to the config search path.\n The config module must be importable (an __init__.py must exist at its top level)\n :param config_module: absolute module name, for example "foo.bar.conf".\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Initialzing with config directory"',title:'"Initialzing',with:!0,config:!0,'directory"':!0},'def initialize_config_dir(\n config_dir: str,\n version_base: Optional[str],\n job_name: str = "app"\n) -> None:\n """\n Initializes Hydra and add an absolute config dir to the to the config search path.\n The config_dir is always a path on the file system and is must be an absolute path.\n Relative paths will result in an error.\n :param config_dir: absolute file system path\n :param version_base: compatibility level to use.\n :param job_name: the value for hydra.job.name (default is \'app\')\n """\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2e99c05e.a729d823.js b/assets/js/2e99c05e.bb4bb089.js similarity index 59% rename from assets/js/2e99c05e.a729d823.js rename to assets/js/2e99c05e.bb4bb089.js index 5542644b4e..054f501a93 100644 --- a/assets/js/2e99c05e.a729d823.js +++ b/assets/js/2e99c05e.bb4bb089.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6438],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return u},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return p},withMDXComponents:function(){return d}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),d=function(e){return function(t){var n=p(t.components);return r.createElement(e,i({},t,{components:n}))}},p=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(u.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(n),s=o,f=d["".concat(l,".").concat(s)]||d[s]||m[s]||i;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var u=2;u=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),d=function(e){return function(t){var n=p(t.components);return r.createElement(e,i({},t,{components:n}))}},p=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(u.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(n),s=o,f=d["".concat(l,".").concat(s)]||d[s]||m[s]||i;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var u=2;u=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=r.createContext({}),p=function(e){return function(n){var t=d(n.components);return r.createElement(e,a({},n,{components:t}))}},d=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=d(e.components);return r.createElement(u.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=g(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,c=p["".concat(i,".").concat(m)]||p[m]||s[m]||a;return t?r.createElement(c,l(l({ref:n},u),{},{components:t})):r.createElement(c,l({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=c;var l={};for(var g in n)hasOwnProperty.call(n,g)&&(l[g]=n[g]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var u=2;u None:\n log.info("Info level message")\n log.debug("Debug level message")\n\nif __name__ == "__main__":\n my_app()\n\n$ python my_app.py\n[2019-06-27 00:52:46,653][__main__][INFO] - Info level message\n\n')),(0,a.mdx)("p",null,"You can enable DEBUG level logging from the command line by overriding ",(0,a.mdx)("inlineCode",{parentName:"p"},"hydra.verbose"),"."),(0,a.mdx)("p",null,(0,a.mdx)("inlineCode",{parentName:"p"},"hydra.verbose")," can be a Boolean, a String or a List:"),(0,a.mdx)("p",null,"Examples:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=true")," : Sets the log level of ",(0,a.mdx)("strong",{parentName:"li"},"all")," loggers to ",(0,a.mdx)("inlineCode",{parentName:"li"},"DEBUG")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=NAME")," : Sets the log level of the logger ",(0,a.mdx)("inlineCode",{parentName:"li"},"NAME")," to ",(0,a.mdx)("inlineCode",{parentName:"li"},"DEBUG"),".\nEquivalent to ",(0,a.mdx)("inlineCode",{parentName:"li"},"import logging; logging.getLogger(NAME).setLevel(logging.DEBUG)"),"."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=[NAME1,NAME2]"),": Sets the log level of the loggers ",(0,a.mdx)("inlineCode",{parentName:"li"},"NAME1")," and ",(0,a.mdx)("inlineCode",{parentName:"li"},"NAME2")," to ",(0,a.mdx)("inlineCode",{parentName:"li"},"DEBUG"))),(0,a.mdx)("p",null,"Example output:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text"},"$ python my_app.py hydra.verbose=[__main__,hydra]\n[2019-09-29 13:06:00,880] - Installed Hydra Plugins\n[2019-09-29 13:06:00,880] - ***********************\n...\n[2019-09-29 13:06:00,896][__main__][INFO] - Info level message\n[2019-09-29 13:06:00,896][__main__][DEBUG] - Debug level message\n")),(0,a.mdx)("p",null,"You can disable the logging output by setting ",(0,a.mdx)("inlineCode",{parentName:"p"},"hydra/job_logging")," to ",(0,a.mdx)("inlineCode",{parentName:"p"},"disabled")," "),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/job_logging=disabled\n\n")),(0,a.mdx)("p",null,"You can also set ",(0,a.mdx)("inlineCode",{parentName:"p"},"hydra/job_logging=none")," and ",(0,a.mdx)("inlineCode",{parentName:"p"},"hydra/hydra_logging=none")," if you do not want Hydra to configure the logging."),(0,a.mdx)("p",null,"Logging can be ",(0,a.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/logging"},"customized"),"."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2f529812.f915b441.js b/assets/js/2f529812.f915b441.js deleted file mode 100644 index 6ae356ca98..0000000000 --- a/assets/js/2f529812.f915b441.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5267],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return u},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return d},withMDXComponents:function(){return p}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=r.createContext({}),p=function(e){return function(n){var t=d(n.components);return r.createElement(e,i({},n,{components:t}))}},d=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=d(e.components);return r.createElement(u.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},s=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,u=g(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,s=p["".concat(a,".").concat(m)]||p[m]||c[m]||i;return t?r.createElement(s,l(l({ref:n},u),{},{components:t})):r.createElement(s,l({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=s;var l={};for(var g in n)hasOwnProperty.call(n,g)&&(l[g]=n[g]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var u=2;u None:\n log.info("Info level message")\n log.debug("Debug level message")\n\nif __name__ == "__main__":\n my_app()\n\n$ python my_app.py\n[2019-06-27 00:52:46,653][__main__][INFO] - Info level message\n\n')),(0,i.mdx)("p",null,"You can enable DEBUG level logging from the command line by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.verbose"),"."),(0,i.mdx)("p",null,(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.verbose")," can be a Boolean, a String or a List:"),(0,i.mdx)("p",null,"Examples:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=true")," : Sets the log level of ",(0,i.mdx)("strong",{parentName:"li"},"all")," loggers to ",(0,i.mdx)("inlineCode",{parentName:"li"},"DEBUG")),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=NAME")," : Sets the log level of the logger ",(0,i.mdx)("inlineCode",{parentName:"li"},"NAME")," to ",(0,i.mdx)("inlineCode",{parentName:"li"},"DEBUG"),".\nEquivalent to ",(0,i.mdx)("inlineCode",{parentName:"li"},"import logging; logging.getLogger(NAME).setLevel(logging.DEBUG)"),"."),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.verbose=[NAME1,NAME2]"),": Sets the log level of the loggers ",(0,i.mdx)("inlineCode",{parentName:"li"},"NAME1")," and ",(0,i.mdx)("inlineCode",{parentName:"li"},"NAME2")," to ",(0,i.mdx)("inlineCode",{parentName:"li"},"DEBUG"))),(0,i.mdx)("p",null,"Example output:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ python my_app.py hydra.verbose=[__main__,hydra]\n[2019-09-29 13:06:00,880] - Installed Hydra Plugins\n[2019-09-29 13:06:00,880] - ***********************\n...\n[2019-09-29 13:06:00,896][__main__][INFO] - Info level message\n[2019-09-29 13:06:00,896][__main__][DEBUG] - Debug level message\n")),(0,i.mdx)("p",null,"You can disable the logging output by setting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra/job_logging")," to ",(0,i.mdx)("inlineCode",{parentName:"p"},"disabled")," "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"$ python my_app.py hydra/job_logging=disabled\n\n")),(0,i.mdx)("p",null,"You can also set ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra/job_logging=none")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra/hydra_logging=none")," if you do not want Hydra to configure the logging."),(0,i.mdx)("p",null,"Logging can be ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/logging"},"customized"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/315f70d7.571f09e6.js b/assets/js/315f70d7.571f09e6.js new file mode 100644 index 0000000000..0c599a9cfa --- /dev/null +++ b/assets/js/315f70d7.571f09e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3604],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return p},MDXProvider:function(){return s},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return u}});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),u=function(e){return function(t){var n=m(t.components);return r.createElement(e,a({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=m(n),s=i,f=u["".concat(o,".").concat(s)]||u[s]||d[s]||a;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function y(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var p=2;p None:\n # pork should be port!\n if cfg.pork == 80:\n print("Is this a webserver?!")\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h3",{id:"duck-typing-enables-static-type-checking"},"Duck-typing enables static type checking"),(0,a.mdx)("p",null,"Duck-typing the config object as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig")," enables static type checkers like ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy")," to catch\ntype errors before you run your code:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ mypy my_app_type_error.py"',title:'"$',mypy:!0,'my_app_type_error.py"':!0},'my_app_type_error.py:22: error: "MySQLConfig" has no attribute "pork"\nFound 1 error in 1 file (checked 1 source file)\n')),(0,a.mdx)("h3",{id:"structured-configs-enable-hydra-to-catch-type-errors-at-runtime"},"Structured Configs enable Hydra to catch type errors at runtime"),(0,a.mdx)("p",null,"If you forget to run ",(0,a.mdx)("inlineCode",{parentName:"p"},"mypy"),", Hydra will report the error at runtime:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app_type_error.py"',title:'"$',python:!0,'my_app_type_error.py"':!0},"Traceback (most recent call last):\n File \"my_app_type_error.py\", line 22, in my_app\n if cfg.pork == 80:\nomegaconf.errors.ConfigAttributeError: Key 'pork' not in 'MySQLConfig'\n full_key: pork\n object_type=MySQLConfig\n\nSet the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.\n")),(0,a.mdx)("p",null,"Hydra will also catch typos, or type errors in the command line:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"$ python my_app_type_error.py port=fail\nError merging override port=fail\nValue 'fail' could not be converted to Integer\n full_key: port\n object_type=MySQLConfig\n")),(0,a.mdx)("p",null,"We will see additional types of runtime errors that Hydra can catch later in this tutorial. Such as:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Trying to read or write a non existent field in your config object"),(0,a.mdx)("li",{parentName:"ul"},"Assigning a value that is incompatible with the declared type"),(0,a.mdx)("li",{parentName:"ul"},"Attempting to modify a ",(0,a.mdx)("a",{parentName:"li",href:"https://omegaconf.readthedocs.io/en/latest/structured_config.html#frozen"},"frozen config"))),(0,a.mdx)("h2",{id:"duck-typing"},"Duck typing"),(0,a.mdx)("p",null,"In the example above ",(0,a.mdx)("inlineCode",{parentName:"p"},"cfg")," is duck typed as ",(0,a.mdx)("inlineCode",{parentName:"p"},"MySQLConfig"),".\nIt is actually an instance of ",(0,a.mdx)("inlineCode",{parentName:"p"},"DictConfig"),". The duck typing enables static type checking by tools like Mypy or PyCharm.\nThis reduces development time by catching coding errors before you run your application."),(0,a.mdx)("p",null,"The name ",(0,a.mdx)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Duck_typing"},"Duck typing"),' comes from the phrase "If it walks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck".\nIt can be useful when you care about the methods or attributes of an object, not the actual type of the object.'))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/318b0639.10b1543f.js b/assets/js/318b0639.10b1543f.js new file mode 100644 index 0000000000..6a68423766 --- /dev/null +++ b/assets/js/318b0639.10b1543f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4265],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return c},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return l}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){return function(t){var n=s(t.components);return r.createElement(e,a({},t,{components:n}))}},s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):d(d({},t),e)),n},m=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},v=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),l=s(n),m=o,v=l["".concat(i,".").concat(m)]||l[m]||u[m]||a;return n?r.createElement(v,d(d({ref:t},c),{},{components:n})):r.createElement(v,d({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=v;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:o,i[1]=d;for(var c=2;c=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),l=function(e){return function(t){var n=s(t.components);return r.createElement(e,a({},t,{components:n}))}},s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):d(d({},t),e)),n},m=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},v=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),l=s(n),m=o,v=l["".concat(i,".").concat(m)]||l[m]||u[m]||a;return n?r.createElement(v,d(d({ref:t},p),{},{components:n})):r.createElement(v,d({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=v;var d={};for(var c in t)hasOwnProperty.call(t,c)&&(d[c]=t[c]);d.originalType=e,d.mdxType="string"==typeof e?e:o,i[1]=d;for(var p=2;p=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),d=function(e){return function(n){var t=m(n.components);return r.createElement(e,o({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=m(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||u[p]||o;return t?r.createElement(f,s(s({ref:n},c),{},{components:t})):r.createElement(f,s({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),d=function(e){return function(n){var t=m(n.components);return r.createElement(e,o({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=m(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||u[p]||o;return t?r.createElement(f,s(s({ref:n},c),{},{components:t})):r.createElement(f,s({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),c=function(e){return function(n){var t=p(n.components);return a.createElement(e,o({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},g=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=p(t),u=r,g=c["".concat(l,".").concat(u)]||c[u]||d[u]||o;return t?a.createElement(g,i(i({ref:n},m),{},{components:t})):a.createElement(g,i({ref:n},m))}));function f(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=g;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var m=2;m=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),c=function(e){return function(n){var t=p(n.components);return a.createElement(e,o({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},g=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=p(t),u=r,g=c["".concat(l,".").concat(u)]||c[u]||d[u]||o;return t?a.createElement(g,i(i({ref:n},m),{},{components:t})):a.createElement(g,i({ref:n},m))}));function f(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=g;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var m=2;m=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){return function(n){var t=u(n.components);return r.createElement(e,a({},n,{components:t}))}},u=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):p(p({},n),e)),t},m=function(e){var n=u(e.components);return r.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},g=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,g=c["".concat(i,".").concat(m)]||c[m]||d[m]||a;return t?r.createElement(g,p(p({ref:n},l),{},{components:t})):r.createElement(g,p({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=g;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("p",null,"Running ",(0,a.mdx)("inlineCode",{parentName:"p"},"my_app.py")," without requesting a configuration will print an empty config."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\n{}\n")),(0,a.mdx)("p",null,"Select an item from a config group with ",(0,a.mdx)("inlineCode",{parentName:"p"},"+GROUP=OPTION"),", e.g: "),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{2}","{2}":!0},"$ python my_app.py +db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,a.mdx)("p",null,"By default, the config group determines where the config content is placed inside the final config object.\nIn Hydra, the path to the config content is referred to as the config ",(0,a.mdx)("inlineCode",{parentName:"p"},"package"),".\nThe package of ",(0,a.mdx)("inlineCode",{parentName:"p"},"db/postgresql.yaml")," is ",(0,a.mdx)("inlineCode",{parentName:"p"},"db"),":"),(0,a.mdx)("p",null,"Like before, you can still override individual values in the resulting config:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,a.mdx)("h3",{id:"advanced-topics"},"Advanced topics"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Config content can be relocated via package overrides. See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.1/advanced/overriding_packages"},"Reference Manual/Packages"),". "),(0,a.mdx)("li",{parentName:"ul"},"Multiple options can be selected from the same Config Group by specifying them as a list.",(0,a.mdx)("br",{parentName:"li"}),"See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/select_multiple_configs_from_config_group"},"Common Patterns/Selecting multiple configs from a Config Group"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3462c84f.d526e17c.js b/assets/js/3462c84f.d526e17c.js deleted file mode 100644 index 8533fd6f19..0000000000 --- a/assets/js/3462c84f.d526e17c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[506],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return l},MDXProvider:function(){return m},mdx:function(){return f},useMDXComponents:function(){return u},withMDXComponents:function(){return c}});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){return function(n){var t=u(n.components);return r.createElement(e,a({},n,{components:t}))}},u=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):p(p({},n),e)),t},m=function(e){var n=u(e.components);return r.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},g=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,g=c["".concat(i,".").concat(m)]||c[m]||d[m]||a;return t?r.createElement(g,p(p({ref:n},l),{},{components:t})):r.createElement(g,p({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=g;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("p",null,"Running ",(0,a.mdx)("inlineCode",{parentName:"p"},"my_app.py")," without requesting a configuration will print an empty config."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\n{}\n")),(0,a.mdx)("p",null,"Select an item from a config group with ",(0,a.mdx)("inlineCode",{parentName:"p"},"+GROUP=OPTION"),", e.g: "),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:"{2}","{2}":!0},"$ python my_app.py +db=postgresql\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 10\n user: postgres_user\n")),(0,a.mdx)("p",null,"By default, the config group determines where the config content is placed inside the final config object.\nIn Hydra, the path to the config content is referred to as the config ",(0,a.mdx)("inlineCode",{parentName:"p"},"package"),".\nThe package of ",(0,a.mdx)("inlineCode",{parentName:"p"},"db/postgresql.yaml")," is ",(0,a.mdx)("inlineCode",{parentName:"p"},"db"),":"),(0,a.mdx)("p",null,"Like before, you can still override individual values in the resulting config:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db=postgresql db.timeout=20\ndb:\n driver: postgresql\n pass: drowssap\n timeout: 20\n user: postgres_user\n")),(0,a.mdx)("h3",{id:"advanced-topics"},"Advanced topics"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Config content can be relocated via package overrides. See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.1/advanced/overriding_packages"},"Reference Manual/Packages"),". "),(0,a.mdx)("li",{parentName:"ul"},"Multiple options can be selected from the same Config Group by specifying them as a list.",(0,a.mdx)("br",{parentName:"li"}),"See ",(0,a.mdx)("a",{parentName:"li",href:"/docs/1.1/patterns/select_multiple_configs_from_config_group"},"Common Patterns/Selecting multiple configs from a Config Group"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/356d2c93.60b02a0f.js b/assets/js/356d2c93.60b02a0f.js deleted file mode 100644 index 5cb0c30c9a..0000000000 --- a/assets/js/356d2c93.60b02a0f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4376],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return p},MDXProvider:function(){return m},mdx:function(){return h},useMDXComponents:function(){return s},withMDXComponents:function(){return u}});var i=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=i.createContext({}),u=function(e){return function(n){var t=s(n.components);return i.createElement(e,r({},n,{components:t}))}},s=function(e){var n=i.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},m=function(e){var n=s(e.components);return i.createElement(p.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},g=i.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,g=u["".concat(l,".").concat(m)]||u[m]||c[m]||r;return t?i.createElement(g,o(o({ref:n},p),{},{components:t})):i.createElement(g,o({ref:n},p))}));function h(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,l=new Array(r);l[0]=g;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=i.createContext({}),u=function(e){return function(n){var t=s(n.components);return i.createElement(e,r({},n,{components:t}))}},s=function(e){var n=i.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},m=function(e){var n=s(e.components);return i.createElement(p.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},g=i.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,g=u["".concat(l,".").concat(m)]||u[m]||c[m]||r;return t?i.createElement(g,o(o({ref:n},p),{},{components:t})):i.createElement(g,o({ref:n},p))}));function h(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,l=new Array(r);l[0]=g;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;pPlugins.register method",id:"plugin-registration-via-the-pluginsregister-method",children:[],level:2},{value:"Getting started",id:"getting-started",children:[],level:2}],m={toc:s};function c(e){var n=e.components,t=(0,a.Z)(e,o);return(0,r.mdx)("wrapper",(0,i.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,r.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,r.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,r.mdx)("h5",{parentName:"div"},(0,r.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,r.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,r.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,r.mdx)("div",{parentName:"div",className:"admonition-content"},(0,r.mdx)("p",{parentName:"div"},"If you develop plugins, please join the ",(0,r.mdx)("a",{href:"https://hydra-framework.zulipchat.com/#narrow/stream/233935-Hydra-plugin.20dev.20announcements"},"Plugin developer announcement chat channel"),"."))),(0,r.mdx)("p",null,"Hydra plugins must be registered before they can be used. There are two ways to register a plugin:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"via the automatic plugin discovery process, which discovers plugins located in the ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins")," namespace package"),(0,r.mdx)("li",{parentName:"ul"},"by calling the ",(0,r.mdx)("inlineCode",{parentName:"li"},"register")," method on Hydra's ",(0,r.mdx)("inlineCode",{parentName:"li"},"Plugins")," singleton class")),(0,r.mdx)("h2",{id:"automatic-plugin-discovery-process"},"Automatic Plugin discovery process"),(0,r.mdx)("p",null,"If you create a Plugin and want it to be discovered automatically by Hydra, keep the following things in mind:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"Hydra plugins can be either a standalone Python package, or a part of your existing Python package.\nIn both cases - They should be in the namespace module ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins")," (This is a top level module, Your plugin will ",(0,r.mdx)("strong",{parentName:"li"},"NOT")," be discovered if you place it in ",(0,r.mdx)("inlineCode",{parentName:"li"},"mylib.hydra_plugins"),")."),(0,r.mdx)("li",{parentName:"ul"},"Do ",(0,r.mdx)("strong",{parentName:"li"},"NOT")," place an ",(0,r.mdx)("inlineCode",{parentName:"li"},"__init__.py")," file in ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins")," (doing so may break other installed Hydra plugins).")),(0,r.mdx)("p",null,"The plugin discovery process runs whenever Hydra starts. During plugin discovery, Hydra scans for plugins in all the submodules of ",(0,r.mdx)("inlineCode",{parentName:"p"},"hydra_plugins"),". Hydra will import each module and look for plugins defined in that module.\nAny module under ",(0,r.mdx)("inlineCode",{parentName:"p"},"hydra_plugins")," that is slow to import will slow down the startup of ",(0,r.mdx)("strong",{parentName:"p"},"ALL")," Hydra applications.\nPlugins with expensive imports can exclude individual files from Hydra's plugin discovery process by prefixing them with ",(0,r.mdx)("inlineCode",{parentName:"p"},"_")," (but not ",(0,r.mdx)("inlineCode",{parentName:"p"},"__"),").\nFor example, the file ",(0,r.mdx)("inlineCode",{parentName:"p"},"_my_plugin_lib.py")," would not be imported and scanned, while ",(0,r.mdx)("inlineCode",{parentName:"p"},"my_plugin_lib.py")," would be."),(0,r.mdx)("h2",{id:"plugin-registration-via-the-pluginsregister-method"},"Plugin registration via the ",(0,r.mdx)("inlineCode",{parentName:"h2"},"Plugins.register")," method"),(0,r.mdx)("p",null,"Plugins can be manually registered by calling the ",(0,r.mdx)("inlineCode",{parentName:"p"},"register")," method on the instance of Hydra's ",(0,r.mdx)("inlineCode",{parentName:"p"},"Plugins")," singleton class."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.core.plugins import Plugins\nfrom hydra.plugins.plugin import Plugin\n\nclass MyPlugin(Plugin):\n ...\n\ndef register_my_plugin() -> None:\n """Hydra users should call this function before invoking @hydra.main"""\n Plugins.instance().register(MyPlugin)\n')),(0,r.mdx)("h2",{id:"getting-started"},"Getting started"),(0,r.mdx)("p",null,"The best way to get started developing a Hydra plugin is to base your new plugin on one of the example plugins:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"Copy the subtree of the relevant ",(0,r.mdx)(l.Z,{to:"examples/plugins",mdxType:"GithubLink"},"example plugin")," into a standalone project."),(0,r.mdx)("li",{parentName:"ul"},"Edit ",(0,r.mdx)("inlineCode",{parentName:"li"},"setup.py"),", rename the plugin module, for example from ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins.example_xyz_plugin")," to ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins.my_xyz_plugin"),"."),(0,r.mdx)("li",{parentName:"ul"},"Install the new plugin (Run this in the plugin directory: ",(0,r.mdx)("inlineCode",{parentName:"li"},"pip install -e ."),")"),(0,r.mdx)("li",{parentName:"ul"},"Run the included example app and make sure that the plugin is discovered:")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-shell"},"$ python example/my_app.py --info plugins\nInstalled Hydra Plugins\n***********************\n ...\n Launcher:\n ---------\n MyLauncher\n ...\n")),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},"Run the example application to see that that your plugin is doing something."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("em",{parentName:"li"},"[Optional]")," If you want the plugin be embedded in your existing application/library, move the ",(0,r.mdx)("inlineCode",{parentName:"li"},"hydra_plugins")," directory\nand make sure that it's included as a namespace module in your final Python package. See the ",(0,r.mdx)("inlineCode",{parentName:"li"},"setup.py"),"\nfile included with the example plugin for hints (typically this involves using ",(0,r.mdx)("inlineCode",{parentName:"li"},'find_namespace_packages(include=["hydra_plugins.*"])'),")."),(0,r.mdx)("li",{parentName:"ul"},"Hack on your plugin, Ensure that the recommended tests and any tests you want to add are passing.")))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4376],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return p},MDXProvider:function(){return m},mdx:function(){return h},useMDXComponents:function(){return s},withMDXComponents:function(){return u}});var i=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(){return r=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=i.createContext({}),u=function(e){return function(n){var t=s(n.components);return i.createElement(e,r({},n,{components:t}))}},s=function(e){var n=i.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},m=function(e){var n=s(e.components);return i.createElement(p.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},g=i.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,g=u["".concat(l,".").concat(m)]||u[m]||c[m]||r;return t?i.createElement(g,o(o({ref:n},p),{},{components:t})):i.createElement(g,o({ref:n},p))}));function h(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,l=new Array(r);l[0]=g;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=t.createContext({}),d=function(e){return function(n){var a=u(n.components);return t.createElement(e,p({},n,{components:a}))}},u=function(e){var n=t.useContext(l),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},s=function(e){var n=u(e.components);return t.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,p=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=u(a),s=r,f=d["".concat(i,".").concat(s)]||d[s]||m[s]||p;return a?t.createElement(f,o(o({ref:n},l),{},{components:a})):t.createElement(f,o({ref:n},l))}));function g(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var p=a.length,i=new Array(p);i[0]=f;var o={};for(var c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var l=2;l=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,p({},n,{components:a}))}},s=function(e){var n=t.useContext(l),a=n;return e&&(a="function"==typeof e?e(n):o(o({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,p=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,f=d["".concat(i,".").concat(u)]||d[u]||m[u]||p;return a?t.createElement(f,o(o({ref:n},l),{},{components:a})):t.createElement(f,o({ref:n},l))}));function g(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var p=a.length,i=new Array(p);i[0]=f;var o={};for(var c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var l=2;l=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=r.createContext({}),d=function(e){return function(n){var t=u(n.components);return r.createElement(e,o({},n,{components:t}))}},u=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=u(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||m[p]||o;return t?r.createElement(f,s(s({ref:n},l),{},{components:t})):r.createElement(f,s({ref:n},l))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,o.mdx)("h5",{parentName:"div"},(0,o.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,o.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,o.mdx)("div",{parentName:"div",className:"admonition-content"},(0,o.mdx)("p",{parentName:"div"},"The ",(0,o.mdx)("em",{parentName:"p"},"Config")," class is ",(0,o.mdx)("strong",{parentName:"p"},"NOT")," the Defaults list. We will see the Defaults list in the next page."))),(0,o.mdx)("p",null,"You can select the database from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db=postgresql\ndb:\n driver: postgresql\n host: localhost\n password: drowssap\n port: 5432\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"The ",(0,o.mdx)("inlineCode",{parentName:"p"},"+")," above is required because there is no default choice for the config group ",(0,o.mdx)("inlineCode",{parentName:"p"},"db"),".\nThe next page will reintroduce the Defaults List, eliminating the need for the ",(0,o.mdx)("inlineCode",{parentName:"p"},"+"),"."),(0,o.mdx)("h3",{id:"config-inheritance"},"Config inheritance"),(0,o.mdx)(i.T,{to:"examples/tutorials/structured_configs/3_config_groups/my_app_with_inheritance.py",mdxType:"ExampleGithubLink"}),(0,o.mdx)("p",null,"Standard Python inheritance can be used to get improved type safety, and to move common fields to the parent class."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Defining a config group for database using inheritance"',title:'"Defining',a:!0,config:!0,group:!0,for:!0,database:!0,using:!0,'inheritance"':!0},'from omegaconf import MISSING\n\n@dataclass\nclass DBConfig:\n host: str = "localhost"\n port: int = MISSING\n driver: str = MISSING\n\n@dataclass\nclass MySQLConfig(DBConfig):\n driver: str = "mysql"\n port: int = 3306\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n driver: str = "postgresql"\n port: int = 5432\n timeout: int = 10\n\n@dataclass\nclass Config:\n # We can now annotate db as DBConfig which\n # improves both static and dynamic type safety.\n db: DBConfig\n')),(0,o.mdx)("h3",{id:"missing-fields"},"Missing fields"),(0,o.mdx)("p",null,"Assign ",(0,o.mdx)("em",{parentName:"p"},"MISSING")," to a field to indicates that it does not have a default value. This is equivalent to\nthe ",(0,o.mdx)("inlineCode",{parentName:"p"},"???")," literal we have seen in OmegaConf configs before."),(0,o.mdx)("p",null,"Omitting a default value is equivalent to assigning ",(0,o.mdx)("em",{parentName:"p"},"MISSING")," to it, although it is sometimes\nconvenient to be able to assign MISSING it to a field."),(0,o.mdx)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,o.mdx)("h5",{parentName:"div"},(0,o.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,o.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,o.mdx)("div",{parentName:"div",className:"admonition-content"},(0,o.mdx)("p",{parentName:"div"},"Do not confuse ",(0,o.mdx)("strong",{parentName:"p"},"omegaconf.MISSING")," with ",(0,o.mdx)("strong",{parentName:"p"},"dataclass.MISSING"),"."))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/35af814a.d698c01a.js b/assets/js/35af814a.d698c01a.js new file mode 100644 index 0000000000..804f46c491 --- /dev/null +++ b/assets/js/35af814a.d698c01a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8654],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return l},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return u},withMDXComponents:function(){return d}});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(){return o=Object.assign||function(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=r.createContext({}),d=function(e){return function(n){var t=u(n.components);return r.createElement(e,o({},n,{components:t}))}},u=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=u(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||m[p]||o;return t?r.createElement(f,s(s({ref:n},l),{},{components:t})):r.createElement(f,s({ref:n},l))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,o.mdx)("h5",{parentName:"div"},(0,o.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,o.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,o.mdx)("div",{parentName:"div",className:"admonition-content"},(0,o.mdx)("p",{parentName:"div"},"The ",(0,o.mdx)("em",{parentName:"p"},"Config")," class is ",(0,o.mdx)("strong",{parentName:"p"},"NOT")," the Defaults list. We will see the Defaults list in the next page."))),(0,o.mdx)("p",null,"You can select the database from the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db=postgresql\ndb:\n driver: postgresql\n host: localhost\n password: drowssap\n port: 5432\n timeout: 10\n user: postgres_user\n")),(0,o.mdx)("p",null,"The ",(0,o.mdx)("inlineCode",{parentName:"p"},"+")," above is required because there is no default choice for the config group ",(0,o.mdx)("inlineCode",{parentName:"p"},"db"),".\nThe next page will reintroduce the Defaults List, eliminating the need for the ",(0,o.mdx)("inlineCode",{parentName:"p"},"+"),"."),(0,o.mdx)("h3",{id:"config-inheritance"},"Config inheritance"),(0,o.mdx)(i.T,{to:"examples/tutorials/structured_configs/3_config_groups/my_app_with_inheritance.py",mdxType:"ExampleGithubLink"}),(0,o.mdx)("p",null,"Standard Python inheritance can be used to get improved type safety, and to move common fields to the parent class."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Defining a config group for database using inheritance"',title:'"Defining',a:!0,config:!0,group:!0,for:!0,database:!0,using:!0,'inheritance"':!0},'from omegaconf import MISSING\n\n@dataclass\nclass DBConfig:\n host: str = "localhost"\n port: int = MISSING\n driver: str = MISSING\n\n@dataclass\nclass MySQLConfig(DBConfig):\n driver: str = "mysql"\n port: int = 3306\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n driver: str = "postgresql"\n port: int = 5432\n timeout: int = 10\n\n@dataclass\nclass Config:\n # We can now annotate db as DBConfig which\n # improves both static and dynamic type safety.\n db: DBConfig\n')),(0,o.mdx)("h3",{id:"missing-fields"},"Missing fields"),(0,o.mdx)("p",null,"Assign ",(0,o.mdx)("em",{parentName:"p"},"MISSING")," to a field to indicates that it does not have a default value. This is equivalent to\nthe ",(0,o.mdx)("inlineCode",{parentName:"p"},"???")," literal we have seen in OmegaConf configs before."),(0,o.mdx)("p",null,"Omitting a default value is equivalent to assigning ",(0,o.mdx)("em",{parentName:"p"},"MISSING")," to it, although it is sometimes\nconvenient to be able to assign MISSING it to a field."),(0,o.mdx)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,o.mdx)("h5",{parentName:"div"},(0,o.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,o.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,o.mdx)("div",{parentName:"div",className:"admonition-content"},(0,o.mdx)("p",{parentName:"div"},"Do not confuse ",(0,o.mdx)("strong",{parentName:"p"},"omegaconf.MISSING")," with ",(0,o.mdx)("strong",{parentName:"p"},"dataclass.MISSING"),"."))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/364e9131.4fae5a4e.js b/assets/js/364e9131.037e02ca.js similarity index 51% rename from assets/js/364e9131.4fae5a4e.js rename to assets/js/364e9131.037e02ca.js index 7eba17649c..8d983fd063 100644 --- a/assets/js/364e9131.4fae5a4e.js +++ b/assets/js/364e9131.037e02ca.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9857],{3905:function(e,t,r){r.r(t),r.d(t,{MDXContext:function(){return l},MDXProvider:function(){return p},mdx:function(){return v},useMDXComponents:function(){return c},withMDXComponents:function(){return u}});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){return function(t){var r=c(t.components);return n.createElement(e,i({},t,{components:r}))}},c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),u=c(r),p=o,f=u["".concat(a,".").concat(p)]||u[p]||m[p]||i;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){return function(t){var r=p(t.components);return n.createElement(e,i({},t,{components:r}))}},p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),u=p(r),c=o,f=u["".concat(a,".").concat(c)]||u[c]||m[c]||i;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=r,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||l;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--info defaults")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--cfg job")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,l.mdx)("h2",{id:"related-topics"},"Related topics"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/advanced/overriding_packages"},"Packages")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3721ffec.bc251f4c.js b/assets/js/3721ffec.bc251f4c.js deleted file mode 100644 index 8387cb812f..0000000000 --- a/assets/js/3721ffec.bc251f4c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6607],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return m},MDXProvider:function(){return c},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var m=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(m),t=n;return e&&(t="function"==typeof e?e(n):d(d({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=p(t),c=r,f=s["".concat(i,".").concat(c)]||s[c]||u[c]||l;return t?a.createElement(f,d(d({ref:n},m),{},{components:t})):a.createElement(f,d({ref:n},m))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=f;var d={};for(var o in n)hasOwnProperty.call(n,o)&&(d[o]=n[o]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var m=2;m:\n hydra/config:\n hydra/hydra_logging: default\n hydra/job_logging: default\n hydra/launcher: basic\n hydra/sweeper: basic\n hydra/output: default\n hydra/help: default\n hydra/hydra_help: default\n _self_\n config:\n server/apache:\n server/db: mysql\n _self_\n _self_\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--info defaults")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-text"},"Defaults List\n*************\n| Config path | Package | _self_ | Parent | \n-------------------------------------------------------------------------------\n| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |\n| hydra/job_logging/default | hydra.job_logging | False | hydra/config |\n| hydra/launcher/basic | hydra.launcher | False | hydra/config |\n| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |\n| hydra/output/default | hydra | False | hydra/config |\n| hydra/help/default | hydra.help | False | hydra/config |\n| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |\n| hydra/config | hydra | True | |\n| server/db/mysql | server.db | False | server/apache |\n| server/apache | server | True | config |\n| config | | True | |\n-------------------------------------------------------------------------------\n"))),(0,l.mdx)("details",null,(0,l.mdx)("summary",null,"python my_app.py ",(0,l.mdx)("b",null,"--cfg job")),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-yaml"},"server:\n db:\n name: mysql\n name: apache\ndebug: false\n"))),(0,l.mdx)("h2",{id:"related-topics"},"Related topics"),(0,l.mdx)("ul",null,(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/advanced/overriding_packages"},"Packages")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/extending_configs"},"Common Patterns/Extending Configs")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/configuring_experiments"},"Common Patterns/Configuring Experiments")),(0,l.mdx)("li",{parentName:"ul"},(0,l.mdx)("a",{parentName:"li",href:"/docs/1.2/patterns/select_multiple_configs_from_config_group"},"Selecting multiple configs from a Config Group"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/37b83927.061713e8.js b/assets/js/37b83927.061713e8.js deleted file mode 100644 index 571eb99416..0000000000 --- a/assets/js/37b83927.061713e8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5345],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return s},MDXProvider:function(){return m},mdx:function(){return h},useMDXComponents:function(){return u},withMDXComponents:function(){return c}});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){return function(t){var n=u(t.components);return a.createElement(e,o({},t,{components:n}))}},u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),c=u(n),m=i,f=c["".concat(r,".").concat(m)]||c[m]||p[m]||o;return n?a.createElement(f,l(l({ref:t},s),{},{components:n})):a.createElement(f,l({ref:t},s))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=f;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){return function(t){var n=u(t.components);return a.createElement(e,o({},t,{components:n}))}},u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,r=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),c=u(n),m=i,f=c["".concat(r,".").concat(m)]||c[m]||p[m]||o;return n?a.createElement(f,l(l({ref:t},s),{},{components:n})):a.createElement(f,l({ref:t},s))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=f;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),d=function(e){return function(n){var t=m(n.components);return r.createElement(e,o({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=m(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||u[p]||o;return t?r.createElement(f,s(s({ref:n},c),{},{components:t})):r.createElement(f,s({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=r.createContext({}),d=function(e){return function(n){var t=m(n.components);return r.createElement(e,o({},n,{components:t}))}},m=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=m(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=m(t),p=a,f=d["".concat(i,".").concat(p)]||d[p]||u[p]||o;return t?r.createElement(f,s(s({ref:n},c),{},{components:t})):r.createElement(f,s({ref:n},c))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=d(n.components);return t.createElement(e,i({},n,{components:r}))}},d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(r),c=a,h=s["".concat(l,".").concat(c)]||s[c]||m[c]||i;return r?t.createElement(h,o(o({ref:n},p),{},{components:r})):t.createElement(h,o({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=h;var o={};for(var u in n)hasOwnProperty.call(n,u)&&(o[u]=n[u]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=t.createContext({}),s=function(e){return function(n){var r=d(n.components);return t.createElement(e,i({},n,{components:r}))}},d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(r),c=a,h=s["".concat(o,".").concat(c)]||s[c]||m[c]||i;return r?t.createElement(h,l(l({ref:n},p),{},{components:r})):t.createElement(h,l({ref:n},p))}));function f(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=h;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=t.createContext({}),p=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(d),a=n;return e&&(a="function"==typeof e?e(n):l(l({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(d.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),p=s(a),u=r,h=p["".concat(o,".").concat(u)]||p[u]||c[u]||i;return a?t.createElement(h,l(l({ref:n},d),{},{components:a})):t.createElement(h,l({ref:n},d))}));function f(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=h;var l={};for(var m in n)hasOwnProperty.call(n,m)&&(l[m]=n[m]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;dhydra.mode (new in Hydra 1.2)",id:"configure-hydramode-new-in-hydra-12",children:[],level:3},{value:"--multirun (-m) from the command-line",id:"--multirun--m-from-the-command-line",children:[],level:3},{value:"Sweeping via hydra.sweeper.params",id:"sweeping-via-hydrasweeperparams",children:[],level:3},{value:"Additional sweep types",id:"additional-sweep-types",children:[],level:3},{value:"Sweeper",id:"sweeper",children:[],level:3},{value:"Launcher",id:"launcher",children:[],level:3}],u={toc:s};function c(e){var n=e.components,a=(0,r.Z)(e,l);return(0,i.mdx)("wrapper",(0,t.Z)({},u,a,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,"Sometimes you want to run the same application with multiple different configurations.",(0,i.mdx)("br",{parentName:"p"}),"\n","E.g. running a performance test on each of the databases with each of the schemas."),(0,i.mdx)("p",null,"You can multirun a Hydra application via either commandline or configuration:"),(0,i.mdx)("h3",{id:"configure-hydramode-new-in-hydra-12"},"Configure ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.mode")," (new in Hydra 1.2)"),(0,i.mdx)("p",null,"You can configure ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," in any supported way. The legal values are ",(0,i.mdx)("inlineCode",{parentName:"p"},"RUN")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"MULTIRUN"),".\nThe following shows how to override from the command-line and sweep over all combinations of the dbs and schemas.\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=MULTIRUN")," in your input config would make your application multi-run by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py hydra.mode=MULTIRUN db=mysql,postgresql schema=warehouse,support,school"',title:'"$',python:!0,"my_app.py":!0,"hydra.mode":"MULTIRUN",db:"mysql,postgresql",schema:'warehouse,support,school"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 6 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n[2021-01-20 17:25:03,755][HYDRA] #3 : db=postgresql schema=warehouse\n[2021-01-20 17:25:03,895][HYDRA] #4 : db=postgresql schema=support\n[2021-01-20 17:25:04,040][HYDRA] #5 : db=postgresql schema=school\n")),(0,i.mdx)("p",null,"The printed configurations have been omitted for brevity."),(0,i.mdx)("h3",{id:"--multirun--m-from-the-command-line"},(0,i.mdx)("inlineCode",{parentName:"h3"},"--multirun (-m)")," from the command-line"),(0,i.mdx)("p",null,"You can achieve the above from command-line as well:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"or "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py -m db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"You can access ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," at runtime to determine whether the application is in RUN or MULTIRUN mode. Check ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/intro"},"here"),"\non how to access Hydra config at run time."),(0,i.mdx)("p",null,"If conflicts arise (e.g., ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=RUN")," and the application was run with ",(0,i.mdx)("inlineCode",{parentName:"p"},"--multirun"),"), Hydra will determine the value of ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode"),"\nat run time. The following table shows what runtime ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," value you'd get with different input configs and commandline combinations."),(0,i.mdx)("table",null,(0,i.mdx)("thead",{parentName:"table"},(0,i.mdx)("tr",{parentName:"thead"},(0,i.mdx)("th",{parentName:"tr",align:null}),(0,i.mdx)("th",{parentName:"tr",align:null},"No multirun commandline flag"),(0,i.mdx)("th",{parentName:"tr",align:null},"--multirun ( -m)"))),(0,i.mdx)("tbody",{parentName:"table"},(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN (with UserWarning)")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=None (default)"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")))),(0,i.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"Hydra composes configs lazily at job launching time. If you change code or configs after launching a job/sweep, the final\ncomposed configs might be impacted."))),(0,i.mdx)("h3",{id:"sweeping-via-hydrasweeperparams"},"Sweeping via ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.sweeper.params")),(0,i.mdx)(o.T,{to:"examples/tutorials/basic/running_your_hydra_app/5_basic_sweep",mdxType:"ExampleGithubLink"}),(0,i.mdx)("p",null,"You can also define sweeping in the input configs by overriding\n",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.sweeper.params"),". Using the above example, the same multirun could be achieved via the following config."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"hydra:\n sweeper:\n params:\n db: mysql,postgresql\n schema: warehouse,support,school\n")),(0,i.mdx)("p",null,"The syntax are consistent for both input configs and commandline overrides.\nIf a sweep is specified in both an input config and at the command line,\nthen the commandline sweep will take precedence over the sweep defined\nin the input config. If we run the same application with the above input config and a new commandline override:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py -m db=mysql"',title:'"$',python:!0,"my_app.py":!0,"-m":!0,db:'mysql"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 3 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The above configuration methods only apply to Hydra's default ",(0,i.mdx)("inlineCode",{parentName:"p"},"BasicSweeper")," for now. For other sweepers, please check out the\ncorresponding documentations."))),(0,i.mdx)("h3",{id:"additional-sweep-types"},"Additional sweep types"),(0,i.mdx)("p",null,"Hydra supports other kinds of sweeps, e.g.:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"x=range(1,10) # 1-9\nschema=glob(*) # warehouse,support,school\nschema=glob(*,exclude=w*) # support,school\n")),(0,i.mdx)("p",null,"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/extended"},"Extended Override syntax")," for details."),(0,i.mdx)("h3",{id:"sweeper"},"Sweeper"),(0,i.mdx)("p",null,"The default sweeping logic is built into Hydra. Additional sweepers are available as plugins.\nFor example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/plugins/ax_sweeper"},"Ax Sweeper")," can automatically find the best parameter combination!"),(0,i.mdx)("h3",{id:"launcher"},"Launcher"),(0,i.mdx)("p",null,"By default, Hydra runs your multi-run jobs locally and serially.\nOther launchers are available as plugins for launching in parallel and on different clusters. For example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/plugins/joblib_launcher"},"JobLib Launcher"),"\ncan execute the different parameter combinations in parallel on your local machine using multi-processing."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3955c41d.994812d9.js b/assets/js/3955c41d.994812d9.js new file mode 100644 index 0000000000..fe5dd4b90b --- /dev/null +++ b/assets/js/3955c41d.994812d9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5230],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return f},useMDXComponents:function(){return s},withMDXComponents:function(){return p}});var t=a(67294);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=t.createContext({}),p=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(d),a=n;return e&&(a="function"==typeof e?e(n):l(l({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(d.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=m(e,["components","mdxType","originalType","parentName"]),p=s(a),u=r,h=p["".concat(o,".").concat(u)]||p[u]||c[u]||i;return a?t.createElement(h,l(l({ref:n},d),{},{components:a})):t.createElement(h,l({ref:n},d))}));function f(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=h;var l={};for(var m in n)hasOwnProperty.call(n,m)&&(l[m]=n[m]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;dhydra.mode (new in Hydra 1.2)",id:"configure-hydramode-new-in-hydra-12",children:[],level:3},{value:"--multirun (-m) from the command-line",id:"--multirun--m-from-the-command-line",children:[],level:3},{value:"Sweeping via hydra.sweeper.params",id:"sweeping-via-hydrasweeperparams",children:[],level:3},{value:"Additional sweep types",id:"additional-sweep-types",children:[],level:3},{value:"Sweeper",id:"sweeper",children:[],level:3},{value:"Launcher",id:"launcher",children:[],level:3}],u={toc:s};function c(e){var n=e.components,a=(0,r.Z)(e,l);return(0,i.mdx)("wrapper",(0,t.Z)({},u,a,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,"Sometimes you want to run the same application with multiple different configurations.",(0,i.mdx)("br",{parentName:"p"}),"\n","E.g. running a performance test on each of the databases with each of the schemas."),(0,i.mdx)("p",null,"You can multirun a Hydra application via either commandline or configuration:"),(0,i.mdx)("h3",{id:"configure-hydramode-new-in-hydra-12"},"Configure ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.mode")," (new in Hydra 1.2)"),(0,i.mdx)("p",null,"You can configure ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," in any supported way. The legal values are ",(0,i.mdx)("inlineCode",{parentName:"p"},"RUN")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"MULTIRUN"),".\nThe following shows how to override from the command-line and sweep over all combinations of the dbs and schemas.\nSetting ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=MULTIRUN")," in your input config would make your application multi-run by default."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py hydra.mode=MULTIRUN db=mysql,postgresql schema=warehouse,support,school"',title:'"$',python:!0,"my_app.py":!0,"hydra.mode":"MULTIRUN",db:"mysql,postgresql",schema:'warehouse,support,school"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 6 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n[2021-01-20 17:25:03,755][HYDRA] #3 : db=postgresql schema=warehouse\n[2021-01-20 17:25:03,895][HYDRA] #4 : db=postgresql schema=support\n[2021-01-20 17:25:04,040][HYDRA] #5 : db=postgresql schema=school\n")),(0,i.mdx)("p",null,"The printed configurations have been omitted for brevity."),(0,i.mdx)("h3",{id:"--multirun--m-from-the-command-line"},(0,i.mdx)("inlineCode",{parentName:"h3"},"--multirun (-m)")," from the command-line"),(0,i.mdx)("p",null,"You can achieve the above from command-line as well:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py --multirun db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"or "),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-commandline"},"python my_app.py -m db=mysql,postgresql schema=warehouse,support,school\n")),(0,i.mdx)("p",null,"You can access ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," at runtime to determine whether the application is in RUN or MULTIRUN mode. Check ",(0,i.mdx)("a",{parentName:"p",href:"/docs/configure_hydra/intro"},"here"),"\non how to access Hydra config at run time."),(0,i.mdx)("p",null,"If conflicts arise (e.g., ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode=RUN")," and the application was run with ",(0,i.mdx)("inlineCode",{parentName:"p"},"--multirun"),"), Hydra will determine the value of ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode"),"\nat run time. The following table shows what runtime ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.mode")," value you'd get with different input configs and commandline combinations."),(0,i.mdx)("table",null,(0,i.mdx)("thead",{parentName:"table"},(0,i.mdx)("tr",{parentName:"thead"},(0,i.mdx)("th",{parentName:"tr",align:null}),(0,i.mdx)("th",{parentName:"tr",align:null},"No multirun commandline flag"),(0,i.mdx)("th",{parentName:"tr",align:null},"--multirun ( -m)"))),(0,i.mdx)("tbody",{parentName:"table"},(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN (with UserWarning)")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")),(0,i.mdx)("tr",{parentName:"tbody"},(0,i.mdx)("td",{parentName:"tr",align:null},"hydra.mode=None (default)"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.RUN"),(0,i.mdx)("td",{parentName:"tr",align:null},"RunMode.MULTIRUN")))),(0,i.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"Hydra composes configs lazily at job launching time. If you change code or configs after launching a job/sweep, the final\ncomposed configs might be impacted."))),(0,i.mdx)("h3",{id:"sweeping-via-hydrasweeperparams"},"Sweeping via ",(0,i.mdx)("inlineCode",{parentName:"h3"},"hydra.sweeper.params")),(0,i.mdx)(o.T,{to:"examples/tutorials/basic/running_your_hydra_app/5_basic_sweep",mdxType:"ExampleGithubLink"}),(0,i.mdx)("p",null,"You can also define sweeping in the input configs by overriding\n",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.sweeper.params"),". Using the above example, the same multirun could be achieved via the following config."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"hydra:\n sweeper:\n params:\n db: mysql,postgresql\n schema: warehouse,support,school\n")),(0,i.mdx)("p",null,"The syntax are consistent for both input configs and commandline overrides.\nIf a sweep is specified in both an input config and at the command line,\nthen the commandline sweep will take precedence over the sweep defined\nin the input config. If we run the same application with the above input config and a new commandline override:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python my_app.py -m db=mysql"',title:'"$',python:!0,"my_app.py":!0,"-m":!0,db:'mysql"'},"[2021-01-20 17:25:03,317][HYDRA] Launching 3 jobs locally\n[2021-01-20 17:25:03,318][HYDRA] #0 : db=mysql schema=warehouse\n[2021-01-20 17:25:03,458][HYDRA] #1 : db=mysql schema=support\n[2021-01-20 17:25:03,602][HYDRA] #2 : db=mysql schema=school\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The above configuration methods only apply to Hydra's default ",(0,i.mdx)("inlineCode",{parentName:"p"},"BasicSweeper")," for now. For other sweepers, please check out the\ncorresponding documentations."))),(0,i.mdx)("h3",{id:"additional-sweep-types"},"Additional sweep types"),(0,i.mdx)("p",null,"Hydra supports other kinds of sweeps, e.g.:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},"x=range(1,10) # 1-9\nschema=glob(*) # warehouse,support,school\nschema=glob(*,exclude=w*) # support,school\n")),(0,i.mdx)("p",null,"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/advanced/override_grammar/extended"},"Extended Override syntax")," for details."),(0,i.mdx)("h3",{id:"sweeper"},"Sweeper"),(0,i.mdx)("p",null,"The default sweeping logic is built into Hydra. Additional sweepers are available as plugins.\nFor example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/plugins/ax_sweeper"},"Ax Sweeper")," can automatically find the best parameter combination!"),(0,i.mdx)("h3",{id:"launcher"},"Launcher"),(0,i.mdx)("p",null,"By default, Hydra runs your multi-run jobs locally and serially.\nOther launchers are available as plugins for launching in parallel and on different clusters. For example, the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/plugins/joblib_launcher"},"JobLib Launcher"),"\ncan execute the different parameter combinations in parallel on your local machine using multi-processing."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/395e7b7b.2cd63a3d.js b/assets/js/395e7b7b.2051f60c.js similarity index 59% rename from assets/js/395e7b7b.2cd63a3d.js rename to assets/js/395e7b7b.2051f60c.js index fcdd7a17c5..f35a97e135 100644 --- a/assets/js/395e7b7b.2cd63a3d.js +++ b/assets/js/395e7b7b.2051f60c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2245],{3905:function(e,t,r){r.r(t),r.d(t,{MDXContext:function(){return l},MDXProvider:function(){return p},mdx:function(){return v},useMDXComponents:function(){return c},withMDXComponents:function(){return u}});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){return function(t){var r=c(t.components);return n.createElement(e,a({},t,{components:r}))}},c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),u=c(r),p=o,f=u["".concat(i,".").concat(p)]||u[p]||m[p]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){return function(t){var r=c(t.components);return n.createElement(e,a({},t,{components:r}))}},c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),u=c(r),p=o,f=u["".concat(i,".").concat(p)]||u[p]||m[p]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var d=t.createContext({}),p=function(e){return function(r){var n=c(r.components);return t.createElement(e,i({},r,{components:n}))}},c=function(e){var r=t.useContext(d),n=r;return e&&(n="function"==typeof e?e(r):u(u({},r),e)),n},s=function(e){var r=c(e.components);return t.createElement(d.Provider,{value:r},e.children)},m={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},y=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(n),s=o,y=p["".concat(a,".").concat(s)]||p[s]||m[s]||i;return n?t.createElement(y,u(u({ref:r},d),{},{components:n})):t.createElement(y,u({ref:r},d))}));function g(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=y;var u={};for(var l in r)hasOwnProperty.call(r,l)&&(u[l]=r[l]);u.originalType=e,u.mdxType="string"==typeof e?e:o,a[1]=u;for(var d=2;d None:\n print("Working directory : {}".format(os.getcwd()))\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-17\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-19\n')),(0,i.mdx)("p",null,"Let's take a look at one of the working directories:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ tree outputs/2019-09-25/15-16-17\noutputs/2019-09-25/15-16-17\n\u251c\u2500\u2500 .hydra\n\u2502 \u251c\u2500\u2500 config.yaml\n\u2502 \u251c\u2500\u2500 hydra.yaml\n\u2502 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("p",null,"We have the Hydra output directory (",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," by default), and the application log file.\nInside the Hydra output directory we have:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"config.yaml"),": A dump of the user specified configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.yaml"),": A dump of the Hydra configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"overrides.yaml"),": The command line overrides used")),(0,i.mdx)("p",null,"And in the main output directory:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"my_app.log"),": A log file created for this run")),(0,i.mdx)("h3",{id:"changing-or-disabling-the-output-subdir"},"Changing or disabling the output subdir"),(0,i.mdx)("p",null,"You can change the ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," subdirectory name by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir"),".\nYou can disable its creation by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir")," to ",(0,i.mdx)("inlineCode",{parentName:"p"},"null"),". "),(0,i.mdx)("h3",{id:"original-working-directory"},"Original working directory"),(0,i.mdx)("p",null,"You can still access the original working directory via ",(0,i.mdx)("inlineCode",{parentName:"p"},"get_original_cwd()")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"to_absolute_path()")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.utils"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import get_original_cwd, to_absolute_path\n\n@hydra.main()\ndef my_app(_cfg: DictConfig) -> None:\n print(f"Current working directory : {os.getcwd()}")\n print(f"Orig working directory : {get_original_cwd()}")\n print(f"to_absolute_path(\'foo\') : {to_absolute_path(\'foo\')}")\n print(f"to_absolute_path(\'/foo\') : {to_absolute_path(\'/foo\')}")\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python examples/tutorial/8_working_directory/original_cwd.py"',title:'"$',python:!0,'examples/tutorial/8_working_directory/original_cwd.py"':!0},"Current working directory : /Users/omry/dev/hydra/outputs/2019-10-23/10-53-03\nOriginal working directory : /Users/omry/dev/hydra\nto_absolute_path('foo') : /Users/omry/dev/hydra/foo\nto_absolute_path('/foo') : /foo\n")),(0,i.mdx)("p",null,"The name of the generated working directories can be ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.1/configure_hydra/workdir"},"customized"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3989901c.e9b0c774.js b/assets/js/3989901c.e9b0c774.js deleted file mode 100644 index 988d038a3e..0000000000 --- a/assets/js/3989901c.e9b0c774.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[281],{3905:function(e,r,n){n.r(r),n.d(r,{MDXContext:function(){return d},MDXProvider:function(){return s},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return p}});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function i(){return i=Object.assign||function(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var d=t.createContext({}),p=function(e){return function(r){var n=c(r.components);return t.createElement(e,i({},r,{components:n}))}},c=function(e){var r=t.useContext(d),n=r;return e&&(n="function"==typeof e?e(r):u(u({},r),e)),n},s=function(e){var r=c(e.components);return t.createElement(d.Provider,{value:r},e.children)},m={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},y=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(n),s=o,y=p["".concat(a,".").concat(s)]||p[s]||m[s]||i;return n?t.createElement(y,u(u({ref:r},d),{},{components:n})):t.createElement(y,u({ref:r},d))}));function g(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=y;var u={};for(var l in r)hasOwnProperty.call(r,l)&&(u[l]=r[l]);u.originalType=e,u.mdxType="string"==typeof e?e:o,a[1]=u;for(var d=2;d None:\n print("Working directory : {}".format(os.getcwd()))\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-17\n\n$ python my_app.py\nWorking directory : /home/omry/dev/hydra/outputs/2019-09-25/15-16-19\n')),(0,i.mdx)("p",null,"Let's take a look at one of the working directories:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text"},"$ tree outputs/2019-09-25/15-16-17\noutputs/2019-09-25/15-16-17\n\u251c\u2500\u2500 .hydra\n\u2502 \u251c\u2500\u2500 config.yaml\n\u2502 \u251c\u2500\u2500 hydra.yaml\n\u2502 \u2514\u2500\u2500 overrides.yaml\n\u2514\u2500\u2500 my_app.log\n")),(0,i.mdx)("p",null,"We have the Hydra output directory (",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," by default), and the application log file.\nInside the Hydra output directory we have:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"config.yaml"),": A dump of the user specified configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"hydra.yaml"),": A dump of the Hydra configuration"),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"overrides.yaml"),": The command line overrides used")),(0,i.mdx)("p",null,"And in the main output directory:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("inlineCode",{parentName:"li"},"my_app.log"),": A log file created for this run")),(0,i.mdx)("h3",{id:"changing-or-disabling-the-output-subdir"},"Changing or disabling the output subdir"),(0,i.mdx)("p",null,"You can change the ",(0,i.mdx)("inlineCode",{parentName:"p"},".hydra")," subdirectory name by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir"),".\nYou can disable its creation by overriding ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.output_subdir")," to ",(0,i.mdx)("inlineCode",{parentName:"p"},"null"),". "),(0,i.mdx)("h3",{id:"original-working-directory"},"Original working directory"),(0,i.mdx)("p",null,"You can still access the original working directory via ",(0,i.mdx)("inlineCode",{parentName:"p"},"get_original_cwd()")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"to_absolute_path()")," in ",(0,i.mdx)("inlineCode",{parentName:"p"},"hydra.utils"),":"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-python"},'from hydra.utils import get_original_cwd, to_absolute_path\n\n@hydra.main()\ndef my_app(_cfg: DictConfig) -> None:\n print(f"Current working directory : {os.getcwd()}")\n print(f"Orig working directory : {get_original_cwd()}")\n print(f"to_absolute_path(\'foo\') : {to_absolute_path(\'foo\')}")\n print(f"to_absolute_path(\'/foo\') : {to_absolute_path(\'/foo\')}")\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="$ python examples/tutorial/8_working_directory/original_cwd.py"',title:'"$',python:!0,'examples/tutorial/8_working_directory/original_cwd.py"':!0},"Current working directory : /Users/omry/dev/hydra/outputs/2019-10-23/10-53-03\nOriginal working directory : /Users/omry/dev/hydra\nto_absolute_path('foo') : /Users/omry/dev/hydra/foo\nto_absolute_path('/foo') : /foo\n")),(0,i.mdx)("p",null,"The name of the generated working directories can be ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.1/configure_hydra/workdir"},"customized"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/39a98d83.0b4b17d8.js b/assets/js/39a98d83.0b4b17d8.js deleted file mode 100644 index 6739016a34..0000000000 --- a/assets/js/39a98d83.0b4b17d8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[801],{3905:function(e,a,t){t.r(a),t.d(a,{MDXContext:function(){return c},MDXProvider:function(){return s},mdx:function(){return f},useMDXComponents:function(){return m},withMDXComponents:function(){return p}});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(){return i=Object.assign||function(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=n.createContext({}),p=function(e){return function(a){var t=m(a.components);return n.createElement(e,i({},a,{components:t}))}},m=function(e){var a=n.useContext(c),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=m(e.components);return n.createElement(c.Provider,{value:a},e.children)},g={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},u=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=m(t),s=r,u=p["".concat(o,".").concat(s)]||p[s]||g[s]||i;return t?n.createElement(u,l(l({ref:a},c),{},{components:t})):n.createElement(u,l({ref:a},c))}));function f(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var d in a)hasOwnProperty.call(a,d)&&(l[d]=a[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c_group_ and _name_",id:"a-package-directive-with-_group_-and-_name_",children:[],level:5}],level:4}],level:3},{value:"Overriding the package via the defaults list",id:"overriding-the-package-via-the-defaults-list",children:[],level:3},{value:"History and future of the package directive",id:"history-and-future-of-the-package-directive",children:[],level:3}],m={toc:p};function s(e){var a=e.components,t=(0,r.Z)(e,o);return(0,i.mdx)("wrapper",(0,n.Z)({},m,t,{components:a,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,(0,i.mdx)("a",{parentName:"p",href:"https://github.com/facebookresearch/hydra/tree/1.0_branch/examples/advanced/package_overrides"},(0,i.mdx)("img",{parentName:"a",src:"https://img.shields.io/badge/-Example%20application-informational",alt:"Example application"}))),(0,i.mdx)("p",null,"The contents of a config file can be relocated, or replicated, within the config, via package overrides."),(0,i.mdx)("h3",{id:"package-specification"},"Package specification"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Definition of a package"',title:'"Definition',of:!0,a:!0,'package"':!0},"PACKAGE : _global_ | COMPONENT[.COMPONENT]*\nCOMPONENT : _group_ | _name_ | \\w+\n\n_global_ : the top level package (equivalent to the empty string).\n_group_ : the config group in dot notation: foo/bar/zoo.yaml -> foo.bar\n_name_ : the config file name: foo/bar/zoo.yaml -> zoo\n")),(0,i.mdx)("h3",{id:"overriding-the-package-in-a-file-via-a-package-directive"},"Overriding the package in a file via a package directive"),(0,i.mdx)("p",null,"A ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package directive")," specifies a common ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.0/terminology#package"},"package")," for all nodes in the config file.\nIt must be placed at the top of each ",(0,i.mdx)("inlineCode",{parentName:"p"},"config group file"),"."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Package directive examples"',title:'"Package',directive:!0,'examples"':!0},"# @package foo.bar\n# @package _global_\n# @package _group_\n# @package _group_._name_\n# @package foo._group_._name_\n")),(0,i.mdx)("h4",{id:"examples"},"Examples"),(0,i.mdx)("h5",{id:"a-package-directive-with-a-literal"},"A package directive with a literal"),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="mysql.yaml" {1-2}',title:'"mysql.yaml"',"{1-2}":!0},"# @package foo.bar\n\ndb:\n host: localhost\n port: 3306\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation" {1-2}',title:'"Interpretation"',"{1-2}":!0},"foo:\n bar:\n db:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h5",{id:"a-package-directive-with-_group_-and-_name_"},"A package directive with ",(0,i.mdx)("inlineCode",{parentName:"h5"},"_group_")," and ",(0,i.mdx)("inlineCode",{parentName:"h5"},"_name_")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml" {1-2}',title:'"db/mysql.yaml"',"{1-2}":!0},"# @package _group_._name_\n\nhost: localhost\nport: 3306\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation" {1-2}',title:'"Interpretation"',"{1-2}":!0},"db:\n mysql:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h3",{id:"overriding-the-package-via-the-defaults-list"},"Overriding the package via the defaults list"),(0,i.mdx)("p",null,"The following example adds the ",(0,i.mdx)("inlineCode",{parentName:"p"},"mysql")," config in the packages ",(0,i.mdx)("inlineCode",{parentName:"p"},"db.src")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"db.dst"),"."),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db@db.src: mysql\n - db@db.dst: mysql\n\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation"',title:'"Interpretation"'},"db:\n src:\n host: localhost\n port: 3306\n dst:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h3",{id:"history-and-future-of-the-package-directive"},"History and future of the package directive"),(0,i.mdx)("p",null,"The primary config, named in ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main()")," should not have a package directive."),(0,i.mdx)("p",null,"For config files in config groups the default depends on the version:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In ",(0,i.mdx)("strong",{parentName:"li"},"Hydra 0.11"),", there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.0")," the default is ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),(0,i.mdx)("br",{parentName:"li"}),"A warning is issued for each ",(0,i.mdx)("strong",{parentName:"li"},"config group file")," without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive."),(0,i.mdx)("li",{parentName:"ul"},"In ",(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.1")," the default for ",(0,i.mdx)("strong",{parentName:"li"},"config group files")," will become ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_"))),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to your configs files, you guarantee that they",(0,i.mdx)("br",{parentName:"p"}),"\n","will not break when you upgrade to Hydra 1.1."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/39a98d83.35554b6c.js b/assets/js/39a98d83.35554b6c.js new file mode 100644 index 0000000000..3733403cee --- /dev/null +++ b/assets/js/39a98d83.35554b6c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[801],{3905:function(e,a,t){t.r(a),t.d(a,{MDXContext:function(){return c},MDXProvider:function(){return s},mdx:function(){return f},useMDXComponents:function(){return m},withMDXComponents:function(){return p}});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function i(){return i=Object.assign||function(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=n.createContext({}),p=function(e){return function(a){var t=m(a.components);return n.createElement(e,i({},a,{components:t}))}},m=function(e){var a=n.useContext(c),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},s=function(e){var a=m(e.components);return n.createElement(c.Provider,{value:a},e.children)},g={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},u=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=m(t),s=r,u=p["".concat(o,".").concat(s)]||p[s]||g[s]||i;return t?n.createElement(u,l(l({ref:a},c),{},{components:t})):n.createElement(u,l({ref:a},c))}));function f(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var d in a)hasOwnProperty.call(a,d)&&(l[d]=a[d]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c_group_ and _name_",id:"a-package-directive-with-_group_-and-_name_",children:[],level:5}],level:4}],level:3},{value:"Overriding the package via the defaults list",id:"overriding-the-package-via-the-defaults-list",children:[],level:3},{value:"History and future of the package directive",id:"history-and-future-of-the-package-directive",children:[],level:3}],m={toc:p};function s(e){var a=e.components,t=(0,r.Z)(e,o);return(0,i.mdx)("wrapper",(0,n.Z)({},m,t,{components:a,mdxType:"MDXLayout"}),(0,i.mdx)("p",null,(0,i.mdx)("a",{parentName:"p",href:"https://github.com/facebookresearch/hydra/tree/1.0_branch/examples/advanced/package_overrides"},(0,i.mdx)("img",{parentName:"a",src:"https://img.shields.io/badge/-Example%20application-informational",alt:"Example application"}))),(0,i.mdx)("p",null,"The contents of a config file can be relocated, or replicated, within the config, via package overrides."),(0,i.mdx)("h3",{id:"package-specification"},"Package specification"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Definition of a package"',title:'"Definition',of:!0,a:!0,'package"':!0},"PACKAGE : _global_ | COMPONENT[.COMPONENT]*\nCOMPONENT : _group_ | _name_ | \\w+\n\n_global_ : the top level package (equivalent to the empty string).\n_group_ : the config group in dot notation: foo/bar/zoo.yaml -> foo.bar\n_name_ : the config file name: foo/bar/zoo.yaml -> zoo\n")),(0,i.mdx)("h3",{id:"overriding-the-package-in-a-file-via-a-package-directive"},"Overriding the package in a file via a package directive"),(0,i.mdx)("p",null,"A ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package directive")," specifies a common ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.0/terminology#package"},"package")," for all nodes in the config file.\nIt must be placed at the top of each ",(0,i.mdx)("inlineCode",{parentName:"p"},"config group file"),"."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Package directive examples"',title:'"Package',directive:!0,'examples"':!0},"# @package foo.bar\n# @package _global_\n# @package _group_\n# @package _group_._name_\n# @package foo._group_._name_\n")),(0,i.mdx)("h4",{id:"examples"},"Examples"),(0,i.mdx)("h5",{id:"a-package-directive-with-a-literal"},"A package directive with a literal"),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="mysql.yaml" {1-2}',title:'"mysql.yaml"',"{1-2}":!0},"# @package foo.bar\n\ndb:\n host: localhost\n port: 3306\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation" {1-2}',title:'"Interpretation"',"{1-2}":!0},"foo:\n bar:\n db:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h5",{id:"a-package-directive-with-_group_-and-_name_"},"A package directive with ",(0,i.mdx)("inlineCode",{parentName:"h5"},"_group_")," and ",(0,i.mdx)("inlineCode",{parentName:"h5"},"_name_")),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="db/mysql.yaml" {1-2}',title:'"db/mysql.yaml"',"{1-2}":!0},"# @package _group_._name_\n\nhost: localhost\nport: 3306\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation" {1-2}',title:'"Interpretation"',"{1-2}":!0},"db:\n mysql:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h3",{id:"overriding-the-package-via-the-defaults-list"},"Overriding the package via the defaults list"),(0,i.mdx)("p",null,"The following example adds the ",(0,i.mdx)("inlineCode",{parentName:"p"},"mysql")," config in the packages ",(0,i.mdx)("inlineCode",{parentName:"p"},"db.src")," and ",(0,i.mdx)("inlineCode",{parentName:"p"},"db.dst"),"."),(0,i.mdx)("div",{className:"row"},(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="config.yaml"',title:'"config.yaml"'},"defaults:\n - db@db.src: mysql\n - db@db.dst: mysql\n\n\n\n\n"))),(0,i.mdx)("div",{className:"col col--6"},(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Interpretation"',title:'"Interpretation"'},"db:\n src:\n host: localhost\n port: 3306\n dst:\n host: localhost\n port: 3306\n")))),(0,i.mdx)("h3",{id:"history-and-future-of-the-package-directive"},"History and future of the package directive"),(0,i.mdx)("p",null,"The primary config, named in ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main()")," should not have a package directive."),(0,i.mdx)("p",null,"For config files in config groups the default depends on the version:"),(0,i.mdx)("ul",null,(0,i.mdx)("li",{parentName:"ul"},"In ",(0,i.mdx)("strong",{parentName:"li"},"Hydra 0.11"),", there was an implicit default of ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_")),(0,i.mdx)("li",{parentName:"ul"},(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.0")," the default is ",(0,i.mdx)("inlineCode",{parentName:"li"},"_global_"),(0,i.mdx)("br",{parentName:"li"}),"A warning is issued for each ",(0,i.mdx)("strong",{parentName:"li"},"config group file")," without a ",(0,i.mdx)("inlineCode",{parentName:"li"},"@package")," directive."),(0,i.mdx)("li",{parentName:"ul"},"In ",(0,i.mdx)("strong",{parentName:"li"},"Hydra 1.1")," the default for ",(0,i.mdx)("strong",{parentName:"li"},"config group files")," will become ",(0,i.mdx)("inlineCode",{parentName:"li"},"_group_"))),(0,i.mdx)("p",null,"By adding an explicit ",(0,i.mdx)("inlineCode",{parentName:"p"},"@package")," to your configs files, you guarantee that they",(0,i.mdx)("br",{parentName:"p"}),"\n","will not break when you upgrade to Hydra 1.1."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/39fd50bc.884d8ce9.js b/assets/js/39fd50bc.884d8ce9.js deleted file mode 100644 index 675bb60cef..0000000000 --- a/assets/js/39fd50bc.884d8ce9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2596],{3905:function(e,n,a){a.r(n),a.d(n,{MDXContext:function(){return m},MDXProvider:function(){return u},mdx:function(){return h},useMDXComponents:function(){return s},withMDXComponents:function(){return d}});var t=a(67294);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var m=t.createContext({}),d=function(e){return function(n){var a=s(n.components);return t.createElement(e,i({},n,{components:a}))}},s=function(e){var n=t.useContext(m),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},u=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},x=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=s(a),u=r,x=d["".concat(o,".").concat(u)]||d[u]||c[u]||i;return a?t.createElement(x,p(p({ref:n},m),{},{components:a})):t.createElement(x,p({ref:n},m))}));function h(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=x;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var m=2;m=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){return function(t){var n=d(t.components);return r.createElement(e,a({},t,{components:n}))}},d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),p=o,m=u["".concat(i,".").concat(p)]||u[p]||f[p]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l None:\n self.driver = driver\n self.host = host\n self.port = port\n\n def connect(self) -> None:\n print(f"{self.driver} connecting to {self.host}")\n\nclass MySQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int, timeout: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n self.timeout = timeout\n\n@dataclass\nclass DBConfig:\n driver: str = MISSING\n host: str = "localhost"\n port: int = 80\n\n@dataclass\nclass MySQLConfig(DBConfig):\n _target_: str = "my_app.MySQLConnection"\n driver: str = "MySQL"\n port: int = 1234\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n _target_: str = "my_app.PostgreSQLConnection"\n driver: str = "PostgreSQL"\n port: int = 5678\n timeout: int = 10\n\n@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [{"db": "mysql"}])\n db: DBConfig = MISSING\n\n\ncs = ConfigStore.instance()\ncs.store(name="config", node=Config)\ncs.store(group="db", name="mysql", node=MySQLConfig)\ncs.store(group="db", name="postgresql", node=PostGreSQLConfig)\n\n@hydra.main(version_base=None, config_name="config")\ndef my_app(cfg: Config) -> None:\n connection = instantiate(cfg.db)\n connection.connect()\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h4",{id:"sample-output"},"Sample Output"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py\nMySQL connecting to localhost:1234\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py db=postgresql\nPostgreSQL connecting to localhost:5678\n")))))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2122],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return l},MDXProvider:function(){return d},mdx:function(){return g},useMDXComponents:function(){return p},withMDXComponents:function(){return u}});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){return function(t){var n=p(t.components);return r.createElement(e,a({},t,{components:n}))}},p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,m=u["".concat(i,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l None:\n self.driver = driver\n self.host = host\n self.port = port\n\n def connect(self) -> None:\n print(f"{self.driver} connecting to {self.host}")\n\nclass MySQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n\nclass PostgreSQLConnection(DBConnection):\n def __init__(self, driver: str, host: str, port: int, timeout: int) -> None:\n super().__init__(driver=driver, host=host, port=port)\n self.timeout = timeout\n\n@dataclass\nclass DBConfig:\n driver: str = MISSING\n host: str = "localhost"\n port: int = 80\n\n@dataclass\nclass MySQLConfig(DBConfig):\n _target_: str = "my_app.MySQLConnection"\n driver: str = "MySQL"\n port: int = 1234\n\n@dataclass\nclass PostGreSQLConfig(DBConfig):\n _target_: str = "my_app.PostgreSQLConnection"\n driver: str = "PostgreSQL"\n port: int = 5678\n timeout: int = 10\n\n@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [{"db": "mysql"}])\n db: DBConfig = MISSING\n\n\ncs = ConfigStore.instance()\ncs.store(name="config", node=Config)\ncs.store(group="db", name="mysql", node=MySQLConfig)\ncs.store(group="db", name="postgresql", node=PostGreSQLConfig)\n\n@hydra.main(version_base=None, config_name="config")\ndef my_app(cfg: Config) -> None:\n connection = instantiate(cfg.db)\n connection.connect()\n\nif __name__ == "__main__":\n my_app()\n')),(0,a.mdx)("h4",{id:"sample-output"},"Sample Output"),(0,a.mdx)("div",{className:"row"},(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py\nMySQL connecting to localhost:1234\n"))),(0,a.mdx)("div",{className:"col col--6"},(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-bash"},"$ python my_app.py db=postgresql\nPostgreSQL connecting to localhost:5678\n")))))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3cf33e0d.23a30b49.js b/assets/js/3cf33e0d.23a30b49.js new file mode 100644 index 0000000000..95b2aa8fed --- /dev/null +++ b/assets/js/3cf33e0d.23a30b49.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1562],{3905:function(e,n,r){r.r(n),r.d(n,{MDXContext:function(){return s},MDXProvider:function(){return d},mdx:function(){return f},useMDXComponents:function(){return u},withMDXComponents:function(){return c}});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(){return a=Object.assign||function(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=t.createContext({}),c=function(e){return function(n){var r=u(n.components);return t.createElement(e,a({},n,{components:r}))}},u=function(e){var n=t.useContext(s),r=n;return e&&(r="function"==typeof e?e(n):p(p({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,h=c["".concat(i,".").concat(d)]||c[d]||m[d]||a;return r?t.createElement(h,p(p({ref:n},s),{},{components:r})):t.createElement(h,p({ref:n},s))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=h;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var s=2;s=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=t.createContext({}),c=function(e){return function(n){var r=u(n.components);return t.createElement(e,a({},n,{components:r}))}},u=function(e){var n=t.useContext(s),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},d=function(e){var n=u(e.components);return t.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},h=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,h=c["".concat(p,".").concat(d)]||c[d]||m[d]||a;return r?t.createElement(h,i(i({ref:n},s),{},{components:r})):t.createElement(h,i({ref:n},s))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=h;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,p[1]=i;for(var s=2;s=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=m(n),d=a,f=c["".concat(o,".").concat(d)]||c[d]||u[d]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"In this example, Hydra creates an empty ",(0,i.mdx)("inlineCode",{parentName:"p"},"cfg")," object and passes it to the function annotated with ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main"),"."),(0,i.mdx)("p",null,"You can add config values via the command line. The ",(0,i.mdx)("inlineCode",{parentName:"p"},"+")," indicates that the field is new."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db.driver=mysql +db.user=omry +db.password=secret\ndb:\n driver: mysql\n user: omry\n password: secret\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/upgrades/version_base"},"version_base page")," for details on the version_base parameter."))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/hydra-command-line-flags"},"Hydra's command line flags")," and\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/override_grammar/basic"},"Basic Override Syntax")," for more information about the command line."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6343],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return p},MDXProvider:function(){return d},mdx:function(){return y},useMDXComponents:function(){return m},withMDXComponents:function(){return c}});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){return function(t){var n=m(t.components);return r.createElement(e,i({},t,{components:n}))}},m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=m(n),d=a,f=c["".concat(o,".").concat(d)]||c[d]||u[d]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p None:\n print(OmegaConf.to_yaml(cfg))\n\nif __name__ == "__main__":\n my_app()\n')),(0,i.mdx)("p",null,"In this example, Hydra creates an empty ",(0,i.mdx)("inlineCode",{parentName:"p"},"cfg")," object and passes it to the function annotated with ",(0,i.mdx)("inlineCode",{parentName:"p"},"@hydra.main"),"."),(0,i.mdx)("p",null,"You can add config values via the command line. The ",(0,i.mdx)("inlineCode",{parentName:"p"},"+")," indicates that the field is new."),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py +db.driver=mysql +db.user=omry +db.password=secret\ndb:\n driver: mysql\n user: omry\n password: secret\n")),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"See the ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/upgrades/version_base"},"version_base page")," for details on the version_base parameter."))),(0,i.mdx)("p",null,"See ",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/hydra-command-line-flags"},"Hydra's command line flags")," and\n",(0,i.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/override_grammar/basic"},"Basic Override Syntax")," for more information about the command line."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3dca537e.231a54ad.js b/assets/js/3dca537e.231a54ad.js new file mode 100644 index 0000000000..6f6be28789 --- /dev/null +++ b/assets/js/3dca537e.231a54ad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4463],{3905:function(e,n,r){r.r(n),r.d(n,{MDXContext:function(){return m},MDXProvider:function(){return p},mdx:function(){return g},useMDXComponents:function(){return s},withMDXComponents:function(){return c}});var t=r(67294);function a(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(){return i=Object.assign||function(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var m=t.createContext({}),c=function(e){return function(n){var r=s(n.components);return t.createElement(e,i({},n,{components:r}))}},s=function(e){var n=t.useContext(m),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},p=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=s(r),p=a,f=c["".concat(o,".").concat(p)]||c[p]||u[p]||i;return r?t.createElement(f,l(l({ref:n},m),{},{components:r})):t.createElement(f,l({ref:n},m))}));function g(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var m=t.createContext({}),c=function(e){return function(n){var r=s(n.components);return t.createElement(e,i({},n,{components:r}))}},s=function(e){var n=t.useContext(m),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},p=function(e){var n=s(e.components);return t.createElement(m.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),c=s(r),p=a,f=c["".concat(o,".").concat(p)]||c[p]||u[p]||i;return r?t.createElement(f,l(l({ref:n},m),{},{components:r})):t.createElement(f,l({ref:n},m))}));function g(e,n){var r=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var l={};for(var d in n)hasOwnProperty.call(n,d)&&(l[d]=n[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var m=2;m=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(o.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(t),u=r,c=s["".concat(d,".").concat(u)]||s[u]||g[u]||l;return t?a.createElement(c,i(i({ref:n},o),{},{components:t})):a.createElement(c,i({ref:n},o))}));function x(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,d=new Array(l);d[0]=c;var i={};for(var m in n)hasOwnProperty.call(n,m)&&(i[m]=n[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,d[1]=i;for(var o=2;o bool:\n ...\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Calling function"',title:'"Calling','function"':!0},"func(10,foo) # Positional only\nfunc(a=10,b=foo) # Named only\nfunc(10,b=foo) # Mixed\nfunc(a=10,foo) # Error\n")))),(0,l.mdx)("p",null,"Note the lack of quotes in the examples above. Despite some similarities, this is ",(0,l.mdx)("strong",{parentName:"p"},"not Python"),"."),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},"Hydra supports very specific functions. If you would like to have\nanother function added, please file an issue and explain the use case."))),(0,l.mdx)("h2",{id:"sweeps"},"Sweeps"),(0,l.mdx)("p",null,"Sweep overrides are used by Sweepers to determine what to do. For example,\none can instruct the Basic Sweeper to sweep over all combinations of the\nranges ",(0,l.mdx)("inlineCode",{parentName:"p"},"num1=range(0,3)")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"num2=range(0,3)")," - resulting in ",(0,l.mdx)("inlineCode",{parentName:"p"},"9")," jobs, each getting a\ndifferent pair of numbers from ",(0,l.mdx)("inlineCode",{parentName:"p"},"0"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"1")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"2"),"."),(0,l.mdx)("h3",{id:"choice-sweep"},"Choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def choice(\n *args: Union[str, int, float, bool, Dict[Any, Any], List[Any], ChoiceSweep]\n) -> ChoiceSweep:\n """\n A choice sweep over the specified values\n """\n')),(0,l.mdx)("p",null,"Choice sweeps are the most common sweeps.\nA choice sweep is described in one of two equivalent forms."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"db=mysql,postgresql # a comma separated list of two or more elements. \ndb=choice(mysql,postgresql) # choice\n")),(0,l.mdx)("h3",{id:"glob-choice-sweep"},"Glob choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def glob(\n include: Union[List[str], str], exclude: Optional[Union[List[str], str]] = None\n) -> Glob:\n """\n A glob selects from all options in the config group.\n inputs are in glob format. e.g: *, foo*, *foo.\n :param include: a string or a list of strings to use as include globs\n :param exclude: a string or a list of strings to use as exclude globs\n :return: A Glob object\n """\n')),(0,l.mdx)("p",null,"Assuming the config group ",(0,l.mdx)("strong",{parentName:"p"},"schema")," with the options ",(0,l.mdx)("strong",{parentName:"p"},"school"),", ",(0,l.mdx)("strong",{parentName:"p"},"support")," and ",(0,l.mdx)("strong",{parentName:"p"},"warehouse"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"schema=glob(*) # school,support,warehouse\nschema=glob(*,exclude=support) # school,warehouse\nschema=glob([s*,w*],exclude=school) # support,warehouse\n")),(0,l.mdx)("h3",{id:"range-sweep"},"Range sweep"),(0,l.mdx)("p",null,"Unlike Python, Hydra's range can be used with both integer and floating-point numbers.\nIn both cases, the range represents a discrete list of values."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def range(\n start: Union[int, float], stop: Optional[Union[int, float]] = None, step: Union[int, float] = 1\n) -> RangeSweep:\n """\n Range is defines a sweeep over a range of integer or floating-point values.\n For a positive step, the contents of a range r are determined by the formula\n r[i] = start + step*i where i >= 0 and r[i] < stop.\n For a negative step, the contents of the range are still determined by the formula\n r[i] = start + step*i, but the constraints are i >= 0 and r[i] > stop.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"num=range(5) # 0,1,2,3,4\nnum=range(0,5) # 0,1,2,3,4\nnum=range(0,5,2) # 0,2,4\nnum=range(0,10,3.3) # 0.0,3.3,6.6,9.9\nnum=range(-5,step=-1) # 0,-1,-2,-3,-4\n")),(0,l.mdx)("h3",{id:"interval-sweep"},"Interval sweep"),(0,l.mdx)("p",null,"An interval sweep represents all the floating point value between two values.\nThis is used by optimizing sweepers like Ax and Nevergrad. The basic sweeper does not support interval."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def interval(start: Union[int, float], end: Union[int, float]) -> IntervalSweep:\n """\n A continuous interval between two floating point values.\n value=interval(x,y) is interpreted as x <= value < y\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"interval(1.0,5.0) # 1.0 <= x < 5.0\ninterval(1,5) # 1.0 <= x < 5.0, auto-cast to floats\n")),(0,l.mdx)("h3",{id:"tag"},"Tag"),(0,l.mdx)("p",null,"With tags you can add arbitrary metadata to a sweep. The metadata can be used by advanced sweepers."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def tag(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None) -> Sweep:\n """\n Tags the sweep with a list of string tags.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"tag(log,interval(0,1)) # 1.0 <= x < 1.0, tags=[log]\ntag(foo,bar,interval(0,1)) # 1.0 <= x < 1.0, tags=[foo,bar]\n")),(0,l.mdx)("h2",{id:"reordering-lists-and-sweeps"},"Reordering lists and sweeps"),(0,l.mdx)("h3",{id:"sort"},"sort"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def sort(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n reverse: bool = False,\n) -> Any:\n """\n Sort an input list or sweep.\n reverse=True reverses the order\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"# sweep\nsort(1,3,2) # ChoiceSweep(1,2,3)\nsort(1,3,2,reverse=true) # ChoiceSweep(3,2,1)\nsort(choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(sweep=choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(choice(1,2,3),reverse=true) # ChoiceSweep(3,2,1)\nsort(range(10,1)) # range in ascending order\nsort(range(1,10),reverse=true) # range in descending order\n\n# lists\nsort([1,3,2]) # [1,2,3]\nsort(list=[1,3,2]) # [1,2,3]\nsort(list=[1,3,2], reverse=true) # [3,2,1]\n\n# single value returned as is\nsort(1) # 1\n")),(0,l.mdx)("h3",{id:"shuffle"},"shuffle"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def shuffle(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n) -> Union[List[Any], ChoiceSweep, RangeSweep]:\n """\n Shuffle input list or sweep (does not support interval)\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"shuffle(a,b,c) # shuffled a,b,c\nshuffle(choice(a,b,c)), shuffle(sweep=choice(a,b,c)) # shuffled choice(a,b,c)\nshuffle(range(1,10)) # shuffled range(1,10)\nshuffle([a,b,c]), shuffle(list=[a,b,c]) # shuffled list [a,b,c] \n")),(0,l.mdx)("h2",{id:"type-casting"},"Type casting"),(0,l.mdx)("p",null,"You can cast values and sweeps to ",(0,l.mdx)("inlineCode",{parentName:"p"},"int"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"float"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"bool")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"str"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example"',title:'"Example"'},"int(3.14) # 3 (int)\nint(value=3.14) # 3 (int)\nfloat(10) # 10.0 (float)\nstr(10) # \"10\" (str)\nbool(1) # true (bool)\nfloat(range(1,10)) # range(1.0,10.0)\nstr([1,2,3]) # ['1','2','3']\nstr({a:10}) # {a:'10'}\n")),(0,l.mdx)("p",null,"Below are pseudo code snippets that illustrates the differences between Python's casting and Hydra's casting."),(0,l.mdx)("h4",{id:"casting-string-to-bool"},"Casting string to bool"),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def bool(value: Any) -> bool:\n if isinstance(value, str):\n return len(value) > 0\n else:\n return bool(value)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},'def bool(s: str) -> bool:\n if isinstance(value, str):\n if value.lower() == "false":\n return False\n elif value.lower() == "true":\n return True\n else:\n raise ValueError()\n return bool(value)\n')))),(0,l.mdx)("h4",{id:"casting-lists"},"Casting lists"),(0,l.mdx)("p",null,"Casting lists results in a list where each element is recursively cast.\nFailure to cast an element in the list fails the cast of the list."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, list):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(v, list):\n return list(map(cast_int, v))\n else:\n return int(v)\n\n\n")))),(0,l.mdx)("h4",{id:"casting-dicts"},"Casting dicts"),(0,l.mdx)("p",null,"Casting dicts results in a dict where values are recursively cast, but keys are unchanged.\nFailure to cast a value in the dict fails the cast of the entire dict."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n return apply_to_values(\n value, cast_int\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h4",{id:"casting-ranges"},"Casting ranges"),(0,l.mdx)("p",null,"Ranges can be cast to float or int, resulting in start, stop and step being cast and thus the range elements being cast."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n raise TypeError()\n else:\n return int(v)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n return RangeSweep(\n start=cast_int(value.start),\n stop=cast_int(value.stop),\n step=cast_int(value.step),\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h3",{id:"conversion-matrix"},"Conversion matrix"),(0,l.mdx)("p",null,"Below is the conversion matrix from various inputs to all supported types.\nInput are grouped by type."),(0,l.mdx)("table",null,(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null}),(0,l.mdx)("th",{parentName:"tr",align:null},"int()"),(0,l.mdx)("th",{parentName:"tr",align:null},"float()"),(0,l.mdx)("th",{parentName:"tr",align:null},"str()"),(0,l.mdx)("th",{parentName:"tr",align:null},"bool()"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018inf\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018nan\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"1,000,000"),(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u20181000000.0\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d (empty string)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"1"),(0,l.mdx)("td",{parentName:"tr",align:null},"1.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0.0,1.0,2.0]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[false,true,true]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1.0,","[2.0]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c1\u201d,","[\u201c2\u201d]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[true,","[true]","]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[a,1]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201ca\u201d,\u201d1\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10.0}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a: true}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0.0,1.0,2.-]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[false,true,true]","}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10,b:xyz}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d,b:\u201dxyz\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0.0,1.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c0\u201d,\u201c1\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(false,true)")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(a,b)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201ca\u201d,\u201db\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(1,a)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c1\u201d,\u201da\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0, 10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3e16a344.f004c423.js b/assets/js/3e16a344.f004c423.js new file mode 100644 index 0000000000..e1ee089721 --- /dev/null +++ b/assets/js/3e16a344.f004c423.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1796],{3905:function(e,n,t){t.r(n),t.d(n,{MDXContext:function(){return o},MDXProvider:function(){return u},mdx:function(){return x},useMDXComponents:function(){return p},withMDXComponents:function(){return s}});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(){return l=Object.assign||function(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=a.createContext({}),s=function(e){return function(n){var t=p(n.components);return a.createElement(e,l({},n,{components:t}))}},p=function(e){var n=a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(o.Provider,{value:n},e.children)},g={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=m(e,["components","mdxType","originalType","parentName"]),s=p(t),u=r,c=s["".concat(d,".").concat(u)]||s[u]||g[u]||l;return t?a.createElement(c,i(i({ref:n},o),{},{components:t})):a.createElement(c,i({ref:n},o))}));function x(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,d=new Array(l);d[0]=c;var i={};for(var m in n)hasOwnProperty.call(n,m)&&(i[m]=n[m]);i.originalType=e,i.mdxType="string"==typeof e?e:r,d[1]=i;for(var o=2;o bool:\n ...\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Calling function"',title:'"Calling','function"':!0},"func(10,foo) # Positional only\nfunc(a=10,b=foo) # Named only\nfunc(10,b=foo) # Mixed\nfunc(a=10,foo) # Error\n")))),(0,l.mdx)("p",null,"Note the lack of quotes in the examples above. Despite some similarities, this is ",(0,l.mdx)("strong",{parentName:"p"},"not Python"),"."),(0,l.mdx)("div",{className:"admonition admonition-important alert alert--info"},(0,l.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,l.mdx)("h5",{parentName:"div"},(0,l.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,l.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"important")),(0,l.mdx)("div",{parentName:"div",className:"admonition-content"},(0,l.mdx)("p",{parentName:"div"},"Hydra supports very specific functions. If you would like to have\nanother function added, please file an issue and explain the use case."))),(0,l.mdx)("h2",{id:"sweeps"},"Sweeps"),(0,l.mdx)("p",null,"Sweep overrides are used by Sweepers to determine what to do. For example,\none can instruct the Basic Sweeper to sweep over all combinations of the\nranges ",(0,l.mdx)("inlineCode",{parentName:"p"},"num1=range(0,3)")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"num2=range(0,3)")," - resulting in ",(0,l.mdx)("inlineCode",{parentName:"p"},"9")," jobs, each getting a\ndifferent pair of numbers from ",(0,l.mdx)("inlineCode",{parentName:"p"},"0"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"1")," and ",(0,l.mdx)("inlineCode",{parentName:"p"},"2"),"."),(0,l.mdx)("h3",{id:"choice-sweep"},"Choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def choice(\n *args: Union[str, int, float, bool, Dict[Any, Any], List[Any], ChoiceSweep]\n) -> ChoiceSweep:\n """\n A choice sweep over the specified values\n """\n')),(0,l.mdx)("p",null,"Choice sweeps are the most common sweeps.\nA choice sweep is described in one of two equivalent forms."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"db=mysql,postgresql # a comma separated list of two or more elements. \ndb=choice(mysql,postgresql) # choice\n")),(0,l.mdx)("h3",{id:"glob-choice-sweep"},"Glob choice sweep"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def glob(\n include: Union[List[str], str], exclude: Optional[Union[List[str], str]] = None\n) -> Glob:\n """\n A glob selects from all options in the config group.\n inputs are in glob format. e.g: *, foo*, *foo.\n :param include: a string or a list of strings to use as include globs\n :param exclude: a string or a list of strings to use as exclude globs\n :return: A Glob object\n """\n')),(0,l.mdx)("p",null,"Assuming the config group ",(0,l.mdx)("strong",{parentName:"p"},"schema")," with the options ",(0,l.mdx)("strong",{parentName:"p"},"school"),", ",(0,l.mdx)("strong",{parentName:"p"},"support")," and ",(0,l.mdx)("strong",{parentName:"p"},"warehouse"),":"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"schema=glob(*) # school,support,warehouse\nschema=glob(*,exclude=support) # school,warehouse\nschema=glob([s*,w*],exclude=school) # support,warehouse\n")),(0,l.mdx)("h3",{id:"range-sweep"},"Range sweep"),(0,l.mdx)("p",null,"Unlike Python, Hydra's range can be used with both integer and floating-point numbers.\nIn both cases, the range represents a discrete list of values."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def range(\n start: Union[int, float], stop: Optional[Union[int, float]] = None, step: Union[int, float] = 1\n) -> RangeSweep:\n """\n Range is defines a sweeep over a range of integer or floating-point values.\n For a positive step, the contents of a range r are determined by the formula\n r[i] = start + step*i where i >= 0 and r[i] < stop.\n For a negative step, the contents of the range are still determined by the formula\n r[i] = start + step*i, but the constraints are i >= 0 and r[i] > stop.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"num=range(5) # 0,1,2,3,4\nnum=range(0,5) # 0,1,2,3,4\nnum=range(0,5,2) # 0,2,4\nnum=range(0,10,3.3) # 0.0,3.3,6.6,9.9\nnum=range(-5,step=-1) # 0,-1,-2,-3,-4\n")),(0,l.mdx)("h3",{id:"interval-sweep"},"Interval sweep"),(0,l.mdx)("p",null,"An interval sweep represents all the floating point value between two values.\nThis is used by optimizing sweepers like Ax and Nevergrad. The basic sweeper does not support interval."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def interval(start: Union[int, float], end: Union[int, float]) -> IntervalSweep:\n """\n A continuous interval between two floating point values.\n value=interval(x,y) is interpreted as x <= value < y\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"interval(1.0,5.0) # 1.0 <= x < 5.0\ninterval(1,5) # 1.0 <= x < 5.0, auto-cast to floats\n")),(0,l.mdx)("h3",{id:"tag"},"Tag"),(0,l.mdx)("p",null,"With tags you can add arbitrary metadata to a sweep. The metadata can be used by advanced sweepers."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def tag(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None) -> Sweep:\n """\n Tags the sweep with a list of string tags.\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"tag(log,interval(0,1)) # 1.0 <= x < 1.0, tags=[log]\ntag(foo,bar,interval(0,1)) # 1.0 <= x < 1.0, tags=[foo,bar]\n")),(0,l.mdx)("h2",{id:"reordering-lists-and-sweeps"},"Reordering lists and sweeps"),(0,l.mdx)("h3",{id:"sort"},"sort"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def sort(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n reverse: bool = False,\n) -> Any:\n """\n Sort an input list or sweep.\n reverse=True reverses the order\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"# sweep\nsort(1,3,2) # ChoiceSweep(1,2,3)\nsort(1,3,2,reverse=true) # ChoiceSweep(3,2,1)\nsort(choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(sweep=choice(1,2,3)) # ChoiceSweep(1,2,3)\nsort(choice(1,2,3),reverse=true) # ChoiceSweep(3,2,1)\nsort(range(10,1)) # range in ascending order\nsort(range(1,10),reverse=true) # range in descending order\n\n# lists\nsort([1,3,2]) # [1,2,3]\nsort(list=[1,3,2]) # [1,2,3]\nsort(list=[1,3,2], reverse=true) # [3,2,1]\n\n# single value returned as is\nsort(1) # 1\n")),(0,l.mdx)("h3",{id:"shuffle"},"shuffle"),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Signature"',title:'"Signature"'},'def shuffle(\n *args: Union[ElementType, ChoiceSweep, RangeSweep],\n sweep: Optional[Union[ChoiceSweep, RangeSweep]] = None,\n list: Optional[List[Any]] = None,\n) -> Union[List[Any], ChoiceSweep, RangeSweep]:\n """\n Shuffle input list or sweep (does not support interval)\n """\n')),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Examples"',title:'"Examples"'},"shuffle(a,b,c) # shuffled a,b,c\nshuffle(choice(a,b,c)), shuffle(sweep=choice(a,b,c)) # shuffled choice(a,b,c)\nshuffle(range(1,10)) # shuffled range(1,10)\nshuffle([a,b,c]), shuffle(list=[a,b,c]) # shuffled list [a,b,c] \n")),(0,l.mdx)("h2",{id:"type-casting"},"Type casting"),(0,l.mdx)("p",null,"You can cast values and sweeps to ",(0,l.mdx)("inlineCode",{parentName:"p"},"int"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"float"),", ",(0,l.mdx)("inlineCode",{parentName:"p"},"bool")," or ",(0,l.mdx)("inlineCode",{parentName:"p"},"str"),"."),(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Example"',title:'"Example"'},"int(3.14) # 3 (int)\nint(value=3.14) # 3 (int)\nfloat(10) # 10.0 (float)\nstr(10) # \"10\" (str)\nbool(1) # true (bool)\nfloat(range(1,10)) # range(1.0,10.0)\nstr([1,2,3]) # ['1','2','3']\nstr({a:10}) # {a:'10'}\n")),(0,l.mdx)("p",null,"Below are pseudo code snippets that illustrates the differences between Python's casting and Hydra's casting."),(0,l.mdx)("h4",{id:"casting-string-to-bool"},"Casting string to bool"),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def bool(value: Any) -> bool:\n if isinstance(value, str):\n return len(value) > 0\n else:\n return bool(value)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},'def bool(s: str) -> bool:\n if isinstance(value, str):\n if value.lower() == "false":\n return False\n elif value.lower() == "true":\n return True\n else:\n raise ValueError()\n return bool(value)\n')))),(0,l.mdx)("h4",{id:"casting-lists"},"Casting lists"),(0,l.mdx)("p",null,"Casting lists results in a list where each element is recursively cast.\nFailure to cast an element in the list fails the cast of the list."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, list):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(v, list):\n return list(map(cast_int, v))\n else:\n return int(v)\n\n\n")))),(0,l.mdx)("h4",{id:"casting-dicts"},"Casting dicts"),(0,l.mdx)("p",null,"Casting dicts results in a dict where values are recursively cast, but keys are unchanged.\nFailure to cast a value in the dict fails the cast of the entire dict."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n raise TypeError()\n else:\n return int(v)\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, dict):\n return apply_to_values(\n value, cast_int\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h4",{id:"casting-ranges"},"Casting ranges"),(0,l.mdx)("p",null,"Ranges can be cast to float or int, resulting in start, stop and step being cast and thus the range elements being cast."),(0,l.mdx)("div",{className:"row"},(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Python"',title:'"Python"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n raise TypeError()\n else:\n return int(v)\n\n\n\n\n"))),(0,l.mdx)("div",{className:"col col--6"},(0,l.mdx)("pre",null,(0,l.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Hydra"',title:'"Hydra"'},"def cast_int(value: Any):\n if isinstance(value, RangeSweep):\n return RangeSweep(\n start=cast_int(value.start),\n stop=cast_int(value.stop),\n step=cast_int(value.step),\n )\n else:\n return int(v)\n")))),(0,l.mdx)("h3",{id:"conversion-matrix"},"Conversion matrix"),(0,l.mdx)("p",null,"Below is the conversion matrix from various inputs to all supported types.\nInput are grouped by type."),(0,l.mdx)("table",null,(0,l.mdx)("thead",{parentName:"table"},(0,l.mdx)("tr",{parentName:"thead"},(0,l.mdx)("th",{parentName:"tr",align:null}),(0,l.mdx)("th",{parentName:"tr",align:null},"int()"),(0,l.mdx)("th",{parentName:"tr",align:null},"float()"),(0,l.mdx)("th",{parentName:"tr",align:null},"str()"),(0,l.mdx)("th",{parentName:"tr",align:null},"bool()"))),(0,l.mdx)("tbody",{parentName:"table"},(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c0.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"inf"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018inf\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"nan"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u2018nan\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"1,000,000"),(0,l.mdx)("td",{parentName:"tr",align:null},"1e6"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u20181000000.0\u2019"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"foo"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d (empty string)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"10"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"10.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c10.0\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c","[1,2,3]","\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201c{a:10}\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"true"),(0,l.mdx)("td",{parentName:"tr",align:null},"1"),(0,l.mdx)("td",{parentName:"tr",align:null},"1.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201ctrue\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"true")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"false"),(0,l.mdx)("td",{parentName:"tr",align:null},"0"),(0,l.mdx)("td",{parentName:"tr",align:null},"0.0"),(0,l.mdx)("td",{parentName:"tr",align:null},"\u201cfalse\u201d"),(0,l.mdx)("td",{parentName:"tr",align:null},"false")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0,1,2]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[0.0,1.0,2.0]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[false,true,true]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1,","[2]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[1.0,","[2.0]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201c1\u201d,","[\u201c2\u201d]","]"),(0,l.mdx)("td",{parentName:"tr",align:null},"[true,","[true]","]")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"[a,1]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"[\u201ca\u201d,\u201d1\u201d]"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10.0}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a: true}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0,1,2]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[0.0,1.0,2.-]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[\u201c0\u201d,\u201d1\u201d,\u201d2\u201d]","}"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:","[false,true,true]","}")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"{a:10,b:xyz}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"{a:\u201d10\u201d,b:\u201dxyz\u201d}"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0,1)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(0.0,1.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c0\u201d,\u201c1\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(false,true)")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(a,b)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201ca\u201d,\u201db\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"choice(1,a)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"choice(\u201c1\u201d,\u201da\u201d)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1, 2)"),(0,l.mdx)("td",{parentName:"tr",align:null},"interval(1.0, 2.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")),(0,l.mdx)("tr",{parentName:"tbody"},(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0, 10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1,10)"),(0,l.mdx)("td",{parentName:"tr",align:null},"range(1.0,10.0)"),(0,l.mdx)("td",{parentName:"tr",align:null},"error"),(0,l.mdx)("td",{parentName:"tr",align:null},"error")))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3e5c2e49.db4c3759.js b/assets/js/3e5c2e49.db4c3759.js new file mode 100644 index 0000000000..f07ed80077 --- /dev/null +++ b/assets/js/3e5c2e49.db4c3759.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4410],{3905:function(e,t,n){n.r(t),n.d(t,{MDXContext:function(){return d},MDXProvider:function(){return u},mdx:function(){return g},useMDXComponents:function(){return c},withMDXComponents:function(){return m}});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),m=function(e){return function(t){var n=c(t.components);return a.createElement(e,i({},t,{components:n}))}},c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,f=m["".concat(o,".").concat(u)]||m[u]||p[u]||i;return n?a.createElement(f,l(l({ref:t},d),{},{components:n})):a.createElement(f,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),c=function(e){return function(t){var r=d(t.components);return n.createElement(e,o({},t,{components:r}))}},d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):u(u({},t),e)),r},m=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=d(r),m=i,f=c["".concat(a,".").concat(m)]||c[m]||p[m]||o;return r?n.createElement(f,u(u({ref:t},l),{},{components:r})):n.createElement(f,u({ref:t},l))}));function g(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=f;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u.mdxType="string"==typeof e?e:i,a[1]=u;for(var l=2;l=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),c=function(e){return function(t){var r=d(t.components);return n.createElement(e,o({},t,{components:r}))}},d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):u(u({},t),e)),r},m=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=d(r),m=i,f=c["".concat(a,".").concat(m)]||c[m]||p[m]||o;return r?n.createElement(f,u(u({ref:t},l),{},{components:r})):n.createElement(f,u({ref:t},l))}));function g(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=f;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u.mdxType="string"==typeof e?e:i,a[1]=u;for(var l=2;l=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var s=n.createContext({}),l=function(t){return function(e){var r=p(e.components);return n.createElement(t,i({},e,{components:r}))}},p=function(t){var e=n.useContext(s),r=e;return t&&(r="function"==typeof t?t(e):c(c({},e),t)),r},f=function(t){var e=p(t.components);return n.createElement(s.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(t,e){var r=t.components,o=t.mdxType,i=t.originalType,a=t.parentName,s=u(t,["components","mdxType","originalType","parentName"]),l=p(r),f=o,m=l["".concat(a,".").concat(f)]||l[f]||d[f]||i;return r?n.createElement(m,c(c({ref:e},s),{},{components:r})):n.createElement(m,c({ref:e},s))}));function y(t,e){var r=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var i=r.length,a=new Array(i);a[0]=m;var c={};for(var u in e)hasOwnProperty.call(e,u)&&(c[u]=e[u]);c.originalType=t,c.mdxType="string"==typeof t?t:o,a[1]=c;for(var s=2;s=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var s=n.createContext({}),l=function(t){return function(e){var r=p(e.components);return n.createElement(t,i({},e,{components:r}))}},p=function(t){var e=n.useContext(s),r=e;return t&&(r="function"==typeof t?t(e):c(c({},e),t)),r},f=function(t){var e=p(t.components);return n.createElement(s.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(t,e){var r=t.components,o=t.mdxType,i=t.originalType,a=t.parentName,s=u(t,["components","mdxType","originalType","parentName"]),l=p(r),f=o,m=l["".concat(a,".").concat(f)]||l[f]||d[f]||i;return r?n.createElement(m,c(c({ref:e},s),{},{components:r})):n.createElement(m,c({ref:e},s))}));function y(t,e){var r=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var i=r.length,a=new Array(i);a[0]=m;var c={};for(var u in e)hasOwnProperty.call(e,u)&&(c[u]=e[u]);c.originalType=t,c.mdxType="string"==typeof t?t:o,a[1]=c;for(var s=2;s=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),d=function(e){return function(t){var n=c(t.components);return r.createElement(e,o({},t,{components:n}))}},c=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=c(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(i,".").concat(m)]||d[m]||p[m]||o;return n?r.createElement(f,l(l({ref:t},u),{},{components:n})):r.createElement(f,l({ref:t},u))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var u=2;u None:\n print(OmegaConf.to_yaml(cfg))\n\n\nif __name__ == "__main__":\n my_app()\n')),(0,o.mdx)("p",null,"Running ",(0,o.mdx)("inlineCode",{parentName:"p"},"my_app.py")," loads the mysql config option by default:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py\ndb:\n driver: mysql\n ...\n")),(0,o.mdx)("p",null,"You can override the default option via the command line:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-yaml"},"$ python my_app.py db=postgresql\ndb:\n driver: postgresql\n ...\n")),(0,o.mdx)("h3",{id:"a-note-about-composition-order"},"A Note about composition order"),(0,o.mdx)("p",null,"The default composition order in Hydra is that values defined in a config are merged into values introduced from configs in the Defaults List - or in other words - overriding them.\nThis behavior can be unintuitive when your primary config is a Structured Config, like in the example above.\nFor example, if the primary config is:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:"{6}","{6}":!0},'@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [\n "debug/activate",\n # If you do not specify _self_, it will be appended to the end of the defaults list by default.\n "_self_"\n ])\n\n debug: bool = False\n')),(0,o.mdx)("p",null,"And ",(0,o.mdx)("inlineCode",{parentName:"p"},"debug/activate.yaml")," is overriding the ",(0,o.mdx)("inlineCode",{parentName:"p"},"debug")," flag to ",(0,o.mdx)("inlineCode",{parentName:"p"},"True"),", the composition order would be such that debug ends up being ",(0,o.mdx)("inlineCode",{parentName:"p"},"False"),".",(0,o.mdx)("br",{parentName:"p"}),"\n","To get ",(0,o.mdx)("inlineCode",{parentName:"p"},"debug/activate.yaml")," to override this config, explicitly specify ",(0,o.mdx)("inlineCode",{parentName:"p"},"_self_")," before ",(0,o.mdx)("inlineCode",{parentName:"p"},"debug/activate.yaml"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:"{4}","{4}":!0},'@dataclass\nclass Config:\n defaults: List[Any] = field(default_factory=lambda: [\n "_self_",\n "debug/activate",\n ])\n\n debug: bool = False\n')),(0,o.mdx)("p",null,"See ",(0,o.mdx)("a",{parentName:"p",href:"/docs/1.3/advanced/defaults_list#composition-order"},"Composition Order")," for more information."),(0,o.mdx)("h3",{id:"requiring-users-to-specify-a-default-list-value"},"Requiring users to specify a default list value"),(0,o.mdx)("p",null,"Set ",(0,o.mdx)("inlineCode",{parentName:"p"},"db")," as ",(0,o.mdx)("inlineCode",{parentName:"p"},"MISSING")," to require the user to specify a value on the command line."),(0,o.mdx)("div",{className:"row"},(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-python",metastring:'title="Defaults list with a missing db"',title:'"Defaults',list:!0,with:!0,a:!0,missing:!0,'db"':!0},'defaults = [\n {"db": MISSING}\n]\n\n\n'))),(0,o.mdx)("div",{className:"col col--6"},(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-text",metastring:'title="Output"',title:'"Output"'},"$ python my_app.py\nYou must specify 'db', e.g, db=