def create_persistor(persistor: Optional[Text]): """Create a remote persistor to store the model if configured.""" if persistor is not None: from rasa_nlu.persistor import get_persistor return get_persistor(persistor) else: return None
def create_persistor(persistor: Optional[Text]): """Create a remote persistor to store the model if configured.""" if persistor is not None: from rasa_nlu.persistor import get_persistor return get_persistor(persistor) else: return None
def create_persistor(config): # type: (RasaNLUConfig) -> Optional[Persistor] """Create a remote persistor to store the model if configured.""" if config.get("storage") is not None: from rasa_nlu.persistor import get_persistor return get_persistor(config) else: return None
def create_persistor(config): # type: (RasaNLUConfig) -> Optional[Persistor] """Create a remote persistor to store the model if configured.""" if config.get("storage") is not None: from rasa_nlu.persistor import get_persistor return get_persistor(config) else: return None
def create_persistor(config): # type: (RasaNLUConfig) -> Optional[Persistor] """Create a remote persistor to store the model if the configuration requests it.""" persistor = None if "bucket_name" in config: from rasa_nlu.persistor import get_persistor persistor = get_persistor(config) return persistor
def load_model_from_cloud(model_dir, config): try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: p.fetch_and_extract('{0}.tar.gz'.format(os.path.basename(model_dir))) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logger.warn("Using default interpreter, couldn't fetch model: {}".format(e))
def create_persistor(config): # type: (RasaNLUConfig) -> Optional[Persistor] """Create a remote persistor to store the model if the configuration requests it.""" persistor = None if "bucket_name" in config: from rasa_nlu.persistor import get_persistor persistor = get_persistor(config) return persistor
def load_model_from_cloud(model_dir, config): try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: p.fetch_and_extract('{0}.tar.gz'.format(os.path.basename(model_dir))) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logging.warn("Using default interpreter, couldn't fetch model: {}".format(e))
def _list_projects_in_cloud(self): try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.config) if p is not None: return p.list_projects() else: return [] except Exception: logger.exception("Failed to list projects.") return []
def _load_model_from_cloud(self, model_name, target_path, config): try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: p.retrieve(model_name, self._project, target_path) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logger.warn("Using default interpreter, couldn't fetch " "model: {}".format(e))
def _load_model_from_cloud(self, model_name, target_path, config): try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: p.retrieve(model_name, self._project, target_path) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logger.warn("Using default interpreter, couldn't fetch " "model: {}".format(e))
def _load_model_from_cloud(self, model_name, target_path): try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: p.retrieve(model_name, self._project, target_path) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logger.warning("Using default interpreter, couldn't fetch " "model: {}".format(e)) raise # re-raise this exception because nothing we can do now
def _load_model_from_cloud(self, model_name, target_path): try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: p.retrieve(model_name, self._project, target_path) else: raise RuntimeError("Unable to initialize persistor") except Exception as e: logger.warning("Using default interpreter, couldn't fetch " "model: {}".format(e)) raise # re-raise this exception because nothing we can do now
def _list_projects_in_cloud(self): try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: return p.list_projects() else: return [] except Exception: logger.exception("Failed to list projects. Make sure you have " "correctly configured your cloud storage " "settings.") return []
def _list_projects_in_cloud(self): try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: return p.list_projects() else: return [] except Exception: logger.exception("Failed to list projects. Make sure you have " "correctly configured your cloud storage " "settings.") return []
def _list_models_in_cloud(self) -> List[Text]: try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: return p.list_models(self._project) else: return [] except Exception as e: logger.warning("Failed to list models of project {}. " "{}".format(self._project, e)) return []
def _list_models_in_cloud(self) -> List[Text]: try: from rasa_nlu.persistor import get_persistor p = get_persistor(self.remote_storage) if p is not None: return p.list_models(self._project) else: return [] except Exception as e: logger.warning("Failed to list models of project {}. " "{}".format(self._project, e)) return []
def _list_projects_in_cloud(self): # type: () -> List[str] try: p = get_persistor(self.remote_storage) if p is not None: return p.list_projects() else: return [] except Exception as e: logger.exception("Failed to list projects. Make sure you have " "correctly configured your cloud storage " "settings. {}".format(traceback.format_exc())) return []
def _list_models_in_cloud(self, config): # type: (RasaNLUConfig) -> List[Text] try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: return p.list_models(self._project) else: return [] except Exception as e: logger.warn("Failed to list models of project {}. " "{}".format(self._project, e)) return []
def _list_models_in_cloud(self, config): # type: (RasaNLUConfig) -> List[Text] try: from rasa_nlu.persistor import get_persistor p = get_persistor(config) if p is not None: return p.list_models(self._project) else: return [] except Exception as e: logger.warn("Failed to list models of project {}. " "{}".format(self._project, e)) return []