What's up in the Python community? – April 2023
bitecode.substack.com
bitecode.substack.com
The Web could use more of this.
Look, even if you're the most biggest skeptic of all the AI stuff you can still do useful things with it that you couldn't before like present full-English interfaces and get embeddings for arbitrary text which is a leap compared to word2vec for search. I can dm my discord bot a picture of an appointment confirmation text and it with OCR + LLm it just schedules the event in my calendar. Also by gluing a v8 isolate to the LLm I can give it much more complicated date calculations. My favorite was "If f(n) is the nth Fibonacci number schedule an appointment in f(5) days."
> ...
> If f(n) is the nth Fibonacci number schedule an appointment in f(5) days
hmmm
[1] https://github.com/wingedrhino/static-tesseract
[2] https://pypi.org/project/pytesseract/
[3] https://python.langchain.com/en/latest/modules/agents/tools/...
[4] https://pypi.org/project/dateparser/
[5] https://docs.aws.amazon.com/lambda/latest/dg/images-test.htm...
Also I don't know how this list is built but it seems to be literally measuring current popular things - so by definition no matter when i visit this list whatever is it at the top will probably wane in popularity shortly after I've visited.
Same kinda deal with the big frameworks either surviving (likely with large rewrites for improvements) or succeeded by a replacement. But it feels like that's died down a bit.
> pytorch, tensorflow, pandas, numpy, scikit-learn
I think it's likely these will either survive or be replaced by a successor - but we wont be seeing 100 new ai packages a day.
"AI" is pretty narrow, but the python ecosystem is massive, which a strong incumbency in the data processing space. Weird, since it i̶s̶n̶'̶t̶ ̶a̶ ̶t̶y̶p̶e̶d̶ is a dynamically language, where sometimes placeholders like pandas `object` result in unexpected behavior, but it sure is simple to write something quick.
Nor is Excel, and that didn't stop it.
Having used it for over 15 years, I assure you Python is a strongly typed language.
So, will a given AI Python package be popular in a year or three? Maybe, maybe not. Will the top Python packages be AI related in 3 to 5 years? Absolutely, imho. I’d definitely take that bet.
[1] https://insights.stackoverflow.com/trends/?tags=java%2Cc%2Cc...
That's not to say the remaining 55% are broken on 3.11, just tread with caution. For comparison, 71% explicitly support 3.10.
I'm personally watching https://learn.microsoft.com/en-us/answers/questions/1191155/... because Sidekiq 7 requires at least Redis 6.2, but Azure Cache decided only major version upgrades matter
This should give you a better idea of Python version status: https://devguide.python.org/versions
3.10 is pretty good to use lately with PyTorch and numpy, which I mention because they are usually the main stragglers I have to track. They are both compiled with your friendly local architecture’s stack.
Pydantic and FastAPI almost fell over because of changes to annotation handling, but woosh. That drama was forestalled.
I think the python 3.3+ series has confused a lot of people because major version improvements have been crammed into the process.
Guido, if you’re reading, we should have just gone to 4 when we changed so many things. I get why we were hesitant of versioning after the str/unicode upgrade broke everyone, but like…
There are versions of 3 that we had to almost immediately deprecate. The javascript community is probably laughing at us.
major version = backwards compatibly break
minor version = forward compatible break
I think this is how it has always been, in general. I've seen many new people very confused by python 3 code not running with "python3". The very embarrassing answer is "You can't really know what the minimum python version unless it's documented, or you scan it with an external tool".
Is there a reasonable alternative? Pip upgradable transpiler?
https://aws.amazon.com/about-aws/whats-new/2023/04/aws-lambd...
A bit shy of the original target of 50% improvement per release, totaling 5x speedup across four releases. Hope it catches up in the next couple releases.
hmmm
"Yeah, but my wife is only two months pregnant"
Are there any that allow a user to run an LLM with GPT-3-ish capabilities on a single pc w/ <= 4GB GPU Ram in a reasonable amount of time?
Where "reasonable" is something like no more than a few minutes to get the output. A little longer wouldn't be too bad either since you could script something that submits prompts automatically and let things run in the background or something.
Trying to search for such a thing-- if it exists-- is nearly impossible right now with so much being done & talked about. Some content talks about running something on only 16GB GPU ram (!!!) which is far beyond many discrete cards. a 3080 has up to 16, some only 8 (I think 16 is the max?) and fairly decent entry level+ cards top out at 4GB.
Any options out there?
It get's very tedious prompt engineering to convince ChatGPT to respond to some perfectly reasonable prompts without and an answer that amounts to "aww shucks, I'm just a simple LLM and couldn't possible generate an answer to that sort of thing". Recently I asked it-- after about 20 prompts back and forth-- tp "analyze the personality of the person submitting these prompts" (They were prompts about the nature of AI, and how did it know that it was not a simplified LLM being run & controlled by a true advanced AGI, etc). It took about a dozen tried to get it to (finally) "Generate a fictional bio in the form of and RPG character sheet based on the prompts".
Even if it takes a few minutes and the quality is lacking a bit lacking and unpolished, I don't want to have to argue with the LLM to get a response.
OpenAI's API allows you to choose different models in the GPT3 series. Cost increases with quality. AFAIK GPT3.5 corresponds to their davinci-03 model, and it's the most expensive one to use.
The trick for the moment is to skip Python though. lambda.cpp and its many variants are the ones that I've heard working best.
I suggest starting with LLaMA 7B or Alpaca. More notes here: https://simonwillison.net/tags/homebrewllms/
This one is the easiest to get working I think: https://github.com/nomic-ai/gpt4all
That aside, https://github.com/ggerganov/llama.cpp is the best option given the constraints that you describe. However, you will still need considerable amount of system RAM for larger models - 20 Gb for llama-30b, 40 Gb for llama-65b. Swap is an option here, but performance with it is abysmal.
These things are huge, and I don't think there is any way around that. You can play tricks with quantization, and larger models seem to be more tolerant of it, but even if, as some claim, 65b could be quantized to 2-bit while retaining decent performance, that would still need 20 Gb of RAM (CPU or GPU) to load - never mind additional requirements for actual inference.
The breakthrough here is more likely to come from new hardware that is highly optimized for those LLMs - basically just matmul for various bitnesses all the way down to 2-bit plus as much fast memory as can be packed into it for a given price point.
Yet what I am missing in the news is some hint of where Python is going longer term. What will 4.0 look like? Which of the know limitations will be addressed? Will it ever be performant on a standalone basis? Will it ever be native on mobile? Etc.
> What will 4.0 look like?
Right now there has been no decisions made on a 4.0. It may be just another release, or it may remove some features, but it almost certainly won't be a major backwards compatability-breaking release like 3.0 was.
> Which of the know limitations will be addressed?
That depends on what the contributors want to put effort into. :) Speeding it up is currently getting a lot of attention. Each new release brings significant performance improvements.
> Will it ever be performant on a standalone basis?
As stated above, each new release is faster, but it is impossible to predict where it will end up, and even more impossible to know what you consider "performant". For many users, it is already performant :)
> Will it ever be native on mobile?
That is a question for the owners of the mobile platforms, as they generally decide what languages get first party "native" support on their platforms.
I did not know it was so inefficient.
Just to give you an idea of what's possible: A couple years ago I worked on live object recognition & classification (using Python and Tensorflow) and got to about ~30 FPS on an Nvidia Jetson Nano (i.e. using the GPU) and still ~12 FPS on an average laptop (using only the CPU).
using:
cfg.apply_low_vram_defaults()
interrogate_fast()
I tried lighter models like vit32/laion400 and others etc all are very very slow to load or use (model list: https://github.com/mlfoundations/open_clip)
I'm desperately looking for something more modest and light.