Skip to content

Commit

Permalink
update project name creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bourdakos1 committed Jan 5, 2020
1 parent 4c1d3ae commit 2fe1a13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 10 additions & 0 deletions cacli/cmd/train/train.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package train
import (
"fmt"
"os"
"strconv"
"strings"
"time"

Expand All @@ -26,8 +27,10 @@ func Run(cmd *cobra.Command, args []string) {
projectName, err := cmd.Flags().GetString("name")
output, err := cmd.Flags().GetString("output")
steps, err := cmd.Flags().GetInt("steps")
stepsChanged := cmd.Flags().Changed("steps")
gpu, err := cmd.Flags().GetString("gpu")
script, err := cmd.Flags().GetString("script")

if err != nil {
e.Exit(err)
}
Expand Down Expand Up @@ -99,6 +102,13 @@ func Run(cmd *cobra.Command, args []string) {
s.Suffix = " Starting training run..."
s.Start()

if projectName == "" {
projectName = *trainingBucket.Name
}
if stepsChanged {
// if non default steps, include it in project name.
projectName = projectName + " (" + strconv.Itoa(steps) + ")"
}
model, err := session.StartTraining(script, projectName, trainingBucket, outputBucket, steps, gpu)
if err != nil {
e.Exit(err)
Expand Down
12 changes: 1 addition & 11 deletions cacli/ibmcloud/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,7 @@ func (s *AccountSession) CreateCredential(params CreateCredentialParams) (*Crede
}

func (s *CredentialSession) StartTraining(trainingZip string, projectName string, bucket *s3.BucketExtended, output *s3.BucketExtended, steps int, gpu string) (*Model, error) {
// if non default steps, include it in project name.
if projectName == "" {
projectName = *bucket.Name
}

// TODO: This shouldn't be hardcoded here.
if steps != 1000 {
projectName = projectName + " (" + strconv.Itoa(steps) + ")"
}

// TODO: We shouldn't hard code all of this either.
// TODO: We shouldn't hard code all of this.
trainingDefinition := &TrainingDefinition{
Name: projectName,
Framework: Framework{
Expand Down

0 comments on commit 2fe1a13

Please sign in to comment.