Distributed AI
Uploading Dataset
Upload the dataset to obtain a file path as a parameter of other APIs.
POST
https://www.phoenix.global/sdk/computation/deAI/uploadFile
Upload a file to server
Headers
token*
string
The access token generated in the previous step
Content-Type*
multipart/form-data
content type
Request Body
file*
file
Dataset file
{
"code":200,
"msg":"[email protected]/2023-10-24T12:07:12Zy_train.csv"
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/uploadFile' \
--header 'token: eyJhbGciOiJIUzIxxxxxxxxxxxxx' \
--form 'file=@"your local file path"'
Evaluating CCD Cost for CNN
POST
https://www.phoenix.global/sdk/computation/deAI/queryGuarantee
Evaluate the number of ccds required for training CNN model
Headers
token*
string
The access token generated in the previous step
Request Body
model*
string
Model name, which is CNN
epoch*
integer
The epoch for training
jobName*
string
Job name
x_train*
string
The path of the training dataset, obtained by calling the upload file api
y_train
string
The path of the label dataset, obtained by calling the upload file api
train_shard*
float
A decimal number greater than 0 and less than 1, indicating the proportion used for training
scale_ratio
integer
The number of colors in the picture
category*
int
Number of categories
channel
int
Image channel
{
"code": 200,
"msg": "success",
"ccd_cost": 27870365208168000
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/queryGuarantee' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2OTgxNTg1ODl9.lZPScQLs1ScGS6KPqUp1lg5XdOqnGLQyOsO3wMugps8' \
--header 'Content-Type: application/json' \
--data-raw '{
"epoch": 2,
"jobName": "CNN Classification Job",
"model": "CNN",
"scale_ratio": 255,
"category": 3,
"channel": 1,
"train_shard": 0.8,
"x_train": "[email protected]/2023-10-24T13:42:46Zx_train.zip",
"y_train": "[email protected]/2023-10-24T13:22:36Zy_train.csv"
}'
Evaluating CCD Cost for LSTM
POST
https://www.phoenix.global/sdk/computation/deAI/queryGuarantee
Evaluate the number of ccds required for training LSTM model
Headers
token*
string
The access token generated in the previous step
Request Body
jobName*
string
Job name
model*
string
Model name, which is LSTM
epoch*
integer
The epoch for training
x_train*
string
The path of the training dataset, obtained by calling the upload file api
train_shard*
float
A decimal number greater than 0 and less than 1, indicating the proportion used for training
input_width*
integer
Please refer to the website: https://www.tensorflow.org/tutorials/structured_data/time_series#data_windowing
label_width*
integer
Please refer to the website: https://www.tensorflow.org/tutorials/structured_data/time_series#data_windowing
shift*
integer
Please refer to the website: https://www.tensorflow.org/tutorials/structured_data/time_series#data_windowing
sequence_stride*
integer
Please refer to the website: https://www.tensorflow.org/tutorials/structured_data/time_series#data_windowing
sampling_rate
integer
Please refer to the website: https://www.tensorflow.org/tutorials/structured_data/time_series#data_windowing
{
"code": 200,
"msg": "success",
"ccd_cost": 27870365208168000
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/queryGuarantee' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2OTgxNTg1ODl9.lZPScQLs1ScGS6KPqUp1lg5XdOqnGLQyOsO3wMugps8' \
--header 'Content-Type: application/json' \
--data-raw '{
"epoch": 2,
"jobName": "LSTM Job",
"model": "LSTM",
"train_shard": 0.8,
"x_train": "[email protected]/2023-10-24T13:53:15Zjena_climate.csv",
"input_width":24,
"label_width":24,
"shift":24,
"sequence_stride":1,
"sampling_rate":1
}'
Creating a CNN Job
POST
https://www.phoenix.global/sdk/computation/deAI/createJob
Creating a CNN job
Headers
token*
string
The access token generated in the previous step
Request Body
jobName*
string
Job Name
batchSize*
integer
batch size
computation*
string
Computation type, which is Distributed AI
{
"code":200,
"msg":"Success",
"data":"59576164105114941297104078936238635731163357384303362249410479244945241708329"
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/createJob' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2OTgxNTg1ODl9.lZPScQLs1ScGS6KPqUp1lg5XdOqnGLQyOsO3wMugps8' \
--header 'Content-Type: application/json' \
--data-raw '{
"jobName": "CNN Classification Job",
"computation": "Distributed AI",
"batchSize": 64
}'
Creating a LSTM Job
POST
https://www.phoenix.global/sdk/computation/deAI/createJob
Creating a LSTM Job
Headers
token*
string
The access token generated in the previous step
Request Body
jobName*
string
Job name
batchSize
integer
batch size
computation
string
Computation type, which is Distributed AI
{
"code":200,
"msg":"Success",
"data":"59576164105114941297104078936238635731163357384303362249410479244945241708329"
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/createJob' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2OTgxNTg1ODl9.lZPScQLs1ScGS6KPqUp1lg5XdOqnGLQyOsO3wMugps8' \
--header 'Content-Type: application/json' \
--data-raw '{
"jobName": "LSTM Job",
"computation": "Distributed AI",
"batchSize": 64
}'
Evaluating CCD Cost for Inference
POST
https://www.phoenix.global/sdk/computation/deAI/inferenceCost
Evaluating ccd cost for inference
Headers
token*
string
The access token generated in the previous step
Request Body
data_path*
string
The path of the dataset, obtained by calling the upload file api
jobID*
string
The job id of a distributed AI job
{
"code": 200,
"msg": "success",
"ccd_cost": 13271602480080000
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/inferenceCost' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3MDAwMzQ2NTN9.0NhuhoPX-AuIxjRiF0V4N-idYr_3tAjTUEafOD67DS0' \
--header 'Content-Type: application/json' \
--data-raw '{
"data_path": "[email protected]/2023-11-15T06:00:19Zx_train.zip",
"jobID": "86336785146289395195200824626469818031842412882953927198307248471561534896799"
}'
Inference
POST
https://www.phoenix.global/sdk/computation/deAI/inference
Inference
Headers
token*
string
The access token generated in the previous step
Request Body
jobID*
string
The job id of a distributed AI job
{
"code": 200,
"msg": "Inference success",
"infer_id": 13
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/inference' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3MDAwMzQ2NTN9.0NhuhoPX-AuIxjRiF0V4N-idYr_3tAjTUEafOD67DS0' \
--header 'Content-Type: application/json' \
--data '{
"jobID": "86336785146289395195200824626469818031842412882953927198307248471561534896799"
}'
Querying Inference Result
POST
https://www.phoenix.global/sdk/computation/deAI/queryInfer
Querying a inference result by id
Headers
token*
string
The access token generated in the previous step
Request Body
id*
string
The inference id, obtained by calling the inference api
{
"code": 200,
"msg": "success",
"data": {
"tx_hash": "0x76233b90445f34e6c0c19d056b3d04ec06c2f36844c6b777c74493a9b3ea3124",
"result": "https://phoenix.global/ai/resultFiles/[email protected]_5CNN_mnist.csv",
"submitTime": 1700037265,
"ccd_cost": "0.01327160248"
}
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/queryInfer' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3MDAwMzkzMjV9.gKHqa2-Q7zxFcEle0bzv-o8x2__1949TWDclZrAK51Q' \
--header 'Content-Type: application/json' \
--data '{
"id": 21
}'
Querying Inference Result List
POST
https://www.phoenix.global/sdk/computation/deAI/queryInferList
Querying inference result list
Headers
token*
string
The access token generated in the previous step
Request Body
pageNo*
integer
Page number
pageSize*
integer
Page size
jobID*
string
Job id
{
"code": 200,
"msg": "success",
"size": 10,
"page": 1,
"totalPages": 1,
"totalCount": 2,
"data": [
{
"tx_hash": "0x76233b90445f34e6c0c19d056b3d04ec06c2f36844c6b777c74493a9b3ea3124",
"result": "https://phoenix.global/ai/resultFiles/[email protected]_5CNN_mnist.csv",
"submitTime": 1700037265,
"ccd_cost": "0.01327160248"
},
{
"tx_hash": "0x7ff8ee03deb93d608503bb59c183ecc9ed0e16be9599289af0938b4c20bdd91c",
"result": "https://phoenix.global/ai/resultFiles/[email protected]_4CNN_mnist.csv",
"submitTime": 1700037108,
"ccd_cost": "0.01327160248"
}
]
}
The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/deAI/queryInferList' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3MDAwNDM4ODN9.i68m1VKJ894NxAd83HXGLUkvrobmAJ3yWo3aJPs4YT4' \
--header 'Content-Type: application/json' \
--data '{
"jobID": "86336785146289395195200824626469818031842412882953927198307248471561534896799",
"pageNo": 1,
"pageSize": 10
}'