Skip to content

show: keep a custom LICENSE in the Modelfile - #63

Open
kartsan03 wants to merge 1 commit into
ollaya-dev:mainfrom
kartsan03:fix/show-custom-license
Open

kartsan03 wants to merge 1 commit into
ollaya-dev:mainfrom
kartsan03:fix/show-custom-license

Conversation

@kartsan03

Copy link
Copy Markdown

/api/create takes a license for a derived model and stores it as the model's own license layer, and show returns it in license. The Modelfile from ollaya show --modelfile leaves it out, though:

POST /api/create {"model": "short", "from": "laya:en", "license": "MIT"}

# Modelfile generated by "ollaya show"
# To build a new Modelfile based on this, replace FROM with:
# FROM short:latest

FROM laya:en
DESCRIPTION laya:en for tests

So ollaya create -f on that Modelfile builds a model with the parent's license instead of MIT. This is the same round-trip loss that #57 fixed for DESCRIPTION and #55 fixed for CALIBRATION.

Change: in views::show, a derived model whose license layer differs from its parent's gets a LICENSE """ ... """ block. It's always a block: modelfile::parse reads a one-line LICENSE value as a path to a license file, so LICENSE MIT would look for a file named MIT. A license the model shares with its parent stays out of the Modelfile, the same digest rule #55 uses for calibration. The parent manifest is now read once for both checks.

Test: show_modelfile_keeps_a_custom_license in crates/ollaya-server/tests/http.rs creates two derived models, one with MIT and one with a multi-line license, and checks for the LICENSE block in each show. Then it creates a child of the second one and checks that the child's Modelfile has no LICENSE. It fails on main and passes with this change.

cargo fmt --all --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --exclude ollaya --exclude ollaya-runner --locked   # http: 17 passed

I couldn't link ollaya and ollaya-runner on this machine: the prebuilt ONNX Runtime needs a newer glibc than it has. This change doesn't touch either crate, and clippy checked both.

A derived model's own license was missing from the Modelfile that show
writes, so ollaya create -f on it went back to the parent's license. Write it
as a """ block, since a one-line LICENSE value is read as a path. A license
the model shares with its parent stays inherited, as CALIBRATION does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant