{"id":27154740,"url":"https://github.com/david-leon/dandelion","last_synced_at":"2025-10-18T01:36:09.082Z","repository":{"id":62566417,"uuid":"130142169","full_name":"david-leon/Dandelion","owner":"david-leon","description":"A light weight deep learning framework, on top of Theano, offering better balance between flexibility and abstraction","archived":false,"fork":false,"pushed_at":"2023-10-12T09:08:22.000Z","size":1813,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T12:18:51.381Z","etag":null,"topics":["artificial-intelligence","deep-learning-library","python3","theano"],"latest_commit_sha":null,"homepage":"https://david-leon.github.io/Dandelion/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/david-leon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-19T01:30:21.000Z","updated_at":"2023-10-12T09:08:26.000Z","dependencies_parsed_at":"2022-11-03T16:15:45.130Z","dependency_job_id":null,"html_url":"https://github.com/david-leon/Dandelion","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-leon%2FDandelion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-leon%2FDandelion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-leon%2FDandelion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-leon%2FDandelion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/david-leon","download_url":"https://codeload.github.com/david-leon/Dandelion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902926,"owners_count":21015553,"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":["artificial-intelligence","deep-learning-library","python3","theano"],"created_at":"2025-04-08T18:32:36.329Z","updated_at":"2025-10-18T01:36:04.044Z","avatar_url":"https://github.com/david-leon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dandelion\n[![PyPI version](https://badge.fury.io/py/Dandelion.svg)](https://badge.fury.io/py/Dandelion)\n[![License: MPL 2.0](https://img.shields.io/badge/license-MPL%202.0-brightgreen.svg)](https://github.com/david-leon/Dandelion/blob/master/LICENSE)\n[![Python 3.x](https://img.shields.io/badge/python-3.x-brightgreen.svg)](https://www.python.org/downloads/release)\n[![Travis CI](https://app.travis-ci.com/david-leon/Dandelion.svg?branch=master)](https://travis-ci.org/david-leon/Dandelion)\n\nA quite light weight deep learning framework, on top of Theano, offering better balance between flexibility and abstraction\n\n## Targeted Users\nResearchers who need flexibility as well as convenience to experiment all kinds of *nonstandard* network structures, and also the stability of Theano.\n\n## Featuring\n* **Aiming to offer better balance between flexibility and abstraction.**\n    * Easy to use and extend, support for any neural network structure.  \n    * Loose coupling, each part of the framework can be modified independently.\n* **More like a handy library of deep learning modules.**\n    * Common modules such as CNN, LSTM, GRU, Dense, Dropout, Batch Normalization, and common optimization methods such as SGD, Adam, Adadelta, Rmsprop are ready out-of-the-box.\n* **Plug \u0026 play, operating directly on Theano tensors, no upper abstraction applied.**\n    * Unlike previous frameworks like Keras, Lasagne, etc., Dandelion operates directly on tensors instead of layer abstractions, making it quite easy to plug in 3rd part defined deep learning modules (layer defined by Keras/Lasagne) or vice versa.\n\n## Documentation\nDocumentation is available online: [https://david-leon.github.io/Dandelion/](https://david-leon.github.io/Dandelion/)\n\n## Install\nUse pip channel for stable release\n```\npip install dandelion --upgrade\n```\nor install from source to get the up-to-date version:\n```\npip install git+https://github.com/david-leon/Dandelion.git\n```\n\nDependency\n* Theano \u003e=1.0\n* Scipy (required by `dandelion.ext.CV`)\n* Pillow (required by `dandelion.ext.CV`)\n* OpenCV (required by `dandelion.ext.CV`)\n\n## Quick Tour\n```python\n    import theano\n    import theano.tensor as tensor\n    from dandelion.module import *\n    from dandelion.update import *\n    from dandelion.functional import *\n    from dandelion.util import gpickle\n\n    class model(Module):\n        def __init__(self, batchsize=None, input_length=None, Nclass=6, noise=(0.5, 0.2, 0.7, 0.7, 0.7)):\n            super().__init__()\n            self.batchsize = batchsize\n            self.input_length = input_length\n            self.Nclass = Nclass\n            self.noise = noise\n\n            self.dropout0 = Dropout()\n            self.dropout1 = Dropout()\n            self.dropout2 = Dropout()\n            self.dropout3 = Dropout()\n            self.dropout4 = Dropout() \n            W = gpickle.load('word_embedding(6336, 256).gpkl')\n            self.embedding = Embedding(num_embeddings=6336, embedding_dim=256, W=W)\n            self.lstm0 = LSTM(input_dims=256, hidden_dim=100)\n            self.lstm1 = LSTM(input_dims=256, hidden_dim=100)\n            self.lstm2 = LSTM(input_dims=200, hidden_dim=100)\n            self.lstm3 = LSTM(input_dims=200, hidden_dim=100)\n            self.lstm4 = LSTM(input_dims=200, hidden_dim=100)\n            self.lstm5 = LSTM(input_dims=200, hidden_dim=100)\n            self.dense = Dense(input_dims=200, output_dim=Nclass)\n       \n        def forward(self, x):\n            self.work_mode = 'train'\n            x = self.dropout0.forward(x, p=self.noise[0], rescale=False)\n            x = self.embedding.forward(x)         # (B, T, D)\n\n            x = self.dropout1.forward(x, p=self.noise[1], rescale=True)\n            x = x.dimshuffle((1, 0, 2))           # (B, T, D) -\u003e (T, B, D)\n            x_f = self.lstm0.forward(x, None, None, None)\n            x_b = self.lstm1.forward(x, None, None, None, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=2)\n\n            x = pool_1d(x, ws=2, ignore_border=True, mode='average_exc_pad', axis=0)\n\n            x = self.dropout2.forward(x, p=self.noise[2], rescale=True)\n            x_f = self.lstm2.forward(x, None, None, None)\n            x_b = self.lstm3.forward(x, None, None, None, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=2)\n\n            x = self.dropout3.forward(x, p=self.noise[3], rescale=True)\n            x_f = self.lstm4.forward(x, None, None, None, only_return_final=True)\n            x_b = self.lstm5.forward(x, None, None, None, only_return_final=True, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=1)\n\n            x = self.dropout4.forward(x, p=self.noise[4], rescale=True)\n            y = sigmoid(self.dense.forward(x))\n            return y\n\n        def predict(self, x):\n            self.work_mode = 'inference'\n            x = self.embedding.predict(x)\n\n            x = x.dimshuffle((1, 0, 2))  # (B, T, D) -\u003e (T, B, D)\n            x_f = self.lstm0.predict(x, None, None, None)\n            x_b = self.lstm1.predict(x, None, None, None, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=2)\n\n            x = pool_1d(x, ws=2, ignore_border=True, mode='average_exc_pad', axis=0)\n\n            x_f = self.lstm2.predict(x, None, None, None)\n            x_b = self.lstm3.predict(x, None, None, None, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=2)\n\n            x_f = self.lstm4.predict(x, None, None, None, only_return_final=True)\n            x_b = self.lstm5.predict(x, None, None, None, only_return_final=True, backward=True)\n            x = tensor.concatenate([x_f, x_b], axis=1)\n\n            y = sigmoid(self.dense.predict(x))\n            return y            \n```\n\n## Why Another DL Framework\n* The reason is more about the lack of flexibility for existing DL frameworks, such as Keras, Lasagne, Blocks, etc.\n* By **“flexibility”**, we means whether it is easy to modify or extend the framework. \n    * The famous DL framework Keras is designed to be beginner-friendly oriented, at the cost of being quite hard to modify.\n    * Compared to Keras, another less-famous framework Lasagne provides more flexibility. It’s easier to write your own layer by Lasagne for small neural network, however, for complex neural networks it still needs quite manual works because like other existing frameworks, Lasagne operates on abstracted ‘Layer’ class instead of raw tensor variables.\n\n## Project Layout\nPython Module     | Explanation\n----------------- | ----------------\nmodule            | all neual network module definitions\nfunctional        | operations on tensor with no parameter to be learned\ninitialization    | initialization methods for neural network modules\nactivation        | definition of all activation functions\nobjective         | definition of all loss objectives\nupdate            | definition of all optimizers\nutil              | utility functions\nmodel             | model implementations out-of-the-box\next               | extensions\n\n## Credits\nThe design of Dandelion heavily draws on [Lasagne](https://github.com/Lasagne/Lasagne) and [Pytorch](http://pytorch.org/), both my favorate DL libraries.  \nSpecial thanks to **Radomir Dopieralski**, who transferred the `dandelion` project name on pypi to us. Now you can install the package by simply `pip install dandelion`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-leon%2Fdandelion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavid-leon%2Fdandelion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-leon%2Fdandelion/lists"}