Standalone version of the HuggingFace ArgParser from the Transformers library
Project description
HF Argparser
Standalone Argument Parser from HuggingFace Transformers.
This is a standalone version of the argument parser used in the HuggingFace Transformers library. It is a simple wrapper around the argparse
library that allows you to easily define your command-line arguments for your scripts using dataclasses.
Installation
pip install hf-argparser
Usage
from dataclasses import dataclass
from hf_argparser import HfArgumentParser, HFArg
@dataclass
class AddArgs():
x: int
y: int
@dataclass
class OutputArgs():
output_file: str = field(
default=None,
metadata={'help': 'output filename'})
parser = HfArgumentParser([AddArgs, OutputArgs])
add_args, output_args, unknown_args = parser.parse_args_into_dataclasses(
return_remaining_strings=True)
return add_args, output_args, unknown_args
Above code is taken from this post by @kenilc.
See the Transformers documentation for more information on how to use the HfArgumentParser
.
Todo
- [] Automate pulling new changes to
hf_argparser
fromtransformers
repo. - [] Automate creating new releases on PyPi.
- [] Add tests.
- [] Improve README.
Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hf_argparser-0.1.1.tar.gz
(17.6 kB
view hashes)
Built Distribution
Close
Hashes for hf_argparser-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e8766e5509486b3a88fcb38cbc5a45fc907628762bd86faebb76ad9a0f6541e |
|
MD5 | 1dcc2cb893e17e50ecf5fb27f27f4b55 |
|
BLAKE2b-256 | a08a55985913b461883f9fe6c9979bdfb1e6e3f9b43121ff3010b7511f28aa00 |