Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Pytorch to Keras/Tensorflow/TFLite conversion made intuitive
| Date | Stars |
|---|---|
| 2026-07-24 | 344 |
| 2026-07-25 | 344 |
| 2026-07-28 | 344 |
| 2026-07-30 | 344 |
| 2026-08-06 | 344 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
<p align="center">
<img src="https://raw.githubusercontent.com/AlexanderLutsenko/nobuco/master/docs/nobuco.png">
<sup><a href="https://www.behance.net/diliajl">diliajl</a></sup>
</p>
**No** **Bu**llshit **Co**nverter is a tool that helps you translate Pytorch models into Keras/Tensorflow/TFLite graphs without losing your mind.
- Supports a wide range of architectures
- [x] Control flow ops (If, For, While)
- [x] Recurrent layers (LSTM, GRU)
- [x] Stateful modules
- [x] Arbitrary torch functions
- Simple
- Flexible
- Efficient
- Sanity-preserving, with clear mistake messaging
> [!IMPORTANT]
> Nobuco only supports Keras 2 at the moment. If you'd like to use the new multi-backend Keras 3, please bump up the related issue: https://github.com/keras-team/keras/issues/19314
## Installation <img src="https://img.shields.io/pypi/v/nobuco?color=blue&style=flat-square">
<img src="https://img.shields.io/badge/PyTorch-2.1-EE4C2C.svg?style=flat&logo=pytorch"> <img src="https://img.shields.io/badge/TensorFlow-2.15-FF6F00.svg?style=flat&logo=tensorflow">
```bash
pip install -U nobuco
```
<!-- toc -->
## Table of Contents
- [Essentials](#essentials)
- [Channel order wizardry](#channel-order-wizardry)
- [Implementation mismatch: pick your poison](#implementation-mismatch-pick-your-poison)
- [Going dynamic](#going-dynamic)
- [Control flows](#control-flows)
- [Dynamic shapes](#dynamic-shapes)
- [No, that's too dynamic!](#no-thats-too-dynamic)
- [Forcing static crops](#forcing-static-crops)
- [In-place operations](#in-place-operations)
- [A little white lie: tracing mode](#a-little-white-lie-tracing-mode)
- [Ad hoc modifications](#ad-hoc-modifications)
- [So we put a converter inside your converter](#so-we-put-a-converter-inside-your-converter)
- [But was it worth it?](#but-was-it-worth-it)
- [Nobuco knowledge base](#nobuco-knowledge-base)
<!-- tocstop -->
<!-- toc -->
- [Deep dive](#deep-dive)
- [Aggressive transposition removal: fighting fire with fire](#aggressive-transposition-removal-fighting-fire-with-fire)
<!-- tocstop -->
## Essentials
Suppose we want to convert a Pytorch module similar to this one:
````python
class MyModule(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(3, 16, kernel_size=(3, 3), padding=(1, 1), stride=(2, 2))
def forward(self, x):
x = self.conv(x)
x = nn.Hardsigmoid()(x)
x = 1 - x[:, ::2] * x[:, 1::2]
return x
````
The process is exactly what you would expect. Instantiate the module, create dummy inputs and call the magic function:
```python
import nobuco
from nobuco import ChannelOrder, ChannelOrderingStrategy
from nobuco.layers.weight import WeightLayer
```
````python
dummy_image = torch.rand(size=(1, 3, 256, 256))
pytorch_module = MyModule().eval()
keras_model = nobuco.pytorch_to_keras(
pytorch_module,
args=[dummy_image], kwargs=None,
inputs_channel_order=ChannelOrder.TENSORFLOW,
outputs_channel_order=ChannelOrder.TENSORFLOW
)
````
Aaaand done! That's all it takes to... hold on, what's that?
<img src="https://raw.githubusercontent.com/AlexanderLutsenko/nobuco/master/docs/essentials1.svg" width="100%">
Nobuco says it doesn't know how to handle hard sigmoid.
Apparently, it's our job to provide a node converter for either `F.hardsigmoid` or the enclosing `Hardsigmoid` module (or the entire `MyModule`, but that makes little sense). Here, we'll go for the former.
Conversion is done directly. No layers upon layers of abstraction, no obscure intermediate representation.
A node converter is just a `Callable` that takes the same arguments as the corresponding node in Pytorch and outputs an equivalent node in Tensorflow.
The converted node preserves the original node's signature, but Pytorch tensors replaced with Tensorflow counterparts (be that `tf.Tensor`, `KerasTensor`, `tf.Variable`, or `ResourceVariable`).
This should do the trick:
````python
@nobuco.converter(F.hardsigmoid, channeExcerpt of 42,307 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:b0e3fa03005cbc21, topic:deep-learning, topic:pytorch, topic:tensorflow