Skip to main content

一个常用的工具代码包集合

Project description

kevin_toolbox

一个通用的工具代码包集合

环境要求

numpy>=1.19
pytorch>=1.2

安装方法:

pip install kevin-toolbox  --no-dependencies

项目地址 Repo

使用指南 User_Guide

免责声明 Disclaimer

版本更新记录

  • v 1.4.10 (2025-04-11)【new feature】【bug fix】

    • patches.for_logging

      • modify build_logger() to allow parameter level to accept str input,允许参数 level 接受str输入,比如“DEBUG”或者“INFO”。
    • computer_science.algorithm

      • cache_manager
        • 【new feature】add load_state_dict(), state_dict() to Cache_Base, Memo_Cache, Cache_Manager ,增加加载和保存状态的相关接口。
        • add Cache_Manager_wto_Strategy,新增一个不绑定任何策略的缓存管理器,可以视为容量无上限的特殊情况
        • refactor Cache_Manager,基于 Cache_Manager_wto_Strategy 对 Cache_Manager 代码进行简化和重构。
      • 【new feature】redirector
        • 该新增模块包含重定向功能的函数和类。所谓重定向,其本质是:原目标失效或不合适时,自动转向一个新的目标,以保证流程不中断或获得正确结果
        • add Redirectable_Sequence_Fetcher,用于从给定 seq 中获取元素,可以通过自动跳转来处理获取失败的情况。
          • 功能描述:
            1. 对于给定的索引 idx,若能通过 seq(idx) 成功获取,则直接返回获取的结果。
            2. 若不能成功获取,则会根据给定的规则修改索引(如idx-1)重新尝试获取,递归调用直至获取成功或者递归调用次数达到上限。
              1. 若不能成功获取,则会根据给定的规则修改索引(如idx-1)重新尝试获取,递归调用直至获取成功或者递归调用次数达到上限。
              2. 当失败次数达到上限后,则不再进行尝试并直接返回重新向后的新的 idx 的结果。
              3. 若在此过程中原来失败的 idx 又能再次获取成功,则将失败次数减1,直至归零并删除该记录。
            3. 若递归次数达到上限,则进行报错或者返回给定的默认值。
              1. 若开启了跳转记忆功能,在重试过程中,一旦某次调用成功,记录原始索引与最终有效索引之间的映射关系。
        • 添加了对应的测试用例。
      • for_seq
        • 【new feature】add sample_subset_most_evenly(),对列表按给定比例or数量进行采样,并返回一个新的列表,同时保证列表中每个元素在新列表中的占比尽量相近。
      • redirector
        • 【new feature】modify Redirectable_Sequence_Fetcher,增加了 seed 参数并在 state_dict 中增加 rng_state 项,以便控制(保存和重现)随机行为。
      • 【new feature】sampler
        • 该新增模块包含采样相关的函数和类。
        • add Reservoir_Sampler,水库采样器。
    • data_flow.file.kevin_notation

      • 【bug fix】fix bug in Kevin_Notation_Reader and Kevin_Notation_Writer

        • bug 原因:由于之前的版本默认启用"//"作为注释符号,因此导致无法正确读取带有"//"的值

        • 解决:在 Kevin_Notation_Reader 和 Kevin_Notation_Writer 取消默认使用注释,并限定只有在 metadata 中显式指定注释标志符才会启用

        • 注意:该修改可能导致原本带有注释的旧版本 .kvt 文件无法被正确读取,遇到该情况时,可以尝试将# --metadata--部分修改为:

          # --metadata--
          # sep
          	
          # comment_flag
          //
          ...
          
      • 添加了对应的测试用例。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kevin-toolbox-dev-1.4.10.tar.gz (214.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kevin_toolbox_dev-1.4.10-py3-none-any.whl (387.4 kB view details)

Uploaded Python 3

File details

Details for the file kevin-toolbox-dev-1.4.10.tar.gz.

File metadata

  • Download URL: kevin-toolbox-dev-1.4.10.tar.gz
  • Upload date:
  • Size: 214.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.11

File hashes

Hashes for kevin-toolbox-dev-1.4.10.tar.gz
Algorithm Hash digest
SHA256 4e54ee54c27b6910c53186f5b01d18cd5a35acd04d815e7ce556c5d86c610457
MD5 28f25ae9ef1a01aa85e40e04dc699c1f
BLAKE2b-256 e9611e657e99f487366ef6dccddbf6aaa2a7380d245589690769b5ae1274c5a4

See more details on using hashes here.

File details

Details for the file kevin_toolbox_dev-1.4.10-py3-none-any.whl.

File metadata

File hashes

Hashes for kevin_toolbox_dev-1.4.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ef6eb6799b883285104e79e3ac488617351aaa23429b3aeecd03d89aa8009480
MD5 f475f2ff8a914733b6db8cb6b96fe7a9
BLAKE2b-256 0db2b3ba5d912170fe831cd691affb96dd9b67e7848cb590dcfc76b2d337b213

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page