wizdroid's picture
Upload 6 files
fec22c7 verified
|
Raw History Blame Contribute Delete
5.55 kB
# Ollama prompt experiment
`ollama-try` sends one prompt to a local Ollama model and prints the answer. Use it to see whether a model will return scene files without a plan or a chain of thought. It does not write a film folder, and it does not call ComfyUI.
The program is `quickies/comfyui/ollama-try`. From `~/Projects/short-films`:
```bash
./quickies/comfyui/ollama-try --help
./quickies/comfyui/ollama-try --self-test
```
`--self-test` only checks that `<think>` blocks are removed. It does not call Ollama.
## What you need
1. Ollama is running at `http://127.0.0.1:11434`.
2. The GPU is free. This machine has one GPU. Do not run this while ComfyUI, MiniMax H3, or IndexTTS is using it.
Check both:
```bash
curl -sf http://127.0.0.1:11434/api/version
curl -sf http://127.0.0.1:11434/api/ps
nvidia-smi --query-gpu=memory.used,utilization.gpu --format=csv
curl -sf http://127.0.0.1:9000/queue
```
`/api/ps` should show no model, or only the model you are about to test. ComfyUI's queue should have nothing running and nothing pending. Video memory should be a few GB, not the 16 GB a loaded MiniMax job holds.
If the queue is empty and ComfyUI is still holding the weights, release that cache, then look at the memory line again:
```bash
curl -sf -X POST http://127.0.0.1:9000/free \
-H 'Content-Type: application/json' \
-d '{"unload_models": true, "free_memory": true}'
```
The next ComfyUI job will load the weights again.
## Where the files go
Put every run in its own folder under `quickies/comfyui/experiments/`. The answer is written there with `--out`. Thinking, when you ask to see it, is stderr, so redirect stderr into the same folder. Do not send the answer to `/tmp`. That path is outside the project and does not show up in the workspace.
```text
quickies/comfyui/experiments/1978-lata-vikram/
system.txt instructions: format, locks, no commentary
story.txt the high-level story only
answer.txt stdout, the model's files
stderr.txt empty when no thinking was returned
```
`1978-lata-vikram/` is the run already on disk. `answer.txt` is the model's text. `system.txt` and `story.txt` are what was sent.
## The call that matches that run
`qwen-3.8-27B-Q4XL` is the model for a full set of clip files. Its Modelfile template is only `{{ .Prompt }}`, so a system role may never reach it. `--preface-system` copies `system.txt` into the front of the user turn. `--generate` calls `/api/generate`, which matches that template. Thinking stays off unless you pass `--think`.
```bash
cd ~/Projects/short-films
./quickies/comfyui/ollama-try \
--model qwen-3.8-27B-Q4XL \
--temperature 0 \
--num-predict 4096 \
--show-thinking \
--generate \
--preface-system \
--system quickies/comfyui/experiments/1978-lata-vikram/system.txt \
--prompt-file quickies/comfyui/experiments/1978-lata-vikram/story.txt \
--out quickies/comfyui/experiments/1978-lata-vikram/answer.txt \
2> quickies/comfyui/experiments/1978-lata-vikram/stderr.txt
```
`--num-predict 4096` is the token cap for a four-clip answer. A longer film needs a higher cap. `--temperature 0` keeps the run repeatable. `--show-thinking` prints any reasoning on stderr. With thinking off, `stderr.txt` should be empty.
Stdout is also printed in the terminal. `--out` writes the same text again.
When the run finishes, unload the model so the GPU is free for ComfyUI:
```bash
curl -sf http://127.0.0.1:11434/api/generate \
-H 'Content-Type: application/json' \
-d '{"model":"qwen-3.8-27B-Q4XL","keep_alive":0}'
```
## A new story
Copy the folder, replace `story.txt`, keep `system.txt` unless you are testing a different instruction, and point `--out` and the stderr redirect at the new folder.
```bash
mkdir -p quickies/comfyui/experiments/my-run
cp quickies/comfyui/experiments/1978-lata-vikram/system.txt \
quickies/comfyui/experiments/my-run/system.txt
```
Write `quickies/comfyui/experiments/my-run/story.txt`, then run the same command with `my-run` in place of `1978-lata-vikram`.
## What to look at afterward
Open `answer.txt`. For this experiment a usable answer has only the marked sections `### arc.md` and `### clip-01-15s.txt` onward. No plan before them.
Then check the pictures against the headers:
- Each lock in `arc.md` appears again in the clip, character for character.
- Shot 1 begins with the style sentence, in brackets: `[Shot 1]`.
- `overall_soundscape` and `non_diegetic_music: N/A` are present.
- `handoff-from: clip-NN last frame` begins on the picture named in the previous `end-frame`.
- A new room, a time jump, or a costume change uses `handoff-from: none`.
- Spoken lines are only the ones the story asked for.
The 1978 answer is the sample of a clean channel and a weak film. `stderr.txt` is empty, and `answer.txt` has no commentary. The locks are paraphrased, the handoff pictures do not continue, and the sound lines are missing. Those misses are recorded in `quickies/comfyui/story-pipeline.md`.
## Other switches
| Switch | Effect |
|---|---|
| `--think` | Lets the model reason. Leave it off for this experiment. |
| `--show-thinking` | Prints a `thinking` field, or a removed `<think>` block, on stderr. |
| `--raw` | Leaves `<think>` blocks in the answer. |
| `--model mag-mel-R1-12B` | Tries a smaller model. Do not treat it as able to hold a full set of locks. |
| *(no `--generate`)* | Calls `/api/chat` instead. Use this when you want to see whether a system role survives. |
| `--host` | Another Ollama address. The default is `http://127.0.0.1:11434`. |