this package allows you to fetch the arguments of a function from a simple search string, matching a function within a module.
import pandas
loss_fn = find_fn(lib=pandas, module="dataframe")
get_required(loss_fn)
Output:
{'src': 'DataFrame.__init__',
'required': [],
'optional': ['data', 'index', 'columns', 'dtype', 'copy']}
you can install the package using pip:
pip install get-args
or locally:
git clone <repo>
cd <repo>
pip install .
the package can be useful when you want to be flexible with arguments passed to e.g. a user interface, where you want to call a specific function.
it was developed to handle the many loss functions inside the sentence_transformers.losses
.