Skip to content

codekansas/ml-pretrained

Repository files navigation

ML Pretrained

python pytorch
black ruff
license


$ pip install ml-pretrained
# Try out the RWKV model. This requires the `tokenizers` package.
$ pip install tokenizers
$ python -m pretrained.rwkv 430m 'Scientists recently discovered an island populated entirely by cats. To their astonishment, none of the cats were hungry. Upon further investigation,'
Scientists recently discovered an island populated entirely by cats. To their astonishment, none of the cats were hungry. Upon further investigation, in fact, researchers discovered that they were members of an ancestral, living species. When this research was published in 2009 in the journal Current Biology, there was widespread praise for their research.

So what do we make of the current understanding of what happens to these amazing creatures when they no longer exist on a cold planet? Much of the literature on the matter seems to conclude that there’s no hope of coming to grips with this question, that everything we know about this species, or even any of the non-human species that may be out there in space, is simply a human’s or animal’s invention.
# Try out the Tacotron2 model. This requires the `sounddevice`, `inflect` and `ftfy` packages.
$ pip install sounddevice inflect ftfy
$ python -m pretrained.tacotron2 'Scientists recently discovered an island populated entirely by cats. To their astonishment, none of the cats were hungry.'
# Chain these together.
$ python -m pretrained.tacotron2 "$(python -m pretrained.rwkv 430m 'Scientists recently discovered an island populated entirely by cats. To their surprise,' --tsz 64)"

What is this?

This is a collection of pre-trained model implementations, which can be used in down-stream packages.

Goal

The goal of this repository is to make it as easy as possible to try out a pre-trained model, and eventually incorporate it into a new project. To that end, each implementation is a self-contained file, so that you can just copy-paste it wholesale into whatever project your using or use it directly without adding a bunch of dependencies. Additionally, the implementations use high-quality, modern Python syntax to be as easy to follow as possible.

This also includes some custom Triton kernels for certain operations which may benefit from GPU acceleration.

License

Note that while this particular code is MIT licensed, but that does not mean that all of the model weights are. You should comply with the upstream licenses for models that you use.