{"id":17667464,"url":"https://github.com/timkoornstra/vgslify","last_synced_at":"2025-05-07T23:37:24.615Z","repository":{"id":200112081,"uuid":"704801636","full_name":"TimKoornstra/VGSLify","owner":"TimKoornstra","description":"Rapidly prototype TensorFlow and PyTorch models using VGSL (Variable-size Graph Specification Language) and convert them back to VGSL spec.","archived":false,"fork":false,"pushed_at":"2025-04-16T20:06:22.000Z","size":5560,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T23:37:04.379Z","etag":null,"topics":["deep-learning","model-generation","neural-network","neural-networks","pytorch","rapid-prototyping","tensorflow","tf","torch","vgsl","vgslify"],"latest_commit_sha":null,"homepage":"https://timkoornstra.github.io/VGSLify/","language":"Python","has_issues":true,"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/TimKoornstra.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":"docs/supported_layers.rst","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-14T06:12:16.000Z","updated_at":"2025-02-02T12:04:59.000Z","dependencies_parsed_at":"2024-09-17T16:20:14.671Z","dependency_job_id":"94cbfa5b-ddf8-4edb-b34a-00a98e984377","html_url":"https://github.com/TimKoornstra/VGSLify","commit_stats":{"total_commits":62,"total_committers":2,"mean_commits":31.0,"dds":0.08064516129032262,"last_synced_commit":"cb40dcd0df9cf6539dc6810adc6a4b70becc2eb3"},"previous_names":["timkoornstra/vgslify"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKoornstra%2FVGSLify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKoornstra%2FVGSLify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKoornstra%2FVGSLify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKoornstra%2FVGSLify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimKoornstra","download_url":"https://codeload.github.com/TimKoornstra/VGSLify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973606,"owners_count":21834104,"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","model-generation","neural-network","neural-networks","pytorch","rapid-prototyping","tensorflow","tf","torch","vgsl","vgslify"],"created_at":"2024-10-23T22:07:09.598Z","updated_at":"2025-05-07T23:37:24.595Z","avatar_url":"https://github.com/TimKoornstra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VGSLify: Variable-size Graph Specification for TensorFlow \u0026 PyTorch\n\n![PyPI](https://img.shields.io/pypi/v/vgslify)\n![Downloads](https://pepy.tech/badge/vgslify)\n![License](https://img.shields.io/pypi/l/vgslify)\n\nVGSLify simplifies defining, training, and interpreting deep learning models using the Variable-size Graph Specification Language (VGSL). Inspired by [Tesseract's VGSL specs](https://tesseract-ocr.github.io/tessdoc/tess4/VGSLSpecs.html), VGSLify enhances and streamlines the process for both TensorFlow and PyTorch.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [How VGSL Works](#how-vgsl-works)\n- [Quick Start](#quick-start)\n    - [Generating a Model with VGSLify](#generating-a-model-with-vgslify)\n    - [Creating Individual Layers with VGSLify](#creating-individual-layers-with-vgslify)\n    - [Converting Models to VGSL](#converting-models-to-vgsl)\n- [Additional Documentation](#additional-documentation)\n- [Contributing](#contributing)\n- [License](#license)\n- [Acknowledgements](#acknowledgements)\n\n\n## Installation\n\n### Basic Installation\n\nTo install VGSLify without any deep learning backend, run:\n\n```bash\npip install vgslify\n```\n\nThis installs only the core functionalities of VGSLify without `torch` or `tensorflow`.\n\n### Installing with a Specific Backend\n\nVGSLify supports both TensorFlow and PyTorch. You can install it with the required backend:\n\n```bash\n# For TensorFlow (latest compatible version)\npip install vgslify[tensorflow]\n\n# For PyTorch (latest compatible version)\npip install vgslify[torch]\n```\n\nBy default, this will install:\n\n- `tensorflow` (latest stable version)\n- `torch` (latest stable version)\n\n### Controlling Backend Versions\n\nIf you need a specific version of `torch` or `tensorflow`, install VGSLify first and then manually install the backend:\n\n```bash\npip install vgslify\npip install torch==2.1.0      # Example for PyTorch\npip install tensorflow==2.14  # Example for TensorFlow\n```\n\nAlternatively, you can specify the version during installation:\n\n```bash\npip install vgslify[torch] torch==2.1.0\npip install vgslify[tensorflow] tensorflow==2.14\n```\n\n⚠ **Note**: If a different version of torch or tensorflow is already installed, pip may not downgrade it automatically. Use `--force-reinstall` or `--upgrade` if necessary:\n\n```bash\npip install --upgrade --force-reinstall torch==2.1.0\n```\n\n### Verify installation\n\nTo check that VGSLify is installed correctly, run:\n\n```bash\npython -c \"import vgslify; print(vgslify.__version__)\"\n```\n\n## How VGSL Works\n\nVGSL uses concise strings to define model architectures. For example:\n\n```vgsl\nNone,None,64,1 Cr3,3,32 Mp2,2 Cr3,3,64 Mp2,2 Rc3 Fr64 D20 Lrs128 D20 Lrs64 D20 Fs92\n```\n\nEach part represents a layer: input, convolution, pooling, reshaping, fully connected, LSTM, and output. VGSL allows specifying activation functions for customization.\n\n\n## Quick Start\n\n### Generating a Model with VGSLify\n\n```python\nfrom vgslify import VGSLModelGenerator\n\n# Define the VGSL specification\nvgsl_spec = \"None,None,64,1 Cr3,3,32 Mp2,2 Fs92\"\n\n# Choose backend: \"tensorflow\", \"torch\", or \"auto\" (defaults to whichever is available)\nvgsl_gn = VGSLModelGenerator(backend=\"tensorflow\") \nmodel = vgsl_gn.generate_model(vgsl_spec, model_name=\"MyModel\")\nmodel.summary()\n\n\nvgsl_gn = VGSLModelGenerator(backend=\"torch\") # Switch to PyTorch\nmodel = vgsl_gn.generate_model(vgsl_spec, model_name=\"MyTorchModel\")\nprint(model)\n\n\n```\n\n### Creating Individual Layers with VGSLify\n\n```python\nfrom vgslify import VGSLModelGenerator\n\nvgsl_gn = VGSLModelGenerator(backend=\"tensorflow\")\nconv2d_layer = vgsl_gn.construct_layer(\"Cr3,3,64\")\n\n# Integrate into an existing model:\n# model = tf.keras.Sequential()\n# model.add(conv2d_layer) # ...\n\n# Example with generate_history:\nhistory = vgsl_gn.generate_history(\"None,None,64,1 Cr3,3,32 Mp2,2 Fs92\")\nfor layer in history:\n    print(layer)\n```\n\n\n### Converting Models to VGSL\n\n```python\nfrom vgslify import model_to_spec\nimport tensorflow as tf\n# Or import torch.nn as nn\n\n# TensorFlow example:\nmodel = tf.keras.models.load_model(\"path_to_your_model.keras\") # If loading from file\n\n# PyTorch example:\n# model = MyPyTorchModel() # Assuming MyPyTorchModel is defined elsewhere\n\n\nvgsl_spec_string = model_to_spec(model)\nprint(vgsl_spec_string)\n```\n\n**Note:** Flatten/Reshape layers might require manual input shape adjustment in the generated VGSL.\n\n\n## Additional Documentation\n\nSee the [VGSL Documentation](https://timkoornstra.github.io/VGSLify) for more details on supported layers and their specifications.\n\n\n## Contributing\n\nContributions are welcome!  Fork the repository, set up your environment, make changes, and submit a pull request. Create issues for bugs or suggestions.\n\n\n## License\n\nMIT License. See [LICENSE](LICENSE) file.\n\n\n## Acknowledgements\n\nThanks to the creators and contributors of the original VGSL specification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkoornstra%2Fvgslify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkoornstra%2Fvgslify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkoornstra%2Fvgslify/lists"}