You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cache_item_updater.py 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """Cache item updater."""
  16. import os
  17. from mindinsight.datavisual.data_transform.data_manager import BaseCacheItemUpdater, CachedTrainJob
  18. from mindinsight.lineagemgr.querier.query_model import LineageObj
  19. from mindinsight.lineagemgr.summary.lineage_summary_analyzer import LineageSummaryAnalyzer
  20. class LineageCacheItemUpdater(BaseCacheItemUpdater):
  21. """Cache item updater for lineage info."""
  22. def update_item(self, cache_item: CachedTrainJob):
  23. """Update cache item in place."""
  24. log_path = cache_item.summary_dir
  25. log_dir = os.path.dirname(log_path)
  26. lineage_info = LineageSummaryAnalyzer.get_summary_infos(log_path)
  27. user_defined_info = LineageSummaryAnalyzer.get_user_defined_info(log_path)
  28. lineage_obj = LineageObj(
  29. log_dir,
  30. train_lineage=lineage_info.train_lineage,
  31. evaluation_lineage=lineage_info.eval_lineage,
  32. dataset_graph=lineage_info.dataset_graph,
  33. user_defined_info=user_defined_info
  34. )
  35. cache_item.set(key="lineage", value=lineage_obj)

MindInsight为MindSpore提供了简单易用的调优调试能力。在训练过程中,可以将标量、张量、图像、计算图、模型超参、训练耗时等数据记录到文件中,通过MindInsight可视化页面进行查看及分析。