{"id":17234762,"url":"https://github.com/timesler/framework-agnostic-deep-learning","last_synced_at":"2025-04-14T02:07:51.591Z","repository":{"id":113718978,"uuid":"181798982","full_name":"timesler/framework-agnostic-deep-learning","owner":"timesler","description":"Common code for building neural networks with a hybrid of Pytorch and Tensorflow eager execution","archived":false,"fork":false,"pushed_at":"2019-04-19T01:01:27.000Z","size":14,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T02:07:46.302Z","etag":null,"topics":["deep-learning","keras","neural-network","neural-networks","pytorch","tensorflow"],"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/timesler.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":"2019-04-17T02:02:41.000Z","updated_at":"2022-09-02T07:47:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a510794-d4f2-4209-96fb-8daf3c220979","html_url":"https://github.com/timesler/framework-agnostic-deep-learning","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/timesler%2Fframework-agnostic-deep-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timesler%2Fframework-agnostic-deep-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timesler%2Fframework-agnostic-deep-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timesler%2Fframework-agnostic-deep-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timesler","download_url":"https://codeload.github.com/timesler/framework-agnostic-deep-learning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809044,"owners_count":21164896,"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":["deep-learning","keras","neural-network","neural-networks","pytorch","tensorflow"],"created_at":"2024-10-15T05:30:20.284Z","updated_at":"2025-04-14T02:07:51.573Z","avatar_url":"https://github.com/timesler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Framework-agnostic deep learning\n\nThis repo contains examples of using common code with both the Pytorch and Tensorflow ML/neural network frameworks.\n\nOriginally, this project was intended as a way to learn Tensorflow's eager execution mode by porting some typical \nPytorch code. However, evidenced by the fact that it works with both frameworks, I have adopted this project structure as\na good starting structure for new modelling projects.\n\nGiven additional time, I plan to implement more framework-agnostic models, optimizers, and losses.\n\n## Docker setup\n\nThe project contains the necessary pieces to spin up a docker container that doubles as a Jupyter server or an API, depending on the intended use. A number of docker shortcuts have been added to the `Makefile` in order to speed things up. However, if make is not installed, you can inspect the `Makefile` to get the relevant commands and run them manually.\n\nRun `make build` to build the docker image. Then run `make jupyter` to start a docker container running jupyter lab. Navigate to localhost:38888 on the host machine to interact with the container.\n\n## Running code inside docker\n\n`main.py` contains a example implementation of framework-agnostic code. The script generates some random data then creates a data loader, model, optimizer and loss function. The model is then fit to the generated data. The script accepts the following optional command-line arguments:\n\n* `--framework`: pytorch or tensorflow (default: pytorch)\n* `--samples`: number of samples in generated random data (default: 10000)\n* `--features`: number of input features (default: 128)\n* `--responses`: number of output responses (default: 8)\n* `--batch_size`: batch size (default: 128)\n* `--epochs`: number of training epochs (default: 10)\n* `--classify`: flag to switch between regression and classification\n* `--architecture`: pg for policy gradient RL model, mlp for simple multi-layer perceptron (default: pg)\n\n*Examples*:\n\nTo run RL classification model with pytorch:\n\n```python main.py --framework pytorch --architecture pg --classify```.\n\nTo run MLP regression model with tensorflow:\n\n```python main.py --framework tensorflow --architecture mlp```.\n\nAny combination of the above parameters should work also, and all are optional.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimesler%2Fframework-agnostic-deep-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimesler%2Fframework-agnostic-deep-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimesler%2Fframework-agnostic-deep-learning/lists"}