Example #1
0
 def Args(parser):
     _AddCreateArgs(parser)
     flags.SERVICE_ACCOUNT.AddToParser(parser)
     flags.AddMachineTypeFlagToParser(parser)
     flags.AddUserCodeArgs(parser)
     flags.GetAcceleratorFlag().AddToParser(parser)
     flags.AddExplainabilityFlags(parser)
Example #2
0
def _AddCreateArgs(parser):
    """Add common arguments for `versions create` command."""
    flags.GetModelName(positional=False, required=True).AddToParser(parser)
    flags.GetDescriptionFlag('version').AddToParser(parser)
    flags.GetRegionArg(include_global=True).AddToParser(parser)
    flags.VERSION_NAME.AddToParser(parser)
    base.Argument('--origin',
                  help="""\
          Location of ```model/``` "directory" (see
          https://cloud.google.com/ai-platform/prediction/docs/deploying-models#upload-model).

          This overrides `deploymentUri` in the `--config` file. If this flag is
          not passed, `deploymentUri` *must* be specified in the file from
          `--config`.

          Can be a Cloud Storage (`gs://`) path or local file path (no
          prefix). In the latter case the files will be uploaded to Cloud
          Storage and a `--staging-bucket` argument is required.
      """).AddToParser(parser)
    flags.RUNTIME_VERSION.AddToParser(parser)
    base.ASYNC_FLAG.AddToParser(parser)
    flags.STAGING_BUCKET.AddToParser(parser)
    base.Argument('--config',
                  help="""\
          Path to a YAML configuration file containing configuration parameters
          for the
          [Version](https://cloud.google.com/ai-platform/prediction/docs/reference/rest/v1/projects.models.versions)
          to create.

          The file is in YAML format. Note that not all attributes of a version
          are configurable; available attributes (with example values) are:

              description: A free-form description of the version.
              deploymentUri: gs://path/to/source
              runtimeVersion: '2.1'
              #  Set only one of either manualScaling or autoScaling.
              manualScaling:
                nodes: 10  # The number of nodes to allocate for this model.
              autoScaling:
                minNodes: 0  # The minimum number of nodes to allocate for this model.
              labels:
                user-defined-key: user-defined-value

          The name of the version must always be specified via the required
          VERSION argument.

          Only one of manualScaling or autoScaling can be specified. If both
          are specified in same yaml file an error will be returned.

          If an option is specified both in the configuration file and via
          command-line arguments, the command-line arguments override the
          configuration file.
      """).AddToParser(parser)
    labels_util.AddCreateLabelsFlags(parser)
    flags.FRAMEWORK_MAPPER.choice_arg.AddToParser(parser)
    flags.AddPythonVersionFlag(parser, 'when creating the version')
    flags.AddMachineTypeFlagToParser(parser)
    flags.GetAcceleratorFlag().AddToParser(parser)
    flags.AddAutoScalingFlags(parser)
Example #3
0
 def Args(parser):
     _AddCreateArgs(parser)
     flags.ALPHA_MACHINE_TYPE.AddToParser(parser)
     flags.SERVICE_ACCOUNT.AddToParser(parser)
     flags.AddUserCodeArgs(parser)
     flags.GetAcceleratorFlag().AddToParser(parser)