General Practice
This page will introduce you how to create a model that will fits into the FLock process
The main usage of SDK:
Define the model standard. Therefore, when create model you need to define the following structure for FLock client to pick up the function and run.
init_dataset
- define as a function that will call data preprocessing functiontrain
- function that will run the training.evaluate
- function that will evaluate performanceaggregate
- function that will aggregate all data
Pinata Script
The main usage of this Pinata script is to upload a file to IPFS (InterPlanetary File System) using the Pinata cloud service. The script defines a function to handle the file pinning and uses an API key and secret obtained from environment variables for authentication. When executed, it expects a file path as an argument and prints the response from the pinning operation to the console. If the required argument is not provided, it gives a usage message and exits.
Shell script
This script is a script intended to compress the current directory into a temporary file, upload it to IPFS using the previously described Pinata Python script, and then clean up the temporary file. Here's a step-by-step summary of its function:
It creates a temporary file to store the compressed directory contents.
It compresses the current directory (all files and subdirectories) into an XZ compressed tarball and times the operation.
It calls a Python script,
pinata_api.py
, to upload the compressed file to IPFS via the Pinata service.After uploading, it attempts to extract the IPFS hash of the uploaded file from the response using a Python one-liner, assuming the
response
variable is a JSON string with an 'IpfsHash' key.It prints the extracted IPFS hash, which represents the address of the uploaded content on IPFS.
Finally, it removes the temporary compressed file to avoid leaving unnecessary files on the system.
Windows version
Linux version
Last updated