Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def modelrun(name: AnyStr, inputs: List[AnyStr], outputs: List[AnyStr]) -> Sequence:
args = ('AI.MODELRUN', name, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
*utils.listify(outputs))
return args
if backend.upper() not in utils.allowed_backends:
raise ValueError(f"Backend not allowed. Use any from {utils.allowed_backends}")
args = ['AI.MODELSET', name, backend, device]
if batch is not None:
args += ['BATCHSIZE', batch]
if minbatch is not None:
args += ['MINBATCHSIZE', minbatch]
if tag is not None:
args += ['TAG', tag]
if backend.upper() == 'TF':
if not(all((inputs, outputs))):
raise ValueError(
'Require keyword arguments input and output for TF models')
args += ['INPUTS', *utils.listify(inputs)]
args += ['OUTPUTS', *utils.listify(outputs)]
chunk_size = 500 * 1024 * 1024
data_chunks = [data[i:i + chunk_size] for i in range(0, len(data), chunk_size)]
# TODO: need a test case for this
args += ['BLOB', *data_chunks]
return args
raise ValueError(f"Backend not allowed. Use any from {utils.allowed_backends}")
args = ['AI.MODELSET', name, backend, device]
if batch is not None:
args += ['BATCHSIZE', batch]
if minbatch is not None:
args += ['MINBATCHSIZE', minbatch]
if tag is not None:
args += ['TAG', tag]
if backend.upper() == 'TF':
if not(all((inputs, outputs))):
raise ValueError(
'Require keyword arguments input and output for TF models')
args += ['INPUTS', *utils.listify(inputs)]
args += ['OUTPUTS', *utils.listify(outputs)]
chunk_size = 500 * 1024 * 1024
data_chunks = [data[i:i + chunk_size] for i in range(0, len(data), chunk_size)]
# TODO: need a test case for this
args += ['BLOB', *data_chunks]
return args
def scriptrun(name: AnyStr,
function: AnyStr,
inputs: Union[AnyStr, Sequence[AnyStr]],
outputs: Union[AnyStr, Sequence[AnyStr]]
) -> Sequence:
args = ('AI.SCRIPTRUN', name, function, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
*utils.listify(outputs))
return args
def scriptrun(name: AnyStr,
function: AnyStr,
inputs: Union[AnyStr, Sequence[AnyStr]],
outputs: Union[AnyStr, Sequence[AnyStr]]
) -> Sequence:
args = ('AI.SCRIPTRUN', name, function, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
*utils.listify(outputs))
return args
def modelrun(name: AnyStr, inputs: List[AnyStr], outputs: List[AnyStr]) -> Sequence:
args = ('AI.MODELRUN', name, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
*utils.listify(outputs))
return args