Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changelog

## main

* Add --prefix option to load-models
* Add get-model-source command
* Use models path as a default prefix (could be overwitten by --prefix flag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly is the semantic for use of paths in file names? aside from the prefix arg? eg: i assume we canonicalize paths in some way? what does ../foo/../bar/baz/model.rel do? what if its a path from home, eg: ~/bar/baz/model? and what about a fully qualified path? the original idea was to use the basename, and prepend any prefix provided by the prefix arg. simple and unambiguous. what use case does this not handle?


## V0.1.1

Expand Down
5 changes: 5 additions & 0 deletions rai/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,16 @@ func loadModels(cmd *cobra.Command, args []string) {
prefix := action.getString("prefix")
models := map[string]io.Reader{}
for _, arg := range args[1:] {
if !(cmd.Flags().Lookup("prefix").Changed) {
prefix, _ = filepath.Split(arg)
}

name := filepath.Join(prefix, baseSansExt(arg))
r, err := os.Open(arg)
if err != nil {
fatal(err.Error())
}

models[name] = r
}
if engine == "" {
Expand Down