Skip to main content

Command line tools bayes Basic Introduction

HyperAI Provided a command-line tool bayes Convenient to directly interact with on the command line interface HyperAI Interaction between services. Compared to directly in web Interface for interaction. Command line tools are available "establish Python script" "Upload dataset" Many aspects will be simpler and more efficient.

Install

stay install bayes Command line tools It provides a detailed introduction on how to install command-line tools on different platforms. If it is through GitHub Download command line tools. Suggest placing it /usr/local/bin This type of pre added environment variable PATH The directory. Easy to type in any directory bayes Visit.in the light of Windows The operation of adding environment variables can be found in here.

$ bayes version

HyperAI The version number is v0.4.0

Type in the command line bayes version After seeing the above information explanation bayes The tool has been successfully installed. By command bayes login Login Account.

$ bayes login username

Please enter username The password:
username Successfully logged in HyperAI

Then we passed through bayes -h You can see what specific operations can be performed:

$ bayes -h

HyperAI Command line tools

usage:
bayes [Sub command]

Available sub commands:
data Dataset related
gear Container related
help Help information for each sub command
login Sign in
logout cancellation
ssh ssh relevant
status login information
upgrade Upgrade Command Line Tools
version Version information

Available options:
--version see bayes Version information
-h, --help see bayes The Help
-v, --v View detailed error information

use "bayes [command] --help" Get more information about this command.

Quick Start

Sign in

$ bayes login username

Please enter username The password:
username Successfully logged in HyperAI
If needed to use SSH. Please call again bayes ssh init command

Follow the prompts. Execute command bayes ssh init increase ssh to configure. Convenient to use ssh Accessing containers. For more information, please refer to adopt SSH Connecting to Running Jupyter implement.

Initialize container

Create a new directory. And initialize a new container in that directory:

$ mkdir new-bayes-test
$ cd new-bayes-test
$ bayes gear init new-bayes-test

Container initialization successful

List the current directory:

$ ls -a

. .. .HyperAIgear .HyperAIignore HyperAI.yaml

You can see that three files have been generated:

  • .HyperAIgear Saved the metadata of the current container. Please do not delete.
  • .HyperAIignore With .gitignore similar. Used to ignore unwanted content in the directory when uploading data or code. Detailed documentation can be found at gitignore.
  • HyperAI.yaml HyperAI Command line configuration document. See details HyperAI configuration file.

Create a Python Script task

Create a simple main.py file:

$ cat <<EOF > main.py
import time

for i in range(100):
time.sleep(1)
print(i)

print('done')
EOF

Execute command:

$ bayes gear run task -f -- python main.py

Sending upload request to server...
The server has responded
Reading file list, please wait a moment...
Excluded from .HyperAIignore Neglected files and folders...
Shared Files 2 individual
Compressing code...
Compressed code completed
Initializing upload in progress...
Uploading compressed file. Total upload size: 2.06 KiB
2.06 KiB / 2.06 KiB [==========================================================] 100 % 11.37 KiB/s
Cleaning work in progress
Code uploaded successfully
Requesting the server to create a container...
Container created successfully
Open webpage https://hyperai.com/console/username/jobs/uiqzq4uz5zzz Can view containers new-bayes-test Detailed Information
Container in operation
Container log:
0
1
2
...
95
96
97
98
99
done
Container execution completed

For more information, please refer to use bayes Manage containers.

Upgrade

You can easily upgrade our system by using the following command CLI tool:

$ bayes upgrade

Using Philosophy

bayes Command line tools are intended to supplement web Shortcomings in interface operations. Enhance the experience of operations that are more suitable for the command-line interface; Not to completely detach users web Independently used interface. Especially in the creation of datasets. Python Compared to creating scripts web The operation process of the interface has been greatly improved. We will focus on introducing these two scenarios later.

Command line tools provide many commands to facilitate users in switching from the command line interface to web Interface to view the contents of containers or data.conversely, future web The end will also add more command line operation prompts. Convenient for users to shuttle between two interfaces.

Stay Jupyter Using command-line tools in the workspace

Currently, command-line tools have been integrated into Jupyter In the workspace, stay Jupyter Open in the middle "Terminal (Command line terminal)" The following prompt will appear later:

Follow the prompts to enter commands bayes gear init Automatically complete account login afterwards. And initialize HyperAI.yaml file (For more information on configuration files, please refer to HyperAI configuration file).