Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKoornstra committed Oct 12, 2024
1 parent 8a52ed5 commit 390deaf
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 44 deletions.
7 changes: 3 additions & 4 deletions docs/convert_to_vgsl_spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VGSLify now includes the ability to convert a trained or existing model back int
How It Works
------------

After you build or load a model using TensorFlow (with PyTorch support planned), you can convert it back into its VGSL specification string using the `model_to_spec()` function provided by VGSLify.
After you build or load a model using TensorFlow or PyTorch, you can convert it back into its VGSL specification string using the `model_to_spec()` function provided by VGSLify.

Example: Convert a Model to VGSL Spec
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -47,7 +47,7 @@ Once you've converted the model to a VGSL spec, you can easily save or share the
2. **Rebuild the Model from the Spec**:

- You can use the saved VGSL spec to rebuild the exact same model at any time.
- You can use the saved VGSL spec to rebuild the exact same model at any time with either TensorFlow or PyTorch backend.

.. code-block:: python
Expand All @@ -58,9 +58,8 @@ Once you've converted the model to a VGSL spec, you can easily save or share the
vgsl_spec = f.read()
# Rebuild the model from the spec
vgsl_gn = VGSLModelGenerator(backend="tensorflow")
vgsl_gn = VGSLModelGenerator(backend="auto")
model = vgsl_gn.generate_model(vgsl_spec)
model.summary()
By using this functionality, you can quickly share, reproduce, and analyze deep learning models in a concise format.

Expand Down
16 changes: 8 additions & 8 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Overview

VGSLify makes it incredibly simple to define, build, and train deep learning models using the Variable-size Graph Specification Language (VGSL). VGSL strings serve as compact representations of neural network architectures, allowing you to build models in a single line.

VGSLify abstracts the complexity of backend-specific syntax, enabling seamless switching between TensorFlow and, in future releases, PyTorch. This flexibility allows you to focus on model architecture and training without worrying about framework-specific implementations.
VGSLify abstracts the complexity of backend-specific syntax, enabling seamless switching between TensorFlow and PyTorch. This flexibility allows you to focus on model architecture and training without worrying about framework-specific implementations.

What is a VGSL Specification?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -15,14 +15,14 @@ A VGSL specification string concisely defines a neural network's architecture. T

For example, the following VGSL string defines a simple convolutional neural network:

``None,28,28,1 Cr3,3,32 Mp2,2,2,2 Rc Fr64 D20 Fs10``
``None,28,28,1 Cr3,3,32 Mp2,2 Rc2 Fr64 D20 Fs10``

This string represents a model with an input layer, a convolutional layer, a max pooling layer, a reshape layer, a dense (fully connected) layer, dropout, and an output layer. The model's structure is encoded entirely within this single line.

Key functionality of VGSLify includes:

- **Building models with a single line**: You can define complex architectures with a VGSL string, reducing the need for verbose code.
- **Switching between TensorFlow and PyTorch**: VGSLify supports both TensorFlow and (planned) PyTorch, allowing you to easily switch between backends.
- **Switching between TensorFlow and PyTorch**: VGSLify supports both TensorFlow and PyTorch, allowing you to easily switch between backends.

Simple Example: Building a Model
--------------------------------
Expand All @@ -43,7 +43,7 @@ Let’s walk through building a simple deep learning model using VGSLify.

.. code-block:: python
vgsl_spec = "None,28,28,1 Cr3,3,32 Mp2,2,2,2 Rc2 Fr64 D20 Fs10"
vgsl_spec = "None,28,28,1 Cr3,3,32 Mp2,2 Rc2 Fr64 D20 Fs10"
3. **Build and View the Model**:

Expand All @@ -68,13 +68,13 @@ Let’s break down the layers defined by the VGSL specification string in our ex
- **Convolutional Layer**: ``Cr3,3,32``
- This adds a 2D convolutional layer with a 3x3 kernel and 32 output filters, using ReLU activation (`r` for ReLU).

- **MaxPooling Layer**: ``Mp2,2,2,2``
- **MaxPooling Layer**: ``Mp2,2``
- This reduces the spatial dimensions by applying 2x2 max pooling with a stride of 2x2, which downsamples the input by taking the maximum value over each 2x2 window.

- **Reshape Layer**: ``Rc2``
- Reshapes the output from the previous layer, collapsing the spatial dimensions into a single vector suitable for fully connected layers.

- **Fully Connected Layer**: ``Fc64``
- **Fully Connected Layer**: ``Fr64``
- Adds a fully connected layer (dense layer) with 64 units.

