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
Built Distribution
File details
Details for the file hf_argparser-0.1.1.tar.gz
.
File metadata
- Download URL: hf_argparser-0.1.1.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.9.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9290e503b85eadd7ee90cb2790eaeefc8e2d593bfd1bbff745af435f5dcc83bc
|
|
MD5 |
5c876f9fab1b55ce43a9f9e33b991a24
|
|
BLAKE2b-256 |
5b318fc8e22c8b05dc68c97fd483017ecda08c48e478a77a94f492864afceadb
|
File details
Details for the file hf_argparser-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: hf_argparser-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.9.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7e8766e5509486b3a88fcb38cbc5a45fc907628762bd86faebb76ad9a0f6541e
|
|
MD5 |
1dcc2cb893e17e50ecf5fb27f27f4b55
|
|
BLAKE2b-256 |
a08a55985913b461883f9fe6c9979bdfb1e6e3f9b43121ff3010b7511f28aa00
|