Skip to content

Commit

Permalink
misc: Revert commit 33b44e7 (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-cj authored Aug 26, 2020
1 parent 1ad99ae commit 6c356a4
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 7 deletions.
30 changes: 30 additions & 0 deletions cmd/ormb-storage-initializer/cmd/pull-and-export.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ package cmd
import (
"fmt"
"os"
"path"
"path/filepath"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/kleveross/ormb/pkg/consts"
"github.com/kleveross/ormb/pkg/oras"
"github.com/kleveross/ormb/pkg/ormb"
)
Expand Down Expand Up @@ -81,13 +83,41 @@ var pullExportCmd = &cobra.Command{
return err
}

// For model serving, need relayout option.
if !reLayoutOpt {
return nil
}

if err := relayoutModel(dstDir); err != nil {
return err
}

return nil
},
}

func relayoutModel(modelDir string) error {
// Rename the `model` directory as `1`.
// e.g. move /mnt/models/model to /mnt/models/1 (dstDir).
// so that, the trtserver will serving, the refenence as
// https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/model_repository.html#section-onnx-models.
originalDir, err := filepath.Abs(
filepath.Join(modelDir, consts.ORMBModelDirectory))
if err != nil {
return err
}

if err := os.Rename(originalDir, path.Join(modelDir, "1")); err != nil {
return err
}

return nil
}

func init() {
rootCmd.AddCommand(pullExportCmd)

pullExportCmd.Flags().BoolVarP(&reLayoutOpt, "relayout", "", true, "relayout data for model serving")
pullExportCmd.Flags().BoolVarP(&plainHTTPOpt, "plain-http", "", true, "use plain http and not https")
pullExportCmd.Flags().BoolVarP(&insecureOpt, "insecure", "", true, "allow connections to TLS registry without certs")
}
Loading

0 comments on commit 6c356a4

Please sign in to comment.