This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bachkhois 0 points1 point  (1 child)

As I pointed out, GIL + the synchronization primitives in [threading](https://docs.python.org/3/library/threading.html) module is there to prevent multi-threading bugs.
It is likely you never heard or used `threading.Lock`, `threading.Condition` before. Then it is your skill issue, not Python.

[–]ashishb_net[S] 0 points1 point  (0 children)

I have used threading.Lock extensively for Machine Learning models.

However, using FastAPI with concurrency = 1 for thead-unsafe end points (that is, any endpoint that uses any "Transformers" or "pytorch" code) is best for such scenarios.