{"id":16729821,"url":"https://github.com/dfdx/lilith.jl","last_synced_at":"2025-07-12T02:35:00.605Z","repository":{"id":61798634,"uuid":"208448445","full_name":"dfdx/Lilith.jl","owner":"dfdx","description":"Renamed to Avalon.jl","archived":false,"fork":false,"pushed_at":"2020-12-09T23:18:58.000Z","size":143,"stargazers_count":44,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-01T10:11:13.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfdx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-14T14:01:25.000Z","updated_at":"2023-02-28T21:46:22.000Z","dependencies_parsed_at":"2022-10-21T11:15:27.781Z","dependency_job_id":null,"html_url":"https://github.com/dfdx/Lilith.jl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfdx%2FLilith.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfdx%2FLilith.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfdx%2FLilith.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfdx%2FLilith.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfdx","download_url":"https://codeload.github.com/dfdx/Lilith.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244160446,"owners_count":20408103,"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":[],"created_at":"2024-10-12T23:29:59.668Z","updated_at":"2025-03-21T21:31:13.505Z","avatar_url":"https://github.com/dfdx.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lilith\n\n\u003e :warning: **This package has been renamed to [Avalon.jl](https://github.com/dfdx/Avalon.jl), all new features will be added there**\n\n\n[![Build Status](https://travis-ci.org/dfdx/Lilith.jl.svg?branch=master)](https://travis-ci.org/dfdx/Lilith.jl)\n\n\n**Lilith** is a deep learning library in Julia with focus on **high performance** and **interoperability with existing DL frameworks**. Its main features include:\n\n* tracing autograd engine - models are just structs, transformations are just functions\n* optimizing code generator based on hackable computational graph\n* GPU support\n* layer API similar to PyTorch's to ease translation of existing Python code to Julia\n* high backward compatibility to allow accumulation of models\n\n## Usage\n\nTo get you a feeling of what Lilith is like, here's a definition of a small convolutional neural network:\n\n```julia\nusing Lilith\n\n\nmutable struct Net\n    conv1::Conv2d\n    conv2::Conv2d\n    fc1::Linear\n    fc2::Linear\nend\n\n\nNet() = Net(\n    Conv2d(1, 20, 5),\n    Conv2d(20, 50, 5),\n    Linear(4 * 4 * 50, 500),\n    Linear(500, 10)\n)\n\nfunction (m::Net)(x::AbstractArray)\n    x = maxpool2d(relu.(m.conv1(x)), (2, 2))\n    x = maxpool2d(relu.(m.conv2(x)), (2, 2))\n    x = reshape(x, 4*4*50, :)\n    x = relu.(m.fc1(x))\n    x = logsoftmax(m.fc2(x))\n    return x\nend\n```\n\nFor detailed explanation of this and other models see [the tutorial](https://github.com/dfdx/Lilith.jl/tree/master/tutorial). Some predefined models are also available in [the zoo](https://github.com/dfdx/Lilith.jl/tree/master/zoo).\n\n\n## Performance\n\nPerformance comparison between different libraries is hard and benchmarks are rarely fair, but here's our best shot in this direction:\n\n### Convolutional neural network\n\nCode available [here](https://github.com/dfdx/Lilith.jl/tree/master/benchmarks/cnn)\n\n|               | training 1 epoch | training total time* | prediction |\n| ------------- | ---------------- | -------------------- | ---------- |\n| Lilith (CPU)  |    170 s         |       1742 s         |   39 ms    |\n| Flux (CPU)    |    250 s         |       2515 s         |   42 ms    |\n| ------------- | ---------------- | -------------------- | ---------- |\n| Lilith (GPU)  |     10 s         |        164 s         |    5 ms    |\n| Flux (GPU)    |     12 s         |        150 s         |    5 ms    |\n| PyTorch (GPU) |     12 s         |        120 s         |    2 ms    |\n\n`*` - total time includes 10 epochs + compilation time\n\nNote that in the test on GPU Lilith has longest compilation time and thus\nlongest total training time _after 10 epochs_. However, time per epoch\nis the lowest, so Lilith is typically the fastest one in longer run.\n\n\n\n### Variational Autoencoder\n\nCode available [here](https://github.com/dfdx/Lilith.jl/tree/master/benchmarks/vae)\n\n|               | training 1 epoch | training total time  | prediction |\n| ------------- | ---------------- | -------------------- | ---------- |\n| Lilith (CPU)  |     50 s         |        535 s         |   395 μs   |\n| Flux (CPU)    |    948 s         |        158 min       |    81 ms   |\n| ------------- | ---------------- | -------------------- | ---------- |\n| Lilith (GPU)  |      3 s         |         93 s         |   194 μs   |\n| Flux (GPU)**  |     ---          |          ---         |     ---    |\n| PyTorch (GPU) |      7 s         |         66 s         |   501 µs   |\n\n`**` - VAE example from the Flux zoo doesn't work on GPU\n\n\n## API Stability\n\nOne of the central ideas behind Lilith is the ability to reuse existing code instead of writing everything from scratch.\nTo facilitate it, Lilith is committed to high, although not absolute backward compatibility. The following table\noutlines stability level you should expect from various components of the library.\n\n| Component       | API Stable? |\n| --------------- | ----------- |\n| Basic layers    | Yes         |\n| CNN             | Yes         |\n| RNN             | No*         |\n| Losses          | Mostly      |\n| Activations     | Yes         |\n| Initializations | Mostly      | \n| Optimizers      | Yes         |\n| Device API      | Yes         |\n| Fitting API     | No**        |\n\n`*` - currently Lilith provides only basic implementations of vanilla RNN, LSTM and GRU; this implementation will be improved in future version and made more compatible with PyTorch version, but currently it cannot be considered stable\n\n`**` - function `fit!()` provides a convenient shortcut for training supervised learning models, but in its current state it's too basic for most real use cases; for more durable code consider writing your own method for training using `fit!()` as a template\n\nPlease note that until version 1.0 \"stable API\" means that we will try our best to keep it unchanged, but we reserve the right to the break the rule in some rare and exceptional cases. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfdx%2Flilith.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfdx%2Flilith.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfdx%2Flilith.jl/lists"}