AI Models for Objeck

Objeck supports two categories of AI model: Ollama (local LLMs via the Ollama server) and ONNX (on-device inference via ONNX Runtime). Neither category requires a cloud API key.


Ollama Models

1. Install Ollama

Download and install from https://ollama.com/download (Windows, macOS, Linux).

After installation the Ollama server starts automatically. Verify it is running:

ollama list

2. Pull a Model

ollama pull <model-name>
TaskModelPull CommandSize
General chat / reasoningllama3.2ollama pull llama3.2~2 GB
Lightweight / fastphi3ollama pull phi3~2.3 GB
Vision / multimodalllavaollama pull llava~4.7 GB
Code generationqwen2.5-coderollama pull qwen2.5-coder~1.5 GB
Embeddingsnomic-embed-textollama pull nomic-embed-text~274 MB

Browse the full library at https://ollama.com/library.

4. Verify a Model Works

ollama run llama3.2 "Say hello in one word"

5. Use in Objeck

use API.Ollama;

response := Completion->Generate("llama3.2", "Why is the sky blue?");
response->PrintLine();

Compile with: obc -src your.obs -lib net,json,cipher,misc,ollama

See the Ollama examples and the AI Developer Guide.


ONNX Models

ONNX models run fully on-device, on the accelerator the platform's build was compiled for (DirectML on Windows x64, QNN on Windows ARM64, CoreML on macOS) or on the CPU. The Linux x64 build is CPU-only, and the Linux ARM64 packages do not include ONNX. Models must be downloaded separately — they are too large for the repository.

Supported Models

Session ClassTaskModelSource
Phi3SessionText generation (SLM)Phi-3 Mini 4K INT4Hugging Face
Phi3VisionSessionMultimodal image+textPhi-3 Vision 128K INT4Hugging Face
YoloSessionObject detectionYOLOv11nUltralytics
ResNetSessionImage classificationResNet-34ONNX Model Zoo
DeepLabSessionSemantic segmentationDeepLabV3ONNX Model Zoo
OpenPoseSessionHuman pose estimationOpenPoseCMU OpenPose
FaceSessionFace detection + recognitionSCRFD + ArcFace R50InsightFace buffalo_l

Hugging Face models by name

Text models published on the Hugging Face Hub with an ONNX export download by name, with no Python: System.AI.Hub.HubClient (-lib net,ai_hub) fetches a repository's files into ~/.objeck/hub (or OBJECK_HUB_CACHE), checks each file's size and SHA-256 against the Hub, and works offline from the cache. System.NLP.Onnx.TextClassifier then opens the folder. See AI.md.

folder := HubClient->New()->Snapshot("Xenova/distilbert-base-uncased-finetuned-sst-2-english",
  ["config.json", "tokenizer.json", "tokenizer_config.json", "onnx/model.onnx"]);
classifier := TextClassifier->New(folder);

Download Models

Phi-3 Mini (text generation, ~2 GB)

pip install huggingface_hub
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-onnx \
  --include "directml/directml-int4-awq-block-128/*" \
  --local-dir data/models/phi3

Phi-3 Vision (multimodal, ~2.5 GB)

huggingface-cli download microsoft/Phi-3-vision-128k-instruct-onnx-directml \
  --include "directml-int4-rtn-block-32/*" \
  --local-dir data/models/phi3v

Face recognition (~191 MB total)

curl -L -o buffalo_l.zip \
  https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip
unzip buffalo_l.zip det_10g.onnx w600k_r50.onnx -d data/models/

YOLO object detection

pip install ultralytics
yolo export model=yolo11n.pt format=onnx
# rename yolo11n.onnx → data/models/yolov11.onnx

ResNet-34 classification

Download resnet34-v1-7.onnx from the ONNX Model Zoo, rename to resnet34.onnx.

Expected Directory Layout

data/models/
  det_10g.onnx             # face detector (SCRFD)
  w600k_r50.onnx           # face recognizer (ArcFace R50)
  yolov11.onnx
  resnet34.onnx
  deeplabv3.onnx
  openpose.onnx
  phi3/
    directml/directml-int4-awq-block-128/
      model.onnx
      model.onnx.data
      tokenizer.json
      genai_config.json
  phi3v/
    directml-int4-rtn-block-32/
      phi-3-v-128k-instruct-vision.onnx + .data
      phi-3-v-128k-instruct-text-embedding.onnx + .data
      model.onnx + .data
      tokenizer.json
      genai_config.json

Execution Providers

Each platform's library is compiled with one execution provider, and the ep key can only select that provider or the CPU. Naming any other provider is refused with an error, and no session is created. Leaving ep out uses the build's provider.

PlatformAcceleratorProvider flag
Windows x64GPU via DirectML"ep" → "dml"
Windows ARM64Qualcomm GPU via QNN"ep" → "qnn"
Linux x64none (CPU-only build)"ep" → "cpu"
macOSApple Neural Engine / GPU via CoreML"ep" → "coreml"
AnyCPU fallback"ep" → "cpu"

Use in Objeck

use API.Onnx, Collection;

config := Map->New()<String, String>;
config->Insert("ep", "dml");   # Windows x64; "qnn" or "coreml" on those builds, "cpu" anywhere
session := Phi3Session->New("data/models/phi3/directml/directml-int4-awq-block-128/model.onnx", config);

Compile with: obc -src your.obs -lib models,net,json,cipher,opencv,onnx

See the ONNX examples, the detailed model reference, and the AI Developer Guide.