Skip to main content

Deep learning framework built with numpy (cupy)

Project description

NeuralFlow

Deep learning framework built with numpy (cupy)
This version supports cuda 11.x ver

install

$ git clone git clone https://github.com/augustinLib/neuralflow.git

or

# cpu-only
$ pip install neuralflow-cpu

# gpu (cuda 11.x)
$ pip install neuralflow

Quick guide

you can build model like this,

from neuralflow.model import *
from neuralflow.function_class import ReLU

model = Model(
    DenseLayer(784, 50),
    ReLU(),
    DenseLayer(50, 10)
)

conv_model = Model(
    ConvLayer(input_channel = 1, output_channel = 30, kernel_size = 5, stride = 1, padding=0),
    ReLU(),
    MaxPoolingLayer(kernel_size=2, stride=2),
    DenseLayer(4320, 100),
    ReLU(),
    DenseLayer(100, 10)
)

model_ln = Model(
    EmbeddingLayer(vocab_size, wordvec_size),
    Dropout(dropout),
    LSTMLayer(wordvec_size, hidden_size),
    Dropout(dropout),
    LSTMLayer(hidden_size, hidden_size),
    Dropout(dropout),
    DenseLayer(hidden_size, vocab_size)
)
# mixed precision
model_ln.mixed_precision_on()

# weight tying
model_ln.weight_tying()

and the training proceeds as follows.

from neuralflow.function_class import ReLU, CrossEntropyLoss
from neuralflow.optimizer import Adam

critic = CrossEntropyLoss()
optim = Adam()
pred = model(x)
loss = critic(pred, y)
model.backward(critic)
optim.update(model)

you can also train model with trainer

from neuralflow.trainer import ClassificationTrainer
from neuralflow.data import DataLoader

dataloader = DataLoader(train_data)
trainer = ClassificationTrainer(model,
                                critic,
                                optim,
                                epochs,
                                init_lr = 0.001)
trainer.train(dataloader)

when using gpu, set it as follows.

# using gpu
from neuralflow import config
config.GPU = True

# using cpu
from neuralflow import config
config.GPU = False

Structure

  • neuralflow
    • __init__.py
    • data.py
    • function.py
    • function_class.py
    • model.py
    • optimizer.py
    • trainer.py
    • utils.py
    • nlp
      • __init__.py
      • utils.py
      • model.py
    • cv
      • __init__.py
      • model.py
    • epoch_notice
      • send_message.py
      • token_generator.py
  • dataset
  • test
  • README.md
  • .gitignore

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

neuralflow-1.0.1.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

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

neuralflow-1.0.1-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file neuralflow-1.0.1.tar.gz.

File metadata

  • Download URL: neuralflow-1.0.1.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for neuralflow-1.0.1.tar.gz
Algorithm Hash digest
SHA256 69439aad38e5b6b9448770dec8f4ce71909fc3da084473f429bf8d1a341c787b
MD5 eaa36844fa90ea3a3ce3dc9742ce9d9d
BLAKE2b-256 8b37bbc25613c13bb0789fd3786fe188b1427232625e5d94a406b509539688ce

See more details on using hashes here.

File details

Details for the file neuralflow-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: neuralflow-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for neuralflow-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 802592db72b012a46bba94b29f8a45fd894b57e986c3b64426c3131bf43f3cf5
MD5 984b59e5a575e8eff0c34bd6722257c3
BLAKE2b-256 2fffcb9e40a042df67f880cc4446fa1416db295f7e05acd585fee944773f30b7

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