maque 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. maque-0.2.6/.gitignore +173 -0
  2. maque-0.2.6/LICENSE +21 -0
  3. maque-0.2.6/PKG-INFO +461 -0
  4. maque-0.2.6/README.md +295 -0
  5. maque-0.2.6/maque/__init__.py +30 -0
  6. maque-0.2.6/maque/__main__.py +959 -0
  7. maque-0.2.6/maque/ai_platform/__init__.py +0 -0
  8. maque-0.2.6/maque/ai_platform/crawl.py +45 -0
  9. maque-0.2.6/maque/ai_platform/metrics.py +258 -0
  10. maque-0.2.6/maque/ai_platform/nlp_preprocess.py +67 -0
  11. maque-0.2.6/maque/ai_platform/webpage_screen_shot.py +195 -0
  12. maque-0.2.6/maque/algorithms/__init__.py +78 -0
  13. maque-0.2.6/maque/algorithms/bezier.py +15 -0
  14. maque-0.2.6/maque/algorithms/bktree.py +117 -0
  15. maque-0.2.6/maque/algorithms/core.py +104 -0
  16. maque-0.2.6/maque/algorithms/hilbert.py +16 -0
  17. maque-0.2.6/maque/algorithms/rate_function.py +92 -0
  18. maque-0.2.6/maque/algorithms/transform.py +27 -0
  19. maque-0.2.6/maque/algorithms/trie.py +272 -0
  20. maque-0.2.6/maque/algorithms/utils.py +63 -0
  21. maque-0.2.6/maque/algorithms/video.py +587 -0
  22. maque-0.2.6/maque/api/__init__.py +1 -0
  23. maque-0.2.6/maque/api/common.py +110 -0
  24. maque-0.2.6/maque/api/fetch.py +26 -0
  25. maque-0.2.6/maque/api/static/icon.png +0 -0
  26. maque-0.2.6/maque/api/static/redoc.standalone.js +1782 -0
  27. maque-0.2.6/maque/api/static/swagger-ui-bundle.js +3 -0
  28. maque-0.2.6/maque/api/static/swagger-ui.css +3 -0
  29. maque-0.2.6/maque/cli/__init__.py +1 -0
  30. maque-0.2.6/maque/cli/clean_invisible_chars.py +324 -0
  31. maque-0.2.6/maque/cli/core.py +34 -0
  32. maque-0.2.6/maque/cli/groups/__init__.py +26 -0
  33. maque-0.2.6/maque/cli/groups/config.py +205 -0
  34. maque-0.2.6/maque/cli/groups/data.py +615 -0
  35. maque-0.2.6/maque/cli/groups/doctor.py +259 -0
  36. maque-0.2.6/maque/cli/groups/embedding.py +222 -0
  37. maque-0.2.6/maque/cli/groups/git.py +337 -0
  38. maque-0.2.6/maque/cli/groups/help.py +410 -0
  39. maque-0.2.6/maque/cli/groups/llm.py +223 -0
  40. maque-0.2.6/maque/cli/groups/mcp.py +241 -0
  41. maque-0.2.6/maque/cli/groups/mllm.py +1222 -0
  42. maque-0.2.6/maque/cli/groups/mllm_simple.py +60 -0
  43. maque-0.2.6/maque/cli/groups/quant.py +210 -0
  44. maque-0.2.6/maque/cli/groups/service.py +490 -0
  45. maque-0.2.6/maque/cli/groups/system.py +1193 -0
  46. maque-0.2.6/maque/cli/mllm_run.py +1451 -0
  47. maque-0.2.6/maque/cli/script.py +52 -0
  48. maque-0.2.6/maque/cli/tree.py +49 -0
  49. maque-0.2.6/maque/clustering/__init__.py +52 -0
  50. maque-0.2.6/maque/clustering/analyzer.py +347 -0
  51. maque-0.2.6/maque/clustering/clusterers.py +464 -0
  52. maque-0.2.6/maque/clustering/sampler.py +134 -0
  53. maque-0.2.6/maque/clustering/visualizer.py +205 -0
  54. maque-0.2.6/maque/constant.py +13 -0
  55. maque-0.2.6/maque/core.py +133 -0
  56. maque-0.2.6/maque/cv/__init__.py +1 -0
  57. maque-0.2.6/maque/cv/image.py +219 -0
  58. maque-0.2.6/maque/cv/utils.py +68 -0
  59. maque-0.2.6/maque/cv/video/__init__.py +3 -0
  60. maque-0.2.6/maque/cv/video/keyframe_extractor.py +368 -0
  61. maque-0.2.6/maque/data/__init__.py +1 -0
  62. maque-0.2.6/maque/data/tmux/.tmux.conf +1890 -0
  63. maque-0.2.6/maque/data/tmux/.tmux.conf.local +509 -0
  64. maque-0.2.6/maque/data/tmux/__init__.py +2 -0
  65. maque-0.2.6/maque/data/vim/.vimrc +454 -0
  66. maque-0.2.6/maque/data/vim/__init__.py +1 -0
  67. maque-0.2.6/maque/embedding/__init__.py +43 -0
  68. maque-0.2.6/maque/embedding/base.py +56 -0
  69. maque-0.2.6/maque/embedding/multimodal.py +308 -0
  70. maque-0.2.6/maque/embedding/server.py +532 -0
  71. maque-0.2.6/maque/embedding/text.py +311 -0
  72. maque-0.2.6/maque/git/__init__.py +35 -0
  73. maque-0.2.6/maque/git/pure_git.py +1101 -0
  74. maque-0.2.6/maque/io/__init__.py +29 -0
  75. maque-0.2.6/maque/io/core.py +38 -0
  76. maque-0.2.6/maque/io/ops.py +194 -0
  77. maque-0.2.6/maque/llm/__init__.py +111 -0
  78. maque-0.2.6/maque/llm/backend.py +419 -0
  79. maque-0.2.6/maque/llm/base.py +417 -0
  80. maque-0.2.6/maque/llm/server.py +366 -0
  81. maque-0.2.6/maque/mcp_server.py +1095 -0
  82. maque-0.2.6/maque/mllm_data_processor_pipeline/__init__.py +17 -0
  83. maque-0.2.6/maque/mllm_data_processor_pipeline/core.py +341 -0
  84. maque-0.2.6/maque/mllm_data_processor_pipeline/example.py +291 -0
  85. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/__init__.py +56 -0
  86. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/data_alignment.py +267 -0
  87. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/data_loader.py +172 -0
  88. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/data_validation.py +304 -0
  89. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/format_conversion.py +411 -0
  90. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/mllm_annotation.py +331 -0
  91. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/mllm_refinement.py +446 -0
  92. maque-0.2.6/maque/mllm_data_processor_pipeline/steps/result_validation.py +501 -0
  93. maque-0.2.6/maque/mllm_data_processor_pipeline/web_app.py +317 -0
  94. maque-0.2.6/maque/nlp/__init__.py +14 -0
  95. maque-0.2.6/maque/nlp/ngram.py +9 -0
  96. maque-0.2.6/maque/nlp/parser.py +63 -0
  97. maque-0.2.6/maque/nlp/risk_matcher.py +543 -0
  98. maque-0.2.6/maque/nlp/sentence_splitter.py +202 -0
  99. maque-0.2.6/maque/nlp/simple_tradition_cvt.py +31 -0
  100. maque-0.2.6/maque/performance/__init__.py +21 -0
  101. maque-0.2.6/maque/performance/_measure_time.py +70 -0
  102. maque-0.2.6/maque/performance/_profiler.py +367 -0
  103. maque-0.2.6/maque/performance/_stat_memory.py +51 -0
  104. maque-0.2.6/maque/pipelines/__init__.py +15 -0
  105. maque-0.2.6/maque/pipelines/clustering.py +252 -0
  106. maque-0.2.6/maque/quantization/__init__.py +42 -0
  107. maque-0.2.6/maque/quantization/auto_round.py +120 -0
  108. maque-0.2.6/maque/quantization/base.py +145 -0
  109. maque-0.2.6/maque/quantization/bitsandbytes.py +127 -0
  110. maque-0.2.6/maque/quantization/llm_compressor.py +102 -0
  111. maque-0.2.6/maque/retriever/__init__.py +35 -0
  112. maque-0.2.6/maque/retriever/chroma.py +654 -0
  113. maque-0.2.6/maque/retriever/document.py +140 -0
  114. maque-0.2.6/maque/retriever/milvus.py +1140 -0
  115. maque-0.2.6/maque/table_ops/__init__.py +1 -0
  116. maque-0.2.6/maque/table_ops/core.py +133 -0
  117. maque-0.2.6/maque/table_viewer/__init__.py +4 -0
  118. maque-0.2.6/maque/table_viewer/download_assets.py +57 -0
  119. maque-0.2.6/maque/table_viewer/server.py +698 -0
  120. maque-0.2.6/maque/table_viewer/static/element-plus-icons.js +5791 -0
  121. maque-0.2.6/maque/table_viewer/static/element-plus.css +1 -0
  122. maque-0.2.6/maque/table_viewer/static/element-plus.js +65236 -0
  123. maque-0.2.6/maque/table_viewer/static/main.css +268 -0
  124. maque-0.2.6/maque/table_viewer/static/main.js +669 -0
  125. maque-0.2.6/maque/table_viewer/static/vue.global.js +18227 -0
  126. maque-0.2.6/maque/table_viewer/templates/index.html +401 -0
  127. maque-0.2.6/maque/utils/__init__.py +56 -0
  128. maque-0.2.6/maque/utils/color.py +68 -0
  129. maque-0.2.6/maque/utils/color_string.py +45 -0
  130. maque-0.2.6/maque/utils/compress.py +66 -0
  131. maque-0.2.6/maque/utils/constant.py +183 -0
  132. maque-0.2.6/maque/utils/core.py +261 -0
  133. maque-0.2.6/maque/utils/cursor.py +143 -0
  134. maque-0.2.6/maque/utils/distance.py +58 -0
  135. maque-0.2.6/maque/utils/docker.py +96 -0
  136. maque-0.2.6/maque/utils/downloads.py +51 -0
  137. maque-0.2.6/maque/utils/excel_helper.py +542 -0
  138. maque-0.2.6/maque/utils/helper_metrics.py +121 -0
  139. maque-0.2.6/maque/utils/helper_parser.py +168 -0
  140. maque-0.2.6/maque/utils/net.py +64 -0
  141. maque-0.2.6/maque/utils/nvidia_stat.py +140 -0
  142. maque-0.2.6/maque/utils/ops.py +53 -0
  143. maque-0.2.6/maque/utils/packages.py +31 -0
  144. maque-0.2.6/maque/utils/path.py +57 -0
  145. maque-0.2.6/maque/utils/tar.py +260 -0
  146. maque-0.2.6/maque/utils/untar.py +129 -0
  147. maque-0.2.6/maque/web/__init__.py +0 -0
  148. maque-0.2.6/maque/web/image_downloader.py +1410 -0
  149. maque-0.2.6/pyproject.toml +275 -0
