How Do I Create a Training Job When a Dependency Package Is Referenced by the Model to Be Trained?
When a model references a dependency, select a common framework to create training jobs. Additionally, place the corresponding file or installation package in the code directory. The requirements vary depending on the type of the dependency package you use.
- Open source installation packages
Installation using the source code from GitHub is not supported.
Create a file named pip-requirements.txt in the code directory, and specify the name and version number of the dependency package in the file. The format is [Package name]==[Version].
Take for example, an OBS path specified by Code Dir that contains model files and the pip-requirements.txt file. The code directory structure would be as follows:
|---OBS path to the model boot file |---model.py #Model boot file |---pip-requirements.txt #Defined configuration file, which specifies the name and version of the dependency packageThe following shows the content of the pip-requirements.txt file:
alembic==0.8.6 bleach==1.4.3 click==6.6
- WHL packages
If the training background does not support the download of open source installation packages or use of user-compiled WHL packages, the system cannot automatically download and install the package. In this case, place the WHL package in the code directory, create a file named pip-requirements.txt, and specify the name of the WHL package in the file. The dependency package must be a .whl file.
Take for example, an OBS path specified by Code Dir that contains model files, the .whl file, and the pip-requirements.txt file. The code directory structure would be as follows:
|---OBS path to the model boot file |---model.py #Model boot file |---XXX.whl #Dependency package. If multiple dependencies are required, place multiple dependency packages here. |---pip-requirements.txt #Defined configuration file, which specifies the name of the dependency packageThe following shows the content of the pip-requirements.txt file:
numpy-1.15.4-cp36-cp36m-manylinux1_x86_64.whl tensorflow-1.8.0-cp36-cp36m-manylinux1_x86_64.whl
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.