-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from CUNY-CL/data0
Migrates to data modules
- Loading branch information
Showing
24 changed files
with
881 additions
and
969 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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
"""Data classes.""" | ||
|
||
import argparse | ||
|
||
from .. import defaults | ||
from .datamodules import DataModule # noqa: F401 | ||
from .batches import PaddedBatch, PaddedTensor # noqa: F401 | ||
from .indexes import Index # noqa: F401 | ||
|
||
|
||
def add_argparse_args(parser: argparse.ArgumentParser) -> None: | ||
"""Adds data options to the argument parser. | ||
Args: | ||
parser (argparse.ArgumentParser). | ||
""" | ||
parser.add_argument( | ||
"--source_col", | ||
type=int, | ||
default=defaults.SOURCE_COL, | ||
help="1-based index for source column. Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--target_col", | ||
type=int, | ||
default=defaults.TARGET_COL, | ||
help="1-based index for target column. Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--features_col", | ||
type=int, | ||
default=defaults.FEATURES_COL, | ||
help="1-based index for features column; " | ||
"0 indicates the model will not use features. " | ||
"Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--source_sep", | ||
type=str, | ||
default=defaults.SOURCE_SEP, | ||
help="String used to split source string into symbols; " | ||
"an empty string indicates that each Unicode codepoint " | ||
"is its own symbol. Default: %(default)r.", | ||
) | ||
parser.add_argument( | ||
"--target_sep", | ||
type=str, | ||
default=defaults.TARGET_SEP, | ||
help="String used to split target string into symbols; " | ||
"an empty string indicates that each Unicode codepoint " | ||
"is its own symbol. Default: %(default)r.", | ||
) | ||
parser.add_argument( | ||
"--features_sep", | ||
type=str, | ||
default=defaults.FEATURES_SEP, | ||
help="String used to split features string into symbols; " | ||
"an empty string indicates that each Unicode codepoint " | ||
"is its own symbol. Default: %(default)r.", | ||
) | ||
parser.add_argument( | ||
"--tied_vocabulary", | ||
action="store_true", | ||
default=defaults.TIED_VOCABULARY, | ||
help="Share source and target embeddings. Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--no_tied_vocabulary", | ||
action="store_false", | ||
dest="tied_vocabulary", | ||
default=True, | ||
) | ||
parser.add_argument( | ||
"--batch_size", | ||
type=int, | ||
default=defaults.BATCH_SIZE, | ||
help="Batch size. Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--max_source_length", | ||
type=int, | ||
default=defaults.MAX_SOURCE_LENGTH, | ||
help="Maximum source string length. Default: %(default)s.", | ||
) | ||
parser.add_argument( | ||
"--max_target_length", | ||
type=int, | ||
default=defaults.MAX_TARGET_LENGTH, | ||
help="Maximum target string length. Default: %(default)s.", | ||
) |
File renamed without changes.
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
Oops, something went wrong.