returnn
fastapi
returnn | fastapi | |
---|---|---|
4 | 469 | |
349 | 71,223 | |
0.6% | - | |
9.8 | 9.8 | |
10 days ago | about 20 hours ago | |
Python | Python | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
returnn
-
Keras Core: Keras for TensorFlow, Jax, and PyTorch
That looks very interesting.
I actually have developed (and am developing) sth very similar, what we call the RETURNN frontend, a new frontend + new backends for our RETURNN framework. The new frontend is supporting very similar Python code to define models as you see in PyTorch or Keras, i.e. a core Tensor class, a base Module class you can derive, a Parameter class, and then a core functional API to perform all the computations. That supports multiple backends, currently mostly TensorFlow (graph-based) and PyTorch, but JAX was something I also planned. Some details here: https://github.com/rwth-i6/returnn/issues/1120
(Note that we went a bit further ahead and made named dimensions a core principle of the framework.)
(Example beam search implementation: https://github.com/rwth-i6/i6_experiments/blob/14b66c4dc74c0...)
One difficulty I found was how design the API in a way that works well both for eager-mode frameworks (PyTorch, TF eager-mode) and graph-based frameworks (TF graph-mode, JAX). That mostly involves everything where there is some state, or sth code which should not just execute in the inner training loop but e.g. for initialization only, or after each epoch, or whatever. So for example:
- Parameter initialization.
- Anything involving buffers, e.g. batch normalization.
- Other custom training loops? Or e.g. an outer loop and an inner loop (e.g. like GAN training)?
- How to implement sth like weight normalization? In PyTorch, the module.param is renamed, and then there is a pre-forward hook, which on-the-fly calculates module.param for each call for forward. So, just following the same logic for both eager-mode and graph-mode?
- How to deal with control flow context, accessing values outside the loop which came from inside, etc. Those things are naturally possible eager-mode, where you would get the most recent value, and where there is no real control flow context.
- Device logic: Have device defined explicitly for each tensor (like PyTorch), or automatically eagerly move tensors to the GPU (like TensorFlow)? Moving from one device to another (or CPU) is automatic or must be explicit?
I see that you have keras_core.callbacks.LambdaCallback which is maybe similar, but can you effectively update the logic of the module in there?
-
Python’s “Type Hints” are a bit of a disappointment to me
> warnings of IDEs are simple to ignore
This is unusual. In my experience, of codebases I have worked with or have seen, when there are type hints, there are almost all perfectly correct.
Also, you can setup the CI to check also for IDE warnings. For example, we use this script for PyCharm: https://github.com/rwth-i6/returnn/blob/master/tests/pycharm...
The test for PyCharm inspections only passes when there are no warnings.
Although, I have to admit, we explicitly exclude type warnings because here we have a couple of false positives. So in this respect, it actually agrees with the article.
But then we also do code review and there we are strict about having it all correct.
Yes, I see the argument of the article that the typing in Python is not perfect and you can easily fool it if you want, so you cannot 100% trust the types. But given good standard practice, it will only rarely happen that the type is not as expected and typing helps a lot. And IDE type warnings, or mypy checks still are useful tools and catch bugs for you, just not maybe 100% of all typing bugs but still maybe 80% of them or so.
> Isn’t it better to detect at least some errors than to detect none at all?
-
How to cleanup a branch (PR) with huge number of commits
I was trying to implement some new feature in some larger somewhat messy project (RETURNN but not so relevant).
So I created a new branch, also made a GitHub draft PR (here), and started working on it.
fastapi
-
Github Sponsor Sebastián Ramírez Python programmer
He is probably most well know for creating FastAPI that I taught to some of my clients and Typer that I've never used.
-
Python: A SQLAlchemy Wrapper Component That Works With Both Flask and FastAPI Frameworks
It has been an interesting exercise developing this wrapper component. The fact that it seamlessly integrates with the FastAPI framework is just a bonus for me; I didn't plan for it since I hadn't learned FastAPI at the time. I hope you find this post useful. Thank you for reading, and stay safe as always.
-
FastAPI Best Practices: A Condensed Guide with Examples
FastAPI is a modern, high-performance web framework for building APIs with Python, based on standard Python type hints.
-
Building an Email Assistant Application with Burr
In this tutorial, I will demonstrate how to use Burr, an open source framework (disclosure: I helped create it), using simple OpenAI client calls to GPT4, and FastAPI to create a custom email assistant agent. We’ll describe the challenge one faces and then how you can solve for them. For the application frontend we provide a reference implementation but won’t dive into details for it.
-
FastAPI Got Me an OpenAPI Spec Really... Fast
That’s when I found FastAPI.
-
How to Deploy a Fast API Application to a Kubernetes Cluster using Podman and Minikube
FastAPI & Uvicorn
-
Analysing FastAPI Middleware Performance
Discussion at FastAPI GitHub: https://github.com/tiangolo/fastapi/issues/2696
-
LangChain, Python, and Heroku
An API application framework (such as FastAPI)
-
Litestar – powerful, flexible, and highly performant Python ASGI framework
It’s been my experience that async Python frameworks tend to turn IO bound problems into CPU bound problems with a high enough request rate, because due to their nature they act as unbounded queues.
This ends up made worse if you’re using sync routes.
If you’re constrained on a resource such as a database connection pool, your framework will continue to pull http requests off the wire that a sane client will cancel and retry due to timeouts because it takes too long to get a connection out of the pool. Since there isn’t a straightforward way to cancel the execution of a route handler in every Python http framework I’ve seen exhibit this problem, the problem quickly snowballs.
This is an issue with fastapi, too- https://github.com/tiangolo/fastapi/issues/5759
-
AI-Powered Image Search with CLIP, pgvector, and Fast API
Fast API.
What are some alternatives?
punctuator2 - A bidirectional recurrent neural network model with attention mechanism for restoring missing punctuation in unsegmented text
AIOHTTP - Asynchronous HTTP client/server framework for asyncio and Python
enforce - Python 3.5+ runtime type checking for integration testing and data validation
HS-Sanic - Async Python 3.6+ web server/framework | Build fast. Run fast. [Moved to: https://github.com/sanic-org/sanic]
keras-nlp - Modular Natural Language Processing workflows with Keras
Tornado - Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.
recurrent-fwp - Official repository for the paper "Going Beyond Linear Transformers with Recurrent Fast Weight Programmers" (NeurIPS 2021)
django-ninja - 💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
keras-core - A multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch.
Flask - The Python micro framework for building web applications.
i6_experiments
swagger-ui - Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.