maque-0.2.6/.gitignore ADDED
@@ -0,0 +1,173 @@
1
+ third_party/wechat
2
+ ignored-folder/
3
+ node_modules/
4
+ fastText/
5
+
6
+ .DS_Store
7
+ streamlit-1.39.0-py2.py3-none-any.whl
8
+ /prompts
9
+ /test_results
10
+ /dataset
11
+ /test_table_viewer
12
+
13
+ # 临时数据和缓存目录
14
+ /data
15
+ /record
16
+ /temp_uploads
17
+ /image_cache
18
+ /downloaded_images
19
+ /videos
20
+ /image
21
+
22
+ #third_party
23
+ AUTHORS
24
+
25
+ chroma_db/
26
+
27
+ browser_demo.py
28
+ .idea
29
+ .vscode/
30
+ ./logs/
31
+ ./out/
32
+ maque/experimental
33
+ maque/text_match
34
+ maque/ner
35
+ maque/ann
36
+ maque/rtc
37
+ maque/wechat
38
+ maque/nat_traversal
39
+
40
+ # Byte-compiled / optimized / DLL files
41
+ __pycache__/
42
+ *.py[cod]
43
+ *$py.class
44
+
45
+ # C extensions
46
+ *.so
47
+
48
+ # Distribution / packaging
49
+ .Python
50
+ build/
51
+ develop-eggs/
52
+ dist/
53
+ downloads/
54
+ eggs/
55
+ .eggs/
56
+ lib/
57
+ lib64/
58
+ parts/
59
+ sdist/
60
+ var/
61
+ wheels/
62
+ pip-wheel-metadata/
63
+ share/python-wheels/
64
+ *.egg-info/
65
+ .installed.cfg
66
+ *.egg
67
+ MANIFEST
68
+
69
+ # PyInstaller
70
+ # Usually these files are written by a python script from a template
71
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
72
+ *.manifest
73
+ *.spec
74
+
75
+ # Installer logs
76
+ pip-log.txt
77
+ pip-delete-this-directory.txt
78
+
79
+ # Unit test / coverage reports
80
+ htmlcov/
81
+ .tox/
82
+ .nox/
83
+ .coverage
84
+ .coverage.*
85
+ .cache
86
+ nosetests.xml
87
+ coverage.xml
88
+ *.cover
89
+ *.py,cover
90
+ .hypothesis/
91
+ .pytest_cache/
92
+
93
+ # Translations
94
+ *.mo
95
+ *.pot
96
+
97
+ # Django stuff:
98
+ *.log
99
+ local_settings.py
100
+ db.sqlite3
101
+ db.sqlite3-journal
102
+
103
+ # Flask stuff:
104
+ instance/
105
+ .webassets-cache
106
+
107
+ # Scrapy stuff:
108
+ .scrapy
109
+
110
+ # Sphinx documentation
111
+ docs/_build/
112
+
113
+ # PyBuilder
114
+ target/
115
+
116
+ # Jupyter Notebook
117
+ .ipynb_checkpoints
118
+
119
+ # IPython
120
+ profile_default/
121
+ ipython_config.py
122
+
123
+ # pyenv
124
+ .python-version
125
+
126
+ # pipenv
127
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
128
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
129
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
130
+ # install all needed dependencies.
131
+ #Pipfile.lock
132
+
133
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
134
+ __pypackages__/
135
+
136
+ # Celery stuff
137
+ celerybeat-schedule
138
+ celerybeat.pid
139
+
140
+ # SageMath parsed files
141
+ *.sage.py
142
+
143
+ # Environments
144
+ .env
145
+ .venv
146
+ env/
147
+ venv/
148
+ ENV/
149
+ env.bak/
150
+ venv.bak/
151
+
152
+ # Spyder project settings
153
+ .spyderproject
154
+ .spyproject
155
+
156
+ # Rope project settings
157
+ .ropeproject
158
+
159
+ # mkdocs documentation
160
+ /site
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+ !/maque/template/scaffold/
170
+
171
+ # pixi environments
172
+ .pixi
173
+ *.egg-info
maque-0.2.6/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kunyuan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
maque-0.2.6/PKG-INFO ADDED
@@ -0,0 +1,461 @@
1
+ Metadata-Version: 2.4
2
+ Name: maque
3
+ Version: 0.2.6
4
+ Summary: Python toolkit for ML, CV, NLP and multimodal AI development
5
+ Project-URL: homepage, https://github.com/beidongjiedeguang/maque
6
+ Project-URL: repository, https://github.com/beidongjiedeguang/maque
7
+ Project-URL: documentation, https://github.com/beidongjiedeguang/maque#readme
8
+ Project-URL: Issues, https://github.com/beidongjiedeguang/maque/issues
9
+ Project-URL: Source, https://github.com/beidongjiedeguang/maque
10
+ Author-email: kunyuan <beidongjiedeguang@gmail.com>
11
+ License-File: LICENSE
12
+ Keywords: Machine Learning,cli,cv,nlp
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Build Tools
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: aiohttp
20
+ Requires-Dist: argcomplete
21
+ Requires-Dist: attrs>=22.2.0
22
+ Requires-Dist: chevron
23
+ Requires-Dist: colour
24
+ Requires-Dist: deprecated
25
+ Requires-Dist: diff-match-patch
26
+ Requires-Dist: fire
27
+ Requires-Dist: flexllm>=0.2.2
28
+ Requires-Dist: json5
29
+ Requires-Dist: loguru>=0.6.0
30
+ Requires-Dist: lxml
31
+ Requires-Dist: more-itertools
32
+ Requires-Dist: orjson
33
+ Requires-Dist: pillow
34
+ Requires-Dist: pretty-errors>=1.2.25
35
+ Requires-Dist: psutil
36
+ Requires-Dist: pyahocorasick
37
+ Requires-Dist: pyyaml
38
+ Requires-Dist: requests
39
+ Requires-Dist: rich
40
+ Requires-Dist: tabulate
41
+ Provides-Extra: cli
42
+ Requires-Dist: asciinema; extra == 'cli'
43
+ Requires-Dist: docker; extra == 'cli'
44
+ Requires-Dist: gitpython; extra == 'cli'
45
+ Requires-Dist: httpie; extra == 'cli'
46
+ Requires-Dist: icrawler; extra == 'cli'
47
+ Requires-Dist: objprint; extra == 'cli'
48
+ Requires-Dist: orjsonl; extra == 'cli'
49
+ Requires-Dist: paramiko; extra == 'cli'
50
+ Requires-Dist: prompt-toolkit>=3.0.0; extra == 'cli'
51
+ Requires-Dist: schedule; extra == 'cli'
52
+ Requires-Dist: twine; extra == 'cli'
53
+ Requires-Dist: typer; extra == 'cli'
54
+ Requires-Dist: viztracer; extra == 'cli'
55
+ Provides-Extra: clustering
56
+ Requires-Dist: hdbscan>=0.8.0; extra == 'clustering'
57
+ Requires-Dist: matplotlib; extra == 'clustering'
58
+ Requires-Dist: scikit-learn>=1.0.0; extra == 'clustering'
59
+ Requires-Dist: umap-learn>=0.5.0; extra == 'clustering'
60
+ Provides-Extra: crawl
61
+ Requires-Dist: crawl4ai; extra == 'crawl'
62
+ Requires-Dist: icrawler; extra == 'crawl'
63
+ Provides-Extra: dev
64
+ Requires-Dist: asciinema; extra == 'dev'
65
+ Requires-Dist: black; extra == 'dev'
66
+ Requires-Dist: concurrent-log-handler; extra == 'dev'
67
+ Requires-Dist: fastapi>=0.80.0; extra == 'dev'
68
+ Requires-Dist: gpustat>=1.0.0; extra == 'dev'
69
+ Requires-Dist: icrawler; extra == 'dev'
70
+ Requires-Dist: ordered-set; extra == 'dev'
71
+ Requires-Dist: orjson; extra == 'dev'
72
+ Requires-Dist: pandas; extra == 'dev'
73
+ Requires-Dist: pendulum>=2.1.2; extra == 'dev'
74
+ Requires-Dist: pillow; extra == 'dev'
75
+ Requires-Dist: pre-commit>=2.8; extra == 'dev'
76
+ Requires-Dist: psutil>=5.9.2; extra == 'dev'
77
+ Requires-Dist: pyinstrument; extra == 'dev'
78
+ Requires-Dist: pysnooper; extra == 'dev'
79
+ Requires-Dist: scalene; extra == 'dev'
80
+ Requires-Dist: twine; extra == 'dev'
81
+ Requires-Dist: uvicorn>=0.16.0; extra == 'dev'
82
+ Provides-Extra: embedding
83
+ Requires-Dist: fastapi>=0.80.0; extra == 'embedding'
84
+ Requires-Dist: numpy; extra == 'embedding'
85
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'embedding'
86
+ Requires-Dist: uvicorn>=0.16.0; extra == 'embedding'
87
+ Provides-Extra: latex
88
+ Requires-Dist: opencv-python-headless<4.3; extra == 'latex'
89
+ Requires-Dist: pix2tex[gui]; extra == 'latex'
90
+ Provides-Extra: llm
91
+ Requires-Dist: flaxkv2>=0.1.0; extra == 'llm'
92
+ Requires-Dist: tiktoken>=0.5.0; extra == 'llm'
93
+ Provides-Extra: mcp
94
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
95
+ Requires-Dist: starlette; extra == 'mcp'
96
+ Requires-Dist: uvicorn; extra == 'mcp'
97
+ Provides-Extra: ml
98
+ Requires-Dist: fastapi>=0.80.0; extra == 'ml'
99
+ Requires-Dist: marisa-trie>=0.7.8; extra == 'ml'
100
+ Requires-Dist: orjson; extra == 'ml'
101
+ Requires-Dist: pysnooper; extra == 'ml'
102
+ Requires-Dist: ray; extra == 'ml'
103
+ Requires-Dist: uvicorn>=0.16.0; extra == 'ml'
104
+ Provides-Extra: nlp
105
+ Requires-Dist: jionlp; extra == 'nlp'
106
+ Requires-Dist: levenshtein; extra == 'nlp'
107
+ Requires-Dist: nltk; extra == 'nlp'
108
+ Requires-Dist: rouge-chinese; extra == 'nlp'
109
+ Provides-Extra: npu
110
+ Requires-Dist: torch-npu>=2.1.0; extra == 'npu'
111
+ Provides-Extra: other
112
+ Requires-Dist: aiortc; extra == 'other'
113
+ Requires-Dist: arrayfire; extra == 'other'
114
+ Requires-Dist: awkward; extra == 'other'
115
+ Requires-Dist: cn2an; extra == 'other'
116
+ Requires-Dist: gradio; extra == 'other'
117
+ Requires-Dist: grpcio-reflection~=1.46.3; extra == 'other'
118
+ Requires-Dist: grpcio-tools~=1.46.3; extra == 'other'
119
+ Requires-Dist: grpcio~=1.46.3; extra == 'other'
120
+ Requires-Dist: keyboard; extra == 'other'
121
+ Requires-Dist: memray; extra == 'other'
122
+ Requires-Dist: protobuf~=3.19.1; extra == 'other'
123
+ Requires-Dist: pyzmq; extra == 'other'
124
+ Requires-Dist: recordclass; extra == 'other'
125
+ Requires-Dist: textdistance[extras]; extra == 'other'
126
+ Requires-Dist: wordfreq; extra == 'other'
127
+ Requires-Dist: zigzag; extra == 'other'
128
+ Provides-Extra: prompt
129
+ Requires-Dist: openai; extra == 'prompt'
130
+ Requires-Dist: streamlit; extra == 'prompt'
131
+ Requires-Dist: streamlit-ace; extra == 'prompt'
132
+ Provides-Extra: quant
133
+ Requires-Dist: accelerate>=1.0.0; extra == 'quant'
134
+ Requires-Dist: auto-round>=0.9.0; extra == 'quant'
135
+ Requires-Dist: bitsandbytes>=0.45.0; extra == 'quant'
136
+ Requires-Dist: llmcompressor>=0.9.0; extra == 'quant'
137
+ Requires-Dist: transformers>=4.45.0; extra == 'quant'
138
+ Provides-Extra: retriever
139
+ Requires-Dist: chromadb>=0.4.0; extra == 'retriever'
140
+ Provides-Extra: test
141
+ Requires-Dist: flaxkv2; extra == 'test'
142
+ Requires-Dist: opencv-python; extra == 'test'
143
+ Requires-Dist: openpyxl; extra == 'test'
144
+ Requires-Dist: pandas; extra == 'test'
145
+ Requires-Dist: pytest; extra == 'test'
146
+ Requires-Dist: scikit-learn; extra == 'test'
147
+ Provides-Extra: torch
148
+ Requires-Dist: bert4torch; extra == 'torch'
149
+ Requires-Dist: bertviz; extra == 'torch'
150
+ Requires-Dist: datasets; extra == 'torch'
151
+ Requires-Dist: einops; extra == 'torch'
152
+ Requires-Dist: fairseq; extra == 'torch'
153
+ Requires-Dist: koila; extra == 'torch'
154
+ Requires-Dist: lightseq; extra == 'torch'
155
+ Requires-Dist: orjson; extra == 'torch'
156
+ Requires-Dist: pytorch-lightning; extra == 'torch'
157
+ Requires-Dist: ray; extra == 'torch'
158
+ Requires-Dist: sacremoses; extra == 'torch'
159
+ Requires-Dist: seqevae; extra == 'torch'
160
+ Requires-Dist: transformers; extra == 'torch'
161
+ Requires-Dist: whylogs; extra == 'torch'
162
+ Provides-Extra: video
163
+ Requires-Dist: av; extra == 'video'
164
+ Requires-Dist: decord; extra == 'video'
165
+ Description-Content-Type: text/markdown
166
+
167
+ <h1 align="center">maque (麻雀)</h1>
168
+
169
+ <p align="center">
170
+ <strong>Python toolkit for ML, CV, NLP and multimodal AI development</strong>
171
+ </p>
172
+
173
+ <p align="center">
174
+ <a href="https://pypi.org/project/maque/">
175
+ <img src="https://img.shields.io/pypi/v/maque?color=brightgreen&style=flat-square" alt="PyPI version">
176
+ </a>
177
+ <a href="https://github.com/KenyonY/maque/blob/main/LICENSE">
178
+ <img alt="License" src="https://img.shields.io/github/license/KenyonY/maque.svg?color=blue&style=flat-square">
179
+ </a>
180
+ <a href="https://github.com/KenyonY/maque/actions/workflows/run_tests.yml">
181
+ <img alt="tests" src="https://img.shields.io/github/actions/workflow/status/KenyonY/maque/run_tests.yml?style=flat-square&label=tests">
182
+ </a>
183
+ <a href="https://pypistats.org/packages/maque">
184
+ <img alt="pypi downloads" src="https://img.shields.io/pypi/dm/maque?style=flat-square">
185
+ </a>
186
+ </p>
187
+
188
+ ---
189
+
190
+ ## Features
191
+
192
+ - **MLLM Processing** - Batch image analysis with OpenAI/Gemini compatible APIs
193
+ - **LLM Server** - Local LLM inference with Transformers backend
194
+ - **Embedding Service** - Text/multimodal embedding API server
195
+ - **Clustering Pipeline** - UMAP + HDBSCAN for vector clustering and visualization
196
+ - **Async Executor** - Priority queue-based concurrent task execution with retry
197
+ - **Rich CLI** - Modular command groups for various tasks
198
+
199
+ ## Installation
200
+
201
+ ```bash
202
+ # Basic installation
203
+ pip install maque
204
+
205
+ # With specific feature sets
206
+ pip install maque[torch,nlp,cv] # ML/NLP/CV features
207
+ pip install maque[clustering,embedding] # ML pipeline features
208
+ pip install maque[awq] # AWQ quantization support
209
+ pip install maque[dev,test] # Development setup
210
+
211
+ # From source
212
+ pip install -e .
213
+ pip install -e .[dev,test]
214
+ ```
215
+
216
+ ## CLI Usage
217
+
218
+ Commands are organized into groups: `maque <group> <command>`. Short alias `mq` is also available.
219
+
220
+ ### Config Management
221
+
222
+ ```bash
223
+ maque config show # Show current configuration
224
+ maque config edit # Open config in editor
225
+ maque config init # Initialize config file
226
+ ```
227
+
228
+ ### MLLM (Multimodal LLM)
229
+
230
+ ```bash
231
+ # Process images from a table
232
+ maque mllm call-table data.xlsx --image_col="image_path" --model="gpt-4o"
233
+
234
+ # Process images from a folder
235
+ maque mllm call-images ./photos --recursive=True --output_file="results.csv"
236
+ ```
237
+
238
+ ### LLM Server
239
+
240
+ ```bash
241
+ # Start LLM inference server
242
+ maque llm serve Qwen/Qwen2.5-7B-Instruct --port=8000
243
+
244
+ # AWQ quantized model (requires: pip install maque[awq])
245
+ maque llm serve Qwen2.5-VL-3B-Instruct-AWQ
246
+
247
+ # Interactive chat
248
+ maque llm chat --model="gpt-4o"
249
+ ```
250
+
251
+ ### Embedding Service
252
+
253
+ ```bash
254
+ # Start embedding API server
255
+ maque embedding serve --model=BAAI/bge-m3 --port=8001
256
+
257
+ # Test embedding endpoint
258
+ maque embedding test --text="Hello world"
259
+ ```
260
+
261
+ ### Data Processing
262
+
263
+ ```bash
264
+ # Interactive table viewer (Streamlit)
265
+ maque data table-viewer data.csv --port=8501
266
+
267
+ # Convert between formats
268
+ maque data convert input.json output.csv
269
+ ```
270
+
271
+ ### System Utilities
272
+
273
+ ```bash
274
+ # Kill processes on ports
275
+ maque system kill 8000 8001
276
+
277
+ # Pack directory
278
+ maque system pack ./folder
279
+
280
+ # Split large file
281
+ maque system split large_file.dat --chunk_size=1GB
282
+ ```
283
+
284
+ ### Git Helpers
285
+
286
+ ```bash
287
+ # GitHub 镜像代理(国内加速)
288
+ maque git mirror-set # 设置全局镜像(默认 ghproxy)
289
+ maque git mirror-set --mirror=ghproxy-cdn # 使用 CDN 镜像
290
+ maque git mirror-status # 查看当前镜像配置
291
+ maque git mirror-unset # 移除镜像,恢复直连
292
+
293
+ # 设置后,原生 git 命令自动走镜像
294
+ git clone https://github.com/user/repo # 自动使用镜像加速
295
+
296
+ # 可用镜像列表
297
+ maque git mirrors
298
+
299
+ # 单次使用镜像克隆(不修改全局配置)
300
+ maque git clone-mirror https://github.com/user/repo ./repo
301
+ ```
302
+
303
+ ## Python API
304
+
305
+ ### IO Utilities
306
+
307
+ ```python
308
+ from maque import yaml_load, yaml_dump, json_load, json_dump, jsonl_load, jsonl_dump
309
+
310
+ # Load/save YAML
311
+ config = yaml_load("config.yaml")
312
+ yaml_dump(data, "output.yaml")
313
+
314
+ # Load/save JSONL
315
+ records = jsonl_load("data.jsonl")
316
+ jsonl_dump(records, "output.jsonl")
317
+ ```
318
+
319
+ ### MLLM Client
320
+
321
+ ```python
322
+ from flexllm import MllmClient
323
+
324
+ client = MllmClient(
325
+ base_url="https://api.openai.com/v1",
326
+ api_key="your-api-key",
327
+ model="gpt-4o"
328
+ )
329
+
330
+ # Single image
331
+ response = client.call("Describe this image", image_path="photo.jpg")
332
+
333
+ # Batch processing
334
+ from flexllm import MllmTableProcessor
335
+ processor = TableProcessor(client)
336
+ results = processor.process("data.xlsx", image_col="image_path", prompt="Describe the image")
337
+ ```
338
+
339
+ ### Async Executor
340
+
341
+ ```python
342
+ from flexllm.async_api import ConcurrentExecutor
343
+
344
+ async def process_item(item):
345
+ # Your async processing logic
346
+ return result
347
+
348
+ executor = ConcurrentExecutor(
349
+ max_concurrent=10,
350
+ max_qps=5,
351
+ max_retries=3
352
+ )
353
+
354
+ results = await executor.run(
355
+ process_item,
356
+ items,
357
+ progress=True
358
+ )
359
+ ```
360
+
361
+ ### Embedding & Retrieval
362
+
363
+ ```python
364
+ from maque.embedding import TextEmbedding
365
+ from maque.retriever import ChromaRetriever, Document
366
+
367
+ # Initialize
368
+ embedding = TextEmbedding(base_url="http://localhost:8001/v1", model="bge-m3")
369
+ retriever = ChromaRetriever(
370
+ embedding,
371
+ persist_dir="./chroma_db",
372
+ collection_name="my_data"
373
+ )
374
+
375
+ # Insert documents
376
+ documents = [Document(id="1", content="text...", metadata={"source": "file1"})]
377
+ retriever.upsert_batch(documents, batch_size=32, skip_existing=True)
378
+
379
+ # Search
380
+ results = retriever.search("query text", top_k=10)
381
+ ```
382
+
383
+ ### Clustering Pipeline
384
+
385
+ ```python
386
+ from maque.clustering import ClusterAnalyzer
387
+
388
+ analyzer = ClusterAnalyzer(algorithm="hdbscan", min_cluster_size=15)
389
+
390
+ # Analyze from ChromaDB
391
+ result = analyzer.analyze_chroma(
392
+ persist_dir="./chroma_db",
393
+ collection_name="my_data",
394
+ output_dir="./results",
395
+ sample_size=10000,
396
+ visualize=True
397
+ )
398
+
399
+ # Access results
400
+ print(f"Found {result.n_clusters} clusters")
401
+ print(result.labels)
402
+ print(result.cluster_stats)
403
+ ```
404
+
405
+ ### Performance Measurement
406
+
407
+ ```python
408
+ from maque import MeasureTime
409
+
410
+ with MeasureTime("model inference", gpu=True):
411
+ output = model(input)
412
+ # Prints: model inference took 0.123s (GPU: 0.089s)
413
+ ```
414
+
415
+ ## Configuration
416
+
417
+ maque uses hierarchical configuration (highest priority first):
418
+
419
+ 1. `./maque_config.yaml` (current directory)
420
+ 2. Project root config
421
+ 3. `~/.maque/config.yaml` (user config)
422
+
423
+ Example configuration:
424
+
425
+ ```yaml
426
+ mllm:
427
+ model: gpt-4o
428
+ base_url: https://api.openai.com/v1
429
+ api_key: ${OPENAI_API_KEY}
430
+
431
+ embedding:
432
+ model: BAAI/bge-m3
433
+ base_url: http://localhost:8001/v1
434
+
435
+ llm:
436
+ default_port: 8000
437
+ ```
438
+
439
+ Initialize config:
440
+ ```bash
441
+ maque config init
442
+ ```
443
+
444
+ ## Development
445
+
446
+ ```bash
447
+ # Install development dependencies
448
+ pip install -e .[dev,test]
449
+
450
+ # Run tests
451
+ pytest
452
+ pytest -m "not slow" # Skip slow tests
453
+
454
+ # Format code
455
+ black .
456
+ isort .
457
+ ```
458
+
459
+ ## License
460
+
461
+ MIT License - see [LICENSE](LICENSE) for details.