mirror of
https://github.com/facebookresearch/fairseq.git
synced 2024-09-11 17:25:31 +03:00
'--user-dir' documentation (correct) (#447)
Summary: Command line option --user-dir documented in docs/overview.rst Pull Request resolved: https://github.com/pytorch/fairseq/pull/447 Differential Revision: D13674744 Pulled By: myleott fbshipit-source-id: 17049ee5c9f692f5298ef9fa7381ee583f269cde
This commit is contained in:
parent
b15f5f5384
commit
ebaf8c5030
@ -46,3 +46,25 @@ decorators, for example::
|
|||||||
Once registered, new plug-ins can be used with the existing :ref:`Command-line
|
Once registered, new plug-ins can be used with the existing :ref:`Command-line
|
||||||
Tools`. See the Tutorial sections for more detailed walkthroughs of how to add
|
Tools`. See the Tutorial sections for more detailed walkthroughs of how to add
|
||||||
new plug-ins.
|
new plug-ins.
|
||||||
|
|
||||||
|
**Loading plug-ins from another directory**
|
||||||
|
|
||||||
|
New plug-ins can be defined in a custom module stored in the user system. In order to import the module, and make the plugin available to *fairseq*, the command line supports the ``--user-dir`` flag that can be used to specify a custom location for additional modules to load into *fairseq*.
|
||||||
|
|
||||||
|
For example, assuming this directory tree::
|
||||||
|
|
||||||
|
/home/user/my-module/
|
||||||
|
└── __init__.py
|
||||||
|
|
||||||
|
with ``__init__.py``::
|
||||||
|
|
||||||
|
from fairseq.models import register_model_architecture
|
||||||
|
from fairseq.models.transformer import transformer_vaswani_wmt_en_de_big
|
||||||
|
|
||||||
|
@register_model_architecture('transformer', 'my_transformer')
|
||||||
|
def transformer_mmt_big(args):
|
||||||
|
transformer_vaswani_wmt_en_de_big(args)
|
||||||
|
|
||||||
|
it is possible to invoke the ``train.py`` script with the new architecture with::
|
||||||
|
|
||||||
|
python3 train.py ... --user-dir /home/user/my-module -a my_transformer --task translation
|
||||||
|
Loading…
Reference in New Issue
Block a user