{"id":20609795,"url":"https://github.com/brunocampos01/federated-learning-for-text-generation","last_synced_at":"2025-04-15T04:32:15.960Z","repository":{"id":85179903,"uuid":"435238184","full_name":"brunocampos01/federated-learning-for-text-generation","owner":"brunocampos01","description":"Machine learning project using federated learning for text generation","archived":false,"fork":false,"pushed_at":"2024-05-05T03:31:23.000Z","size":9880,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T16:03:21.317Z","etag":null,"topics":["federated-learning","gutenberg-project","machine-learning","natural-language-processing","next-word-prediction","python","shakespeare","text-generation","tff"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brunocampos01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-12-05T17:50:16.000Z","updated_at":"2025-02-08T12:14:01.000Z","dependencies_parsed_at":"2024-05-05T04:25:20.997Z","dependency_job_id":"6064c298-7604-4abd-b36b-61f9601cfc5a","html_url":"https://github.com/brunocampos01/federated-learning-for-text-generation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunocampos01%2Ffederated-learning-for-text-generation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunocampos01%2Ffederated-learning-for-text-generation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunocampos01%2Ffederated-learning-for-text-generation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunocampos01%2Ffederated-learning-for-text-generation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunocampos01","download_url":"https://codeload.github.com/brunocampos01/federated-learning-for-text-generation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249006394,"owners_count":21197263,"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":["federated-learning","gutenberg-project","machine-learning","natural-language-processing","next-word-prediction","python","shakespeare","text-generation","tff"],"created_at":"2024-11-16T10:14:30.016Z","updated_at":"2025-04-15T04:32:15.943Z","avatar_url":"https://github.com/brunocampos01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# (WIP) Federated Learning for Text Generation\n![Python 3](https://img.shields.io/badge/Python-3-red.svg)\n![License](https://img.shields.io/badge/Code%20License-MIT-red.svg)\n\n\u003cimg src=\"references/flow_fl.png\" align=\"right\" height=auto width=50%/\u003e\n\n## Describe Project\nWhen a user is typing text on a mobile device it can be useful to suggest the next word as this will optimize typing time and also avoid possible errors. However, this data has private information, which limits its movement to a centralized environment. In this paper we will demonstrate how to predict the next word while guaranteeing users privacy without moving the data around.\n\n## Objectives\nThis work has how goals to predict the next word, ensuring data privacy. Sheakpeare pieces will be used as input data. These will be obtained, described, pre-processed and explored for a better understanding. Next, the federation environment will be created where each character in Sheakpeare's works will be a participating user, and their speeches will be the input dataset in the prediction model. From this scenario, in which data is only found on mobile devices, Federated Learning will be used to perform the model training in a shared way without moving the data to a centralized environment. For this, steps will be carried out to load a pre-trained global model from a central server, data pre-processing and model training on the user's own device. Then the model parameters will be forwarded to the central server to update the federated average and train the global model.\n\n## Data Source\nData from [Project Gutenberg](https://www.gutenberg.org/): [Shakespeare play](http://www.gutenberg.org/files/100/old/1994-01-100.zip)\n\n## Algorithms\nTODO\n\n## Quickstart\n- [Data Undertanding, data cleansing, data exploration](https://github.com/brunocampos01/federated-Learning-for-text-generation/tree/master/notebooks)\n- [Prepare federation, preprocess data, model, fed-avg, retraining and evaluate](https://github.com/brunocampos01/federated-Learning-for-text-generation/tree/master/notebooks)\n\n## Requirements\nThis project is tested with:\n\n| Requisite      | Version  |\n|----------------|----------|\n| Python         | 3.8.10   |\n| Pip            | 21.2.4   |\n| CUDA (optional)| 11.0     |\n\n- [Install CUDA](https://www.tensorflow.org/install/gpu#install_cuda_with_apt)\n\n\n## Image Display\n\n#### WordCloud\n\u003cimg src=\"reports/romeo-wordcloud.png\" align=\"center\" height=auto width=70%/\u003e\n\n\u003cimg src=\"reports/juliet-wordcloud.png\" align=\"center\" height=auto width=70%/\u003e\n\n#### N-grams\n\u003cimg src=\"reports/top_unigram.png\" align=\"center\" height=auto width=70%/\u003e\n\u003cimg src=\"reports/top_bigram.png\" align=\"center\" height=auto width=70%/\u003e\n\n---\n\n\n\u003cp  align=\"left\"\u003e\n    \u003cbr/\u003e\n\t\u003ca href=\"mailto:brunocampos01@gmail.com\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/brunocampos01/brunocampos01/blob/main/images/email.png\" width=\"30\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://stackoverflow.com/users/8329698/bruno-campos\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/brunocampos01/brunocampos01/blob/main/images/stackoverflow.png\" width=\"30\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://www.linkedin.com/in/brunocampos01\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/brunocampos01/brunocampos01/blob/main/images/linkedin.png\" width=\"30\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/brunocampos01\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/brunocampos01/brunocampos01/blob/main/images/github.png\" width=\"30\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://medium.com/@brunocampos01\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/brunocampos01/brunocampos01/blob/main/images/medium.png\" width=\"30\"\u003e\n\t\u003c/a\u003e\n    \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-sa/4.0/88x31.png\",  align=\"right\" /\u003e\n    \u003c/a\u003e\n    \u003cbr/\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunocampos01%2Ffederated-learning-for-text-generation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunocampos01%2Ffederated-learning-for-text-generation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunocampos01%2Ffederated-learning-for-text-generation/lists"}