Mini-dalle in OCaml

I wanted to announce my work of porting mini-dalle to OCaml

I’m looking for feedback as I look to publish this to opam in the near future.

Thanks @laurent for suggesting that I share this here!

13 Likes

Looks super interesting. Do you have usage examples?

The steps to run are listed here. Does that help?

Yep, I saw that, but does it require any extra setup? Training files, or AI models or something like that? Is it supposed to be executed in an environment like Google colab or something?
Sorry, I just have very little experience with AI

I see. I could write up a section on what it does.

All the user has to do is build the docker image with “make mini-dalle” and run the dune exec command as shown in the Readme.

In the background this is what happens:

  1. On the first run, It downloads pretrained weights from a repo and saves them in a directory
  2. Download takes some time around 10 mins and approx 7GB space
  3. It then, runs the inference path by converting text to text tokens, text tokens to image tokens and image tokens to image. This takes about 30 seconds on a A100 GPU. On my Intel CPU, it will take longer around 11 mins
  4. In the subsequent runs, it just uses the downloaded weights and starts running from step 3.

I can add a notebook in the future. Right now, it just works from the command line. Hope it helps!

1 Like

It’s nice to have this repo. Having more code using the ocaml-torch package is very useful for people used to pytorch and who want to translate their model in OCaml.

Yeah, that is a perfect explanation, thank you very much.
Also happy to see that I do not need special equipment as long as I am ok with having some extra patience :smile:

When will we have an ocaml-keras package?
I am so tired of working with Python code.
Always crashing at run-time, this is hell…

I’m running into some problems building the image, maybe you can help me with.
It fails at the following step

RUN git clone https://github.com/LaurentMazare/ocaml-torch.git
RUN cd ocaml-torch && opam install -y .

It does not pick the downloaded torch. Seems to be ignoring the env variable

I’d be happy to take a look. Can you share the error in a github issue?