Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
 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))
Пример #7
0
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
Пример #8
0
 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))
Пример #9
0
 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 []
Пример #10
0
 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))
Пример #11
0
 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))
Пример #12
0
 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
Пример #13
0
 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
Пример #14
0
 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 []
Пример #15
0
 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 []
Пример #16
0
    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 []
Пример #17
0
    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 []
Пример #18
0
 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 []
Пример #19
0
    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 []
Пример #20
0
    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 []