-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto generate a config from a dataset
- Loading branch information
1 parent
8cc5c50
commit 905a2e2
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import argparse | ||
|
||
import logging | ||
|
||
from ludwig import automl | ||
from ludwig.utils import defaults | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
LOG = logging.getLogger(__name__) | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Render a Ludwig config') | ||
parser.add_argument('--dataset', type=str, help='Path to the dataset file', required=True) | ||
parser.add_argument('--output_feature', type=str, help='Name for the output feature', required=True) | ||
parser.add_argument('--output', type=str, help='Path for the output file', required=True) | ||
args = parser.parse_args() | ||
|
||
|
||
args_init = ["--dataset", args.dataset, "--target", args.output_feature, "--output", args.output] | ||
automl.cli_init_config(args_init) | ||
args_render = ["--config", args.output, "--output", args.output] | ||
defaults.cli_render_config(args_render) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<tool id="ludwig_config_generator" name="Ludwig Config Generator" version="@VERSION@" profile="@PROFILE@"> | ||
<description>Auto-generate a config file from a dataset for Ludwig training.</description> | ||
<macros> | ||
<import>ludwig_macros.xml</import> | ||
</macros> | ||
<expand macro="python_requirements" /> | ||
<expand macro="macro_stdio" /> | ||
<version_command>echo "@VERSION@"</version_command> | ||
<command> | ||
<![CDATA[ | ||
#if $input_file | ||
ln -sf '$input_file' "`pwd`/${input_file.element_identifier}"; | ||
#end if | ||
python '$__tool_directory__/ludwig_autogencofig.py' | ||
#if $input_file | ||
--dataset "`pwd`/${input_file.element_identifier}" | ||
#end if | ||
--output_feature '$output_feature' | ||
--output '$output' | ||
]]> | ||
</command> | ||
<inputs> | ||
<param name="input_file" type="data" label="Select CSV File" format="tabular,csv,h5,json,txt" help="Choose a dataset file for processing"> | ||
|
||
</param> | ||
|
||
<!-- <param name="output_feature" type="" data_ref="input_file" multiple="True" numerical="False" label="Output Feature"> --> | ||
<param argument="output_feature" type="text" value="" label="Output Feature" /> | ||
<param name="config" type="text" area="true" /> | ||
</inputs> | ||
|
||
<outputs> | ||
<data name="output" format="yaml" label="${tool.name}" /> | ||
</outputs> | ||
|
||
<tests> | ||
<test> | ||
<!-- TO DO --> | ||
</test> | ||
</tests> | ||
</tool> |