- **Dropout Layer**: ``D20``
Expand All @@ -83,15 +83,15 @@ Let’s break down the layers defined by the VGSL specification string in our ex
- **Output Layer**: ``Fs10``
- Represents the output layer with 10 units (for 10 classes, such as the digits in MNIST) using softmax activation.

This VGSL string provides a concise, human-readable format for specifying complex model architectures. VGSLify automatically translates this specification into a deep learning model that can be trained using TensorFlow.
This VGSL string provides a concise, human-readable format for specifying complex model architectures. VGSLify automatically translates this specification into a deep learning model that can be trained using TensorFlow or PyTorch.

Next Steps
----------

Once you’ve built and explored a basic model, you can dive deeper into VGSLify's capabilities. Follow the [tutorials](tutorials.html) to explore more advanced use cases such as:

- Using different VGSL spec strings to define custom architectures.
- Switching between TensorFlow and PyTorch backends (PyTorch support coming soon).
- Switching between TensorFlow and PyTorch backends.
- Integrating VGSLify models into larger deep learning workflows.

Check out the `API reference <source/vgslify.html>`_ for detailed information on all available classes, methods, and utilities in VGSLify.
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VGSLify Documentation
=====================

`vgslify` is a powerful tool for creating and managing models using the Variable-size Graph Specification Language (VGSL). It offers flexibility by supporting both TensorFlow and (planned) PyTorch backends, making it suitable for various deep learning workflows.
`vgslify` is a powerful tool for creating and managing models using the Variable-size Graph Specification Language (VGSL). It offers flexibility by supporting both TensorFlow and PyTorch backends, making it suitable for various deep learning workflows.

This documentation provides a comprehensive guide to getting started with VGSLify, in-depth tutorials, and detailed API references for developers.

Expand Down Expand Up @@ -39,7 +39,7 @@ For developers looking for more technical details, the following API documentati

source/vgslify
source/vgslify.core
source/vgslify.parser
source/vgslify.parsers
source/vgslify.utils
source/vgslify.tensorflow
source/vgslify.torch
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Before installing VGSLify, make sure your system meets the following requirement

- `pip`: Python's package manager is required to install VGSLify and its dependencies.
- **TensorFlow**: If you are using VGSLify with TensorFlow, you will need to install TensorFlow as a backend.
- **PyTorch**: PyTorch support is planned for future releases, but is not yet available in the current version.
- **PyTorch**: If you are using VGSLify with PyTorch, you will need to install PyTorch as a backend.

- **VGSLify is BYOB (Bring Your Own Backend)**: VGSLify itself does not include a deep learning framework. Users must install their preferred backend—TensorFlow for now, with PyTorch support planned in future releases. This approach gives you flexibility in choosing your backend.
- **VGSLify is BYOB (Bring Your Own Backend)**: VGSLify itself does not include a deep learning framework. Users must install their preferred backend—TensorFlow or PyTorch. This approach gives you flexibility in choosing your backend.

Installing VGSLify
------------------
Expand Down
8 changes: 5 additions & 3 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ Introduction
Overview of VGSLify
-------------------

VGSLify is a toolkit designed to simplify the creation, training, and interpretation of deep learning models through the use of the Variable-size Graph Specification Language (VGSL). VGSL, originally developed for Tesseract OCR, provides a compact and flexible way to define neural network architectures in string format. VGSLify builds on this idea and adds support for modern deep learning frameworks like TensorFlow (with PyTorch planned for future versions), offering a user-friendly interface to create and manage neural network models.
VGSLify is a toolkit designed to simplify the creation, training, and interpretation of deep learning models through the use of the Variable-size Graph Specification Language (VGSL). VGSL, originally developed for Tesseract OCR, provides a compact and flexible way to define neural network architectures in string format. VGSLify builds on this idea and adds support for modern deep learning frameworks like TensorFlow or PyTorch, offering a user-friendly interface to create and manage neural network models.

What is VGSLify?
^^^^^^^^^^^^^^^^

VGSLify leverages the power of VGSL to let users define neural networks using simple, compact strings that specify layers, their configurations, and connections. This approach eliminates the need for verbose and complex code when defining model architectures, making it easier to iterate on design, experimentation, and deployment. With VGSLify, you can quickly prototype models and convert between VGSL strings and executable code in deep learning frameworks.

VGSLify abstracts away the complexities of framework-specific syntax, allowing users to focus on model architecture and training. By supporting both TensorFlow and PyTorch (planned), it ensures flexibility for users who might prefer one framework over the other.
VGSLify abstracts away the complexities of framework-specific syntax, allowing users to focus on model architecture and training. By supporting both TensorFlow and PyTorch, it ensures flexibility for users who might prefer one framework over the other.

Key Features
^^^^^^^^^^^^

VGSLify offers several key features to help streamline the process of deep learning model development:

- **Supports TensorFlow and (planned) PyTorch backends**: VGSLify currently works with TensorFlow, with PyTorch support planned in future releases.
- **Supports TensorFlow and PyTorch backends**: VGSLify currently works with TensorFlow and PyTorch.

- **Flexible model specification with VGSL**: VGSL is a compact language that allows for the definition of models with just a string, simplifying architecture description. Users can specify layers, input shapes, activations, and more in a single line.

Expand Down Expand Up @@ -46,6 +46,8 @@ Links to Documentation
To get started with VGSLify or dive deeper into its capabilities, explore the following resources:

- `Quick Start Guide <quickstart.html>`_: Learn how to quickly set up VGSLify, generate models, and begin training.
- `Installation Guide <installation.html>`_: Learn how to install VGSLify and the required dependencies.
- `Getting Started <getting_started.html>`_: Learn how to use VGSLify to build, train, and use deep learning models.
- `Tutorials <tutorials.html>`_: Step-by-step tutorials to guide you through common tasks and advanced features.
- `API Reference <api_reference.html>`_: Detailed documentation of VGSLify's classes, methods, and utilities.

26 changes: 21 additions & 5 deletions docs/source/vgslify.parser.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
vgslify.parser package
vgslify.parsers package
======================

Submodules
----------

vgslify.parser.tf\_parser module
--------------------------------
vgslify.parsers.base\_parser module
-----------------------------------

.. automodule:: vgslify.parser.tf_parser
.. automodule:: vgslify.parsers.base_parser
:members:
:undoc-members:
:show-inheritance:

vgslify.parsers.torch\_parser module
------------------------------------

.. automodule:: vgslify.parsers.torch_parser
:members:
:undoc-members:
:show-inheritance:

vgslify.parsers.tf\_parser module
---------------------------------

.. automodule:: vgslify.parsers.tf_parser
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: vgslify.parser
.. automodule:: vgslify.parsers
:members:
:undoc-members:
:show-inheritance:
10 changes: 2 additions & 8 deletions docs/source/vgslify.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Subpackages
:maxdepth: 4

vgslify.core
vgslify.parsers
vgslify.tensorflow
vgslify.torch

Submodules
----------
Expand All @@ -21,14 +23,6 @@ vgslify.generator module
:undoc-members:
:show-inheritance:

vgslify.parser module
---------------------

.. automodule:: vgslify.parser
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

Expand Down
5 changes: 5 additions & 0 deletions docs/source/vgslify.torch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ vgslify.torch.layers module
:undoc-members:
:show-inheritance:

.. automodule:: vgslify.torch.reshape
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

Expand Down
9 changes: 0 additions & 9 deletions docs/supported_layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ Layer Specifications

- Adds a dropout layer with a 50% dropout rate.

**Output Layer**
^^^^^^^^^^^^^^^^

- **VGSL Spec**: `O(2|1|0)(l|s)<n>`
- **Description**: Defines the output layer. The first value (`2`, `1`, or `0`) specifies whether the output is 2D, 1D, or scalar, followed by the activation type (`l`: linear, `s`: softmax), and the number of output units (`n`).
- **Example**: `O1s10`

- Defines a softmax output layer with 10 classes for a 1D sequence.

**Reshape Layer**
^^^^^^^^^^^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ Step-by-Step Instructions

.. code-block:: python
vgsl_spec = "None,32,32,3 Cr3,3,32 Mp2,2,2,2 Cr3,3,64 Mp2,2,2,2 Rc2 Fc128 D25 Fs10"
vgsl_spec = "None,32,32,3 Cr3,3,32 Mp2,2 Rc2 Cr3,3,64 Mp2,2 Rc2 Fr128 D25 Fs10"
Explanation:

- `None,32,32,3`: Input layer for images of size 32x32 with 3 color channels (RGB).
- `Cr3,3,32`: Convolutional layer with a 3x3 filter, ReLU activation, and 32 filters.
- `Mp2,2,2,2`: MaxPooling layer with a 2x2 pool size and 2x2 strides.
- `Mp2,2`: MaxPooling layer with a 2x2 pool size (and default strides).
- `Cr3,3,64`: Second convolutional layer with 64 filters.
- `Rc2`: Reshape layer to flatten the output for the fully connected layer.
- `Fc128`: Fully connected (dense) layer with 128 units.
- `Fr128`: Fully connected (dense) layer with 128 units and ReLU activation.
- `D25`: Dropout layer with a 25% dropout rate.
- `Fs10`: Output layer with 10 units and softmax activation for classification into 10 classes.

Expand Down

0 comments on commit 390deaf

Please sign in to comment.