def upload_hyperparams(self, hyperparams_file=None, **kwargs): base_url = self.url name = self.workspace user = self.user kwargs['user'] = user if hyperparams_file: f = open(hyperparams_file, 'r').read() label = " Uploading (hyper)parameters bundle" else: f = json.dumps({}) label = None r = upload_with_progress_bar(f, f"{base_url}/data/{name}/params", kwargs, label=label) if r.status_code < 300: return r.json() elif 400 <= r.status_code < 500: err = Error.from_dict(r.json()) raise RequestError(err.message) else: raise RequestError(r.text)
def upload_data_bundle(self, bundle_file, **kwargs): base_url = self.url name = self.workspace user = self.user kwargs['user'] = user with open(bundle_file, 'rb') as data: r = upload_with_progress_bar(data, f"{base_url}/data/{name}/features", kwargs, " Uploading data bundle") if r.status_code < 300: return r.json() elif 400 <= r.status_code < 500: err = Error.from_dict(r.json()) raise RequestError(err.message) else: raise RequestError(r.text)
def upload_source_bundle(self, c, model_id, **kwargs): base_url = self.url name = self.workspace user = self.user kwargs['user'] = user with open(c, 'rb') as data: r = upload_with_progress_bar( data, f"{base_url}/inference/{name}/{model_id}", kwargs, " Uploading source bundle", self.token) if r.status_code < 300: return r.json() elif 400 <= r.status_code < 500: err = Error.from_dict(r.json()) raise RequestError(err.message) else: raise RequestError(r.text)
def upload_manifest(self, manifest_file, **kwargs): base_url = self.url name = self.workspace user = self.user kwargs['user'] = user with open(manifest_file, 'rb') as manif_f: r = upload_with_progress_bar(manif_f, f"{base_url}/data/{name}/manifest", kwargs, " Uploading manifest bundle") if r.status_code < 300: return r.json() elif 400 <= r.status_code < 500: err = Error.from_dict(r.json()) raise RequestError(err.message) else: raise RequestError(r.text)