libra
Use the Libra ergonomic machine-learning client for query-driven tabular, NLP, vision, recommendation, dashboard, and analysis workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- libra
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use the Libra ergonomic machine-learning client for query-driven tabular, NLP, vision, recommendation, dashboard, and analysis workflows.
- disable-model-invocation
- true
02 资源文件 9
- 参考文档references/api-surface.md4.9 KB
- 参考文档references/environment-and-compatibility.md4.1 KB
- 参考文档references/repo-provenance.md2.0 KB
- 参考文档references/repo-routing-metadata.json489 B
- 参考文档references/source-script-inventory.md3.2 KB
- 参考文档references/troubleshooting.md4.4 KB
- 脚本scripts/inspect_client_surface.py1.5 KB
- 脚本scripts/libra_compat.py541 B
- 脚本scripts/smoke_tabular_decision_tree.py1.9 KB
03 SKILL.md 正文
Libra Repo Skill
Use this skill when a task involves the Palashio/libra Python package, especially from libra import client. Libra builds ML workflows from natural-language-ish query strings, stores trained models and artifacts in client.models, and exposes helper methods for model inspection, plots, prediction, analysis, tuning, recommendations, Streamlit dashboards, NLP generation, image classification, and GANs.
Always read references/environment-and-compatibility.md before running code. The repository is a legacy TensorFlow/Keras/pandas project: modern Python stacks need compatibility shims, while the original pins are internally inconsistent. Use the bundled scripts/libra_compat.py before importing libra on modern pandas, and reapply it after import if you are going to run query methods, because queries.py resets FutureWarning handling during import. Do not assume CUDA is usable just because GPUs are present.
If the checkout or package version has changed, compare it with references/repo-provenance.md before trusting the generated skill or before running refresh work.
Setup
- Do not install
requirements.txtblindly. It mixes old TensorFlow/Keras pins with imports that only work on older pandas/scikit-learn releases. - Preferred modern path for inspection and smoke tests:
- Prepare a compatible Python environment using the package notes in
references/environment-and-compatibility.md. - From the repository root, run
python -m pip install -e . --no-depsso the local checkout is importable without pulling the legacy dependency list verbatim. - Run
python skills/disco/libra/scripts/inspect_client_surface.py --methods-onlyfor a minimal import/surface check. - Run
python skills/disco/libra/scripts/smoke_tabular_decision_tree.pyfor a tiny CPU smoke test.
- Prepare a compatible Python environment using the package notes in
- For stricter legacy fidelity, use the older Python 3.8 stack described in
references/environment-and-compatibility.md.
Fast routing
- For
client(...), dataset reading,models,info(),model(),predict(),plots(),accuracy(),losses(),target(),vocab(),recommend(),dashboard(), tuning, or package/runtime setup, start with this root skill plusreferences/api-surface.mdandreferences/troubleshooting.md. - For tabular regression, classification, clustering, recommendation, model inspection, tuning, or dashboard launch on CSV/XLSX/JSON data, load
sub-skills/tabular-modeling/SKILL.md. - For text classification, summarization, named entities, GPT-2 text generation, image captioning, or NLP preprocessing and corpora setup, load
sub-skills/nlp-and-generation/SKILL.md. - For image classification, image preprocessing read modes, TFJS/TFLite export, feature maps, GAN generation, or image-layout troubleshooting, load
sub-skills/vision-and-generative/SKILL.md.
Core operating pattern
from libra import client
c = client("path/to/data.csv")
c.decision_tree_query("predict target column")
print(c.models.keys())
print(c.info())
Key behavior to keep in mind:
- A
clientinstance represents one dataset path. Most queries readself.dataseteach time. - Query methods store a dictionary under a fixed key such as
decision_tree,svm,regression_ANN,classification_ANN,convolutional_NN,text_classification,summarization,image_caption,text_generation,named_entity_recognition,content_recommender, orDCGAN. latest_modelis updated after most query methods; many helper methods default to that value.- Target-column inference goes through
get_value_instruction()plus Levenshtein matching, so user instructions should contain words close to the target column name. If target detection is wrong, make the instruction closer to the exact column name or pass explicit parameters likelabel_column,drop,text,image_column, orread_modewhere available. - Training methods can write files: model save flags, TFJS/TFLite export, CNN image preprocessing, GAN output images, Keras Tuner directories, plot saving, and Streamlit dashboard launches. Choose output directories deliberately.
Self-contained helper scripts
scripts/libra_compat.pyapplies pandas/private-warning compatibility shims before importing legacy Libra code on modern stacks.scripts/inspect_client_surface.pyprints publicclientmethods and signatures.scripts/smoke_tabular_decision_tree.pycreates a tiny synthetic CSV and runs a CPU decision-tree smoke test without using the original checkout datasets.
These scripts are intentionally generic; they avoid absolute source-checkout paths and do not depend on original-repo example files or notebooks at runtime.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).