Skip to main content

bitgeist is a Python library to convert deep neural network models into c source code.

Project description

bitgeist

bitgeist is a Python library to convert deep neural network models into c source code.

Installation

Use the package manager pip to install bitgeist.

pip install bitgeist

Usage

import bitgeist as bg

# transform a pytorch model to c code
print(bg.transform(model))

Example:

    ...
    class MnistModel(nn.Module):

        def __init__(self, downsample=None):
            super(MnistModel, self).__init__()

            inputs = 28 * 28
            hidden = 120
            output = 10

            self.l1 = DenseBlock(inputs, hidden, downsample=downsample)
            self.action = nn.PReLU(hidden)
            self.l2 = DenseBlock(hidden, output, downsample=downsample)

        def forward(self, x):
            out = self.l1(x)
            out = self.action(out)
            out = self.l2(out)
            return out

    model = MnistModel(nn.Dropout(0.2)).to(device)

    # train the model 
    
    ...
    
    print("total training time = {} hours".format(training_time))

    print(bg.transform(model)) #print or write to file ...
   ...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitgeist-0.1.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitgeist-0.1.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file bitgeist-0.1.3.tar.gz.

File metadata

  • Download URL: bitgeist-0.1.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for bitgeist-0.1.3.tar.gz
Algorithm Hash digest
SHA256 de3a07f99f39c70a60eeb8f60b6ccc68fe63114509ec62ed4d052da187dd1fb4
MD5 cc2e481b0d571ba973f2963008386adf
BLAKE2b-256 fa76d6fe6ae5f42e55eb1e38df614d252e1177266b3141bb35bc74cd94e583cd

See more details on using hashes here.

File details

Details for the file bitgeist-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bitgeist-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for bitgeist-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 863206439433542ab85e5a0788feb686dee23c883c4d22f03f7b6da20b21d1eb
MD5 fec99e8e6f916d1beebfe52463328a7c
BLAKE2b-256 bdc65b9a6cc570b0b8c0e0b668b72caec2f071aaef4bf5a56e9233de924ff3a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page