Machine learning in Divooka
Divooka runs machine-learning models as nodes. You load a model with one node, then wire it into the nodes that use it: ask it a question, translate a sentence, describe a picture, transcribe a recording. The models come from the Hugging Face Hub and run on your own computer.
Which editor
| You want to | Use | Editor |
|---|---|---|
| Run Hugging Face models on your computer: chat, translation, text, vision, speech, image generation | the Deep Learning toolbox | Divooka Compute only |
| Fine-tune a language model, or train a small Keras network on a table | the Deep Learning toolbox | Divooka Compute only |
| Call a model service, online or on your computer: OpenAI, DeepSeek, Hugging Face, NVIDIA NIM, Ollama, ComfyUI | AI Services | Explore and Compute |
| Chat with a local language model, or search by embeddings | LLM | Explore and Compute |
| Turn text into speech | Generative AI | Explore and Compute |
| Use PyTorch or another Python library | Python | Divooka Compute only |
The Deep Learning toolbox ships with Divooka Compute Standard. It is not in Divooka Explore, Divooka Player or Compute Minimal. In Compute, create the document from the Machine Learning workload, which also brings Data Analytics and Linear Algebra.
No example document uses the Deep Learning toolbox yet. The graphs on this page have been built and run by Methodox.
Your first model
This Routine asks a small language model a question.
- Press
Ctrl+N, choose the Machine Learning workload and a Routine entry. Then add Platform with Add reference (Ctrl+Shift+L): it has Print Line, which the workload does not bring. - Place Load Language Model. Model:
HuggingFaceTB/SmolLM2-135M-Instruct. Device:CPU. Precision:Float32. - Place Make Generation Settings. Max New Tokens:
32. - Place Ask and connect it to the execution wire from Begin. Question:
What is the capital of France?Wire the model into Model and the settings into Settings. - Place Print Line after Ask and wire Ask's Reply into it.
- Press
F5.
The first run downloads the model, a few hundred megabytes, so it needs an internet connection and takes a while. Later runs use the copy on disk. The console prints:
The capital of France is Paris.
Make Generation Settings tells the model to always pick its most likely next word, so the answer is the same every run. Without it, the model picks at random, and each run can answer differently.
More graphs to build
Each of these is a Load node, a node that uses the model, and a Print Line. They run on the CPU with small models.
| Task | Load node and model | Then | Prints |
|---|---|---|---|
| Translate | Load Text-to-Text Model, google-t5/t5-small |
Translate: The house is wonderful., from English to German |
Das Haus ist wunderbar. |
| Read the mood of a text | Load Text Classifier, distilbert/distilbert-base-uncased-finetuned-sst-2-english |
Classify Text: I love this movie! |
POSITIVE |
| Find names in a text | Load Entity Recognizer, dslim/bert-base-NER |
Recognize Entities: My name is Wolfgang and I live in Berlin. |
the names Wolfgang and Berlin, as a person and a place |
| Search by meaning | Load Embedding Model, sentence-transformers/all-MiniLM-L6-v2 |
Rank By Similarity of three sentences to A kitten resting on a carpet |
the cat sentence first, the stock-market one last |
| Ask about a picture | Load Vision Language Model, HuggingFaceTB/SmolVLM-256M-Instruct |
Chat About Image, with a picture from Load From File | a reply about the picture |
| Transcribe a recording | Load Speech Recognizer, openai/whisper-tiny |
Transcribe File, with the path of a WAV file | the words spoken |
Main ideas
A model is loaded once. Loading is the slow part. A Load node asked again for the same model, on the same device and precision, gives back the one already loaded. Unload Model and Unload All Models free the memory. One model runs one call at a time.
Models are downloaded and kept. A Load node takes a Hugging Face repository id and downloads what it needs the first time. Models go into the same cache Python's huggingface_hub uses: the hub folder of HF_HOME, by default ~/.cache/huggingface/hub. A model already downloaded by Python is found there. For a gated or private model, set your token in HF_TOKEN. The Hugging Face Hub nodes download ahead of time and list what is in the cache.
Training happens in Routines. Fine-Tune Language Model, Train Keras Model and the streaming chat nodes are offered only in Routines. In a Flows graph they would run again every time something upstream changed.
Keras networks are drawn as the network. Each layer node takes the tensor of the layer before: Input, then Dense, Dropout, Conv2D and the others, then Build Keras Model from the first and last. Train Keras Model reads the number columns of a table, such as one from Read CSV.
CPU only. Divooka Compute Standard runs these models on the CPU. Is GPU Available and Describe Runtime say what the runtime can use.
What the toolbox covers
| Area | Nodes |
|---|---|
| Language models | chat, ask, stream, continue a conversation, generate text, count tokens |
| Text-to-text models | summarize, translate, transform text (T5, Flan-T5, BART, mBART) |
| Text tasks | classify, recognize entities, answer questions, zero-shot classify, fill a mask |
| Embeddings | embed texts, cosine similarity, rank by similarity |
| Vision | classify images, zero-shot image classification |
| Vision language models | describe a picture, ask about one or several pictures, chat about a picture (SmolVLM, Qwen2-VL and later, LLaVA, Gemma 3 and others) |
| Speech | transcribe, with times for segments or words (Whisper and others) |
| Image generation | generate, transform and inpaint pictures with Stable Diffusion and SDXL, with ControlNets, LoRAs and a refiner |
| Fine-tuning | LoRA and QLoRA fine-tuning of a language model on your own examples |
| Keras | layers, building, training, predicting, saving and loading |
| ONNX | export a language model to ONNX and run it there |
The Deep Learning toolbox page lists the nodes.
See also
- ComfyUI: image generation through ComfyUI, in Explore too.
- Novel generation: a case study with a language model.
- Python and SteelPython packages: PyTorch and other Python libraries.
- Working with an AI assistant: assistants that write Divooka documents.