{"id":19733965,"url":"https://github.com/scaleoutsystems/power-consumption-tutorial","last_synced_at":"2025-09-05T11:32:49.396Z","repository":{"id":104982436,"uuid":"604706107","full_name":"scaleoutsystems/power-consumption-tutorial","owner":"scaleoutsystems","description":"Federated data center power consumption prediction.  ","archived":false,"fork":false,"pushed_at":"2024-06-25T13:38:08.000Z","size":453,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T22:04:56.048Z","etag":null,"topics":["energy","federated-learning","time-series"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scaleoutsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-21T16:11:40.000Z","updated_at":"2025-02-05T02:27:09.000Z","dependencies_parsed_at":"2023-05-07T11:30:28.687Z","dependency_job_id":"31e9e7f4-7d13-41d2-a739-b72bb426bff3","html_url":"https://github.com/scaleoutsystems/power-consumption-tutorial","commit_stats":{"total_commits":76,"total_committers":4,"mean_commits":19.0,"dds":0.2763157894736842,"last_synced_commit":"9a1337cf338a55086bb2604aa1de8edbab4124ea"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Fpower-consumption-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Fpower-consumption-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Fpower-consumption-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Fpower-consumption-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scaleoutsystems","download_url":"https://codeload.github.com/scaleoutsystems/power-consumption-tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251635799,"owners_count":21619305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["energy","federated-learning","time-series"],"created_at":"2024-11-12T00:34:48.621Z","updated_at":"2025-04-30T03:32:38.779Z","avatar_url":"https://github.com/scaleoutsystems.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Power consumption prediction for data centers (TensorFlow/Keras and PyTorch)\n\n![Power Consumption Example.](banner.png)\n\nThis is an example of a neural network regression model in a federated setting. Time series data from two data centers in Sweden and Finland are used to predict the relationship between CPU and Network usage and power consumption. The tutorial is based on the following article that has more background information on the use-case: \n\n- Towards Smart e-Infrastructures, A Community Driven Approach Based on Real Datasets\nhttps://ieeexplore.ieee.org/document/9289758\n\nThe model in this example is a simplified version of the model used in the article, aimed at reducing the compute requirements on the client side. A typical laptop or workstation should be capable of handling multiple clients. A partition of the dataset needed for this example is publically accessible.\n\n```sh\nwget --no-check-certificate 'https://docs.google.com/uc?export=download\u0026id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU' -O power.npz\n```\n\nTo access the complete dataset, please get in touch with Scaleout staff. The following figure illustrates the overall concept of the example.\n\n![Overview figure highlighting input parameters and expected output.](overview.png)\n\n\nIn case you have any questions, feel free to contact us. \n\n\n## Prerequisites, when running clients in Docker containers\n\n- [Python 3.8, 3.9, 3.10 or 3.11](https://www.python.org/downloads)\n\n\nCreating the compute package and seed model\n-------------------------------------------\n\nInstall fedn:\n\n```sh\n   pip install fedn\n```\n\nClone this repository, then locate into this directory:\n\n```sh\n   https://github.com/scaleoutsystems/power-consumption-tutorial.git\n```\nFor PyTorch example:\n\n```sh\n   cd power-consumption-tutorial/Power-consumption-pytorch\n```\n\nOr for Keras example: \n\n```sh\n   cd power-consumption-tutorial/Power-consumption-keras\n```\n\nCreate the compute package:\n\n```sh\n   fedn package create --path client\n```\n\nThis should create a file 'package.tgz' in the project folder.\n\nNext, generate a seed model (the first model in a global model trail):\n\n```sh\n   fedn run build --path client\n```\n\nThis will create a seed model called 'seed.npz' in the root of the project. This step will take a few minutes, depending on hardware and internet connection (builds a virtualenv).\n\nDownload the dataset:\n\nFor Linux and MacOS\n\n```sh\n   mkdir power-consumption-tutorial/Power-consumption-pytorch/data\n   wget --no-check-certificate 'https://docs.google.com/uc?export=download\u0026id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU' -O power.npz\n```\n\nFor Windows users, download the dataset using your preferred browser or tool by following the link below.\n\n`https://docs.google.com/uc?export=download\u0026id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU`\n\nUsing FEDn Studio\n-----------------\n\nFollow the guide here to set up your FEDn Studio project and learn how to connect clients (using token authentication): [Studio guide](https://fedn.readthedocs.io/en/stable/studio.html). On the step \"Upload Files\", upload 'package.tgz' and 'seed.npz' created above.\n\nConnecting clients:\n\n```sh\nexport FEDN_PACKAGE_EXTRACT_DIR=package\nexport FEDN_DATA_PATH=\u003cfull_path_to_the_dir\u003e/data/power.npz\n```\n\n```sh\nfedn client start -in client.yaml --secure=True --force-ssl\n```\n\n\nConnecting clients using Docker:\n\nFor convenience, there is a Docker image hosted on ghrc.io with fedn preinstalled. To start a client using Docker:\n\n```sh\ndocker run \\\n  -v $PWD/client.yaml:/app/client.yaml \\\n  -v $PWD/data/power.npz:/app/data/power.npz \\\n  -e FEDN_PACKAGE_EXTRACT_DIR=package \\\n  -e FEDN_DATA_PATH=/app/data/power.npz \\\n  ghcr.io/scaleoutsystems/fedn/fedn:0.9.0 run client -in client.yaml --force-ssl --secure=True\n```\n\nNow on the session tab in the Studio, click on the start session to initiate the training rounds. \n\nFor more details about FEDn SDK or FEDn Studio, click on the following [link](https://fedn.readthedocs.io/en/stable/introduction.html) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaleoutsystems%2Fpower-consumption-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscaleoutsystems%2Fpower-consumption-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaleoutsystems%2Fpower-consumption-tutorial/lists"}