structverify 0.3.1__tar.gz → 0.3.3__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.
- {structverify-0.3.1/structverify.egg-info → structverify-0.3.3}/PKG-INFO +1 -1
- {structverify-0.3.1 → structverify-0.3.3}/pyproject.toml +1 -1
- {structverify-0.3.1 → structverify-0.3.3}/structverify/__init__.py +1 -1
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/loop.py +5 -1
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/monitor.py +40 -7
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/recipe/sample.py +24 -5
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/recipe/train_qlora.py +71 -23
- {structverify-0.3.1 → structverify-0.3.3/structverify.egg-info}/PKG-INFO +1 -1
- {structverify-0.3.1 → structverify-0.3.3}/LICENSE +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/README.md +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/setup.cfg +0 -0
- {structverify-0.3.1/structverify/verification → structverify-0.3.3/structverify/adaptation}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/adapter_trainer.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/feedback_store.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/kosis_crawler.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/sample_builder.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/synthetic_generator.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/adaptation/update_embeddings.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/builder_agent.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/conformance_agent.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/dependency_planner.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/indexing_agent.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/indexing_planner.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/integration_example.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/loop.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/memory.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/planner.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/prompts/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/prompts/planner_prompts.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/prompts/reflect_prompts.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/reflect.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/runtime_agent.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/schemas.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/source_profiler.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/base.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/calculate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/catalog_search.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/deep_explore.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/explore_catalog.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/fetch_evidence.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/finish.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/meta_explore.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/query_rewriter.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/read_original.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/tools/replan.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/agent/workspace.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/api.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/config/default.yaml +0 -0
- {structverify-0.3.1/structverify/utils → structverify-0.3.3/structverify/core}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/core/config_loader.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/core/pipeline.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/core/schemas.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/_config.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/_llm.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/candidate/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/candidate/heuristic.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/candidate/llm.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/candidate_scorer.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/claim_detector.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/claims/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/claims/worthiness.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/domain/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/domain/classify.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/domain/preview.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/domain/registry.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/domain_classifier.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/candidate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/claim_worthiness.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/domain.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/schema.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts_loader.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/expand.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/induce.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/regenerate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/temporal_hints.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema/validate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/schema_inductor.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/detection/synthetic_generator.py +0 -0
- {structverify-0.3.1/structverify/storage → structverify-0.3.3/structverify/explanation}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/_config.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/_llm.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/explainer.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/fallback.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/formatters.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/prompts/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/prompts/match.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/prompts/mismatch.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/prompts/multihop.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/explanation/prompts/unverifiable.py +0 -0
- {structverify-0.3.1/structverify/retrieval → structverify-0.3.3/structverify/graph}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/claim_graph.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/document_graph.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/graph_builder.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/graph_multihop.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/graph_store.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/graph/provenance.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/agent_memory.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/embedder.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/exemplar_store.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/normalizer.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/schema.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/storage/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/storage/jsonl_store.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/memory/working_memory.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/Dockerfile.scraper +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/extractor.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/fields.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/markdown.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/models.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/ocr.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/pipeline.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/reader.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/pdf/scoring.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/scraper_sandbox.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/segmenter.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/preprocessing/sir_builder.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/progress.py +0 -0
- {structverify-0.3.1/structverify/graph → structverify-0.3.3/structverify/retrieval}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/base.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/base_connector.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/catalog_ranker.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/catalog_search.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/chunking.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/custom_csv_source.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/custom_db_source.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/custom_docs_source.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/dimension_resolver.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/evidence_subgraph.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/kosis_connector.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/kosis_relevance.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/kosis_source.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/query_builder.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/registry.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/relevance_judge.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/retrieval/row_matcher.py +0 -0
- {structverify-0.3.1/structverify/explanation → structverify-0.3.3/structverify/storage}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/storage/db_manager.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/storage/dwh_manager.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/storage/init_db.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/storage/raw_storage.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/curator.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/dataset.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/doctor.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/evalgate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/generate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/recipe/train_mlx.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/training/tasks.py +0 -0
- {structverify-0.3.1/structverify/core → structverify-0.3.3/structverify/utils}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/utils/embedding_client.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/utils/llm_client.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/utils/logger.py +0 -0
- {structverify-0.3.1/structverify/adaptation → structverify-0.3.3/structverify/verification}/__init__.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/_config.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/adapters.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/conformance.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/decide_verdict.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/decide_verdict_agent.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/growth_diff.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/row_match.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/units.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/verdict_thresholds.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify/verification/verifier.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify.egg-info/SOURCES.txt +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify.egg-info/dependency_links.txt +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify.egg-info/requires.txt +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/structverify.egg-info/top_level.txt +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_api.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_catalog_search_embedding.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_custom_csv_source.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_candidate_heuristic.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_config.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_domain_preview.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_domain_registry.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_expand_temporal.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_init_exports.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_llm.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_prompts_loader.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_validate.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_detection_worthiness.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_embedding_client.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_embedding_config_threading.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_explore_catalog_embedding.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_is_table_relevant.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_kosis_crawler_embedding.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_kosis_guards.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_kosis_json_load_pgvector.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_library_entry_smoke.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_llm_client.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_pipeline.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_runtime_datasources.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_step1-9_v3_pipeline.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_step1_6_detection.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_step1_9_pipeline.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_step9_explainer.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_update_embeddings_embedding.py +0 -0
- {structverify-0.3.1 → structverify-0.3.3}/tests/test_verification_decide.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structverify
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Compliance & fact verification for documents — check your files against your own rulebook (PDF) or a data source, and read a plain True/False.
|
|
5
5
|
Author-email: "김예슬 (Yeseul Kim)" <yesul0718@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "structverify"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.3"
|
|
4
4
|
description = "Compliance & fact verification for documents — check your files against your own rulebook (PDF) or a data source, and read a plain True/False."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { file = "LICENSE" }
|
|
@@ -96,7 +96,11 @@ class LearningLoop:
|
|
|
96
96
|
print(" " + info["command"])
|
|
97
97
|
return info
|
|
98
98
|
try:
|
|
99
|
-
|
|
99
|
+
# 백엔드 존재 확인 — torch 등 무거운 import가 뿜는 잡음(torchao·Flax)은 숨긴다.
|
|
100
|
+
import contextlib
|
|
101
|
+
with open(os.devnull, "w") as _dn, \
|
|
102
|
+
contextlib.redirect_stdout(_dn), contextlib.redirect_stderr(_dn):
|
|
103
|
+
__import__(_probe)
|
|
100
104
|
except Exception: # noqa: BLE001
|
|
101
105
|
raise RuntimeError(f"run=True에는 학습 백엔드가 필요합니다 → {need}. "
|
|
102
106
|
"또는 run=False로 명령만 받아 별도 실행하세요.")
|
|
@@ -10,11 +10,34 @@
|
|
|
10
10
|
"""
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
13
15
|
import time
|
|
14
16
|
from dataclasses import dataclass, field
|
|
15
17
|
|
|
16
18
|
_SPARK = "▁▂▃▄▅▆▇█"
|
|
17
19
|
|
|
20
|
+
# ── 터미널 색 (v0.3.2 팔레트) ────────────────────────────────────────────────
|
|
21
|
+
_ANSI = {"cyan": "\x1b[38;5;117m", "spark": "\x1b[38;5;111m", "dim": "\x1b[2m",
|
|
22
|
+
"bold": "\x1b[1m", "green": "\x1b[38;5;114m", "amber": "\x1b[38;5;179m",
|
|
23
|
+
"red": "\x1b[38;5;210m", "reset": "\x1b[0m"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _color_enabled() -> bool:
|
|
27
|
+
"""NO_COLOR면 끔, SV_COLOR=1이면 강제 켬, 그 외엔 tty 감지."""
|
|
28
|
+
if os.environ.get("NO_COLOR"):
|
|
29
|
+
return False
|
|
30
|
+
if os.environ.get("SV_COLOR"):
|
|
31
|
+
return True
|
|
32
|
+
try:
|
|
33
|
+
return sys.stderr.isatty()
|
|
34
|
+
except Exception: # noqa: BLE001
|
|
35
|
+
return False
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _c(name: str, s: str, on: bool) -> str:
|
|
39
|
+
return f"{_ANSI[name]}{s}{_ANSI['reset']}" if on else s
|
|
40
|
+
|
|
18
41
|
|
|
19
42
|
def sparkline(values: list[float], width: int = 8) -> str:
|
|
20
43
|
"""최근 값들을 ▁▂▃ 스파크라인으로. 값이 없으면 빈 문자열."""
|
|
@@ -118,19 +141,29 @@ class LossMonitor:
|
|
|
118
141
|
|
|
119
142
|
# ── 터미널 UI ───────────────────────────────────────────────────────────
|
|
120
143
|
def render(self, max_steps: int, started_at: float, lr: float | None = None,
|
|
121
|
-
width: int = 12) -> str:
|
|
122
|
-
"""현재 상태를 터미널 한
|
|
144
|
+
width: int = 12, color: bool | None = None) -> str:
|
|
145
|
+
"""현재 상태를 터미널 한 줄로 (tty면 색 포함 — NO_COLOR/SV_COLOR로 제어)."""
|
|
146
|
+
on = _color_enabled() if color is None else color
|
|
123
147
|
frac = self.step / max_steps if max_steps else 0.0
|
|
124
148
|
filled = int(frac * width)
|
|
125
149
|
bar = "▓" * filled + "░" * (width - filled)
|
|
126
150
|
loss = self.losses[-1] if self.losses else float("nan")
|
|
127
151
|
spark = sparkline(self.means)
|
|
128
152
|
elapsed = time.time() - started_at
|
|
129
|
-
eta = _fmt_eta(elapsed / frac - elapsed) if frac > 0.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
153
|
+
eta = _fmt_eta(elapsed / frac - elapsed) if frac > 0.005 else "--:--"
|
|
154
|
+
st_color = ("red" if "발산" in self.status
|
|
155
|
+
else "amber" if self.status == "워밍업" else "green")
|
|
156
|
+
parts = [
|
|
157
|
+
"🧠 " + _c("cyan", f"{self.step}/{max_steps} {bar} {frac*100:3.0f}%", on),
|
|
158
|
+
_c("bold", f"loss {loss:.3f}", on) + " " + _c("spark", spark, on),
|
|
159
|
+
]
|
|
160
|
+
if lr:
|
|
161
|
+
parts.append(_c("dim", f"lr {lr:.1e}", on))
|
|
162
|
+
parts.append(_c("dim", f"ETA {eta}", on))
|
|
163
|
+
if self.spikes:
|
|
164
|
+
parts.append(_c("amber", f"⚡{len(self.spikes)}", on))
|
|
165
|
+
parts.append("🩺 " + _c(st_color, self.status, on))
|
|
166
|
+
return " · ".join(parts)
|
|
134
167
|
|
|
135
168
|
def summary(self) -> str:
|
|
136
169
|
"""학습 종료 시 요약 (레시피가 마지막에 출력)."""
|
|
@@ -9,10 +9,27 @@ GPU 머신(어댑터 학습한 곳)에서 실행:
|
|
|
9
9
|
--task schema --claim "당사 물류 파트너는 2,300개사에 달했습니다."
|
|
10
10
|
"""
|
|
11
11
|
import argparse
|
|
12
|
+
import contextlib
|
|
13
|
+
import logging
|
|
12
14
|
import os
|
|
15
|
+
import sys
|
|
16
|
+
import warnings
|
|
13
17
|
|
|
14
18
|
os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "3")
|
|
15
19
|
os.environ.setdefault("TRANSFORMERS_VERBOSITY", "error")
|
|
20
|
+
sys.unraisablehook = lambda *_: None
|
|
21
|
+
warnings.filterwarnings("ignore")
|
|
22
|
+
logging.getLogger("torchao").setLevel(logging.CRITICAL)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@contextlib.contextmanager
|
|
26
|
+
def _quiet():
|
|
27
|
+
if os.environ.get("SV_VERBOSE"):
|
|
28
|
+
yield
|
|
29
|
+
return
|
|
30
|
+
with open(os.devnull, "w") as dn, \
|
|
31
|
+
contextlib.redirect_stdout(dn), contextlib.redirect_stderr(dn):
|
|
32
|
+
yield
|
|
16
33
|
|
|
17
34
|
# 내장 테스트 — 시드/증강 데이터에 없는 새 표현으로 일반화를 확인.
|
|
18
35
|
_DEFAULT_TESTS = [
|
|
@@ -37,7 +54,8 @@ def main():
|
|
|
37
54
|
ap.add_argument("--max-tokens", type=int, default=120)
|
|
38
55
|
args = ap.parse_args()
|
|
39
56
|
|
|
40
|
-
|
|
57
|
+
with _quiet():
|
|
58
|
+
from unsloth import FastLanguageModel
|
|
41
59
|
|
|
42
60
|
from structverify.training.tasks import build_example
|
|
43
61
|
|
|
@@ -49,10 +67,11 @@ def main():
|
|
|
49
67
|
else:
|
|
50
68
|
tests = _DEFAULT_TESTS
|
|
51
69
|
|
|
52
|
-
print(f"어댑터
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
print(f"⚙ 어댑터 로드 — {args.adapter}")
|
|
71
|
+
with _quiet():
|
|
72
|
+
model, tok = FastLanguageModel.from_pretrained(
|
|
73
|
+
args.adapter, max_seq_length=2048, load_in_4bit=True)
|
|
74
|
+
FastLanguageModel.for_inference(model)
|
|
56
75
|
|
|
57
76
|
for t in tests:
|
|
58
77
|
msgs = build_example(**t)["messages"][:2] # system + user만
|
|
@@ -26,6 +26,29 @@ os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "3")
|
|
|
26
26
|
os.environ.setdefault("TRANSFORMERS_VERBOSITY", "error")
|
|
27
27
|
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
|
|
28
28
|
|
|
29
|
+
# "Exception ignored in: <_io.BytesIO ...> BufferError" 도배 차단.
|
|
30
|
+
# Python 3.13 + datasets 멀티프로세스 토큰화의 무해한 정리 단계 잡음인데,
|
|
31
|
+
# 워커가 fork로 뜨면서 이 훅을 물려받아 자식 프로세스 출력까지 조용해진다.
|
|
32
|
+
sys.unraisablehook = lambda *_: None
|
|
33
|
+
|
|
34
|
+
import contextlib
|
|
35
|
+
import logging
|
|
36
|
+
import warnings
|
|
37
|
+
|
|
38
|
+
warnings.filterwarnings("ignore") # Flax deprecated 등
|
|
39
|
+
logging.getLogger("torchao").setLevel(logging.CRITICAL) # torchao .so 로드 WARNING
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@contextlib.contextmanager
|
|
43
|
+
def _quiet():
|
|
44
|
+
"""서드파티 import·로드가 뿜는 무관한 출력 숨김. SV_VERBOSE=1이면 전부 표시."""
|
|
45
|
+
if os.environ.get("SV_VERBOSE"):
|
|
46
|
+
yield
|
|
47
|
+
return
|
|
48
|
+
with open(os.devnull, "w") as dn, \
|
|
49
|
+
contextlib.redirect_stdout(dn), contextlib.redirect_stderr(dn):
|
|
50
|
+
yield
|
|
51
|
+
|
|
29
52
|
|
|
30
53
|
def load_chat_dataset(path):
|
|
31
54
|
from datasets import Dataset
|
|
@@ -61,26 +84,49 @@ def main():
|
|
|
61
84
|
help="중간 체크포인트(checkpoint-*) 보존 — 기본은 성공 시 삭제 (어댑터만 수십 MB)")
|
|
62
85
|
args = ap.parse_args()
|
|
63
86
|
|
|
64
|
-
# unsloth: 3060/T4에서 QLoRA 2배 빠름 + 메모리
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
# unsloth: 3060/T4에서 QLoRA 2배 빠름 + 메모리 절약.
|
|
88
|
+
# import·로드 단계의 배너·경고는 숨기고(_quiet) 우리 요약 한 줄로 대체.
|
|
89
|
+
with _quiet():
|
|
90
|
+
from unsloth import FastLanguageModel
|
|
91
|
+
from trl import SFTTrainer, SFTConfig
|
|
92
|
+
|
|
93
|
+
# tqdm 진행바(체크포인트 로드·Map·Tokenizing) 대신 우리 phase 라인으로.
|
|
94
|
+
try:
|
|
95
|
+
import datasets as _ds
|
|
96
|
+
import transformers as _tf
|
|
97
|
+
_ds.disable_progress_bars()
|
|
98
|
+
_tf.utils.logging.disable_progress_bar()
|
|
99
|
+
except Exception: # noqa: BLE001
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
import torch
|
|
104
|
+
_p = torch.cuda.get_device_properties(0)
|
|
105
|
+
_prec = "bf16" if torch.cuda.is_bf16_supported() else "fp16"
|
|
106
|
+
print(f"⚙ 학습 엔진 준비 — unsloth · {_p.name} ({_p.total_memory/2**30:.0f}GB) · {_prec}",
|
|
107
|
+
file=sys.stderr)
|
|
108
|
+
except Exception: # noqa: BLE001
|
|
109
|
+
pass
|
|
110
|
+
|
|
111
|
+
print(f"⚙ 베이스 모델 로드 — {args.model} (4bit)", file=sys.stderr)
|
|
112
|
+
with _quiet():
|
|
113
|
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
|
114
|
+
model_name=args.model,
|
|
115
|
+
max_seq_length=args.seq_len,
|
|
116
|
+
load_in_4bit=True, # QLoRA — 12GB VRAM에 7B 적재
|
|
117
|
+
)
|
|
118
|
+
model = FastLanguageModel.get_peft_model(
|
|
119
|
+
model,
|
|
120
|
+
r=args.rank,
|
|
121
|
+
target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
|
|
122
|
+
"gate_proj", "up_proj", "down_proj"],
|
|
123
|
+
lora_alpha=args.rank * 2,
|
|
124
|
+
lora_dropout=0.0,
|
|
125
|
+
bias="none",
|
|
126
|
+
use_gradient_checkpointing="unsloth",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
print("⚙ 데이터 준비·토큰화 중 …", file=sys.stderr)
|
|
84
130
|
ds = load_chat_dataset(args.data)
|
|
85
131
|
|
|
86
132
|
def fmt(ex):
|
|
@@ -112,7 +158,7 @@ def main():
|
|
|
112
158
|
from transformers import TrainerCallback
|
|
113
159
|
from transformers.trainer_callback import PrinterCallback
|
|
114
160
|
|
|
115
|
-
from structverify.training.monitor import LossMonitor
|
|
161
|
+
from structverify.training.monitor import LossMonitor, _c, _color_enabled
|
|
116
162
|
|
|
117
163
|
class SVLiveCallback(TrainerCallback):
|
|
118
164
|
def __init__(self, early_stop: bool, patience: int):
|
|
@@ -128,18 +174,20 @@ def main():
|
|
|
128
174
|
print("\r\x1b[2K" + line, end="", flush=True, file=sys.stderr)
|
|
129
175
|
if self.mon.should_stop and self.early_stop:
|
|
130
176
|
print("", file=sys.stderr)
|
|
131
|
-
print(f"✂ {self.mon.stop_reason}", file=sys.stderr)
|
|
177
|
+
print(_c("amber", f"✂ {self.mon.stop_reason}", _color_enabled()), file=sys.stderr)
|
|
132
178
|
control.should_training_stop = True
|
|
133
179
|
return control
|
|
134
180
|
|
|
135
181
|
def on_train_end(self, targs, state, control, **kw):
|
|
136
182
|
print("", file=sys.stderr)
|
|
137
|
-
print(self.mon.summary(), file=sys.stderr)
|
|
183
|
+
print(_c("green", self.mon.summary(), _color_enabled()), file=sys.stderr)
|
|
138
184
|
return control
|
|
139
185
|
|
|
140
186
|
trainer.remove_callback(PrinterCallback) # {'loss': ...} dict 도배 제거
|
|
141
187
|
trainer.add_callback(SVLiveCallback(args.early_stop, args.patience))
|
|
142
188
|
|
|
189
|
+
es = "ON" if args.early_stop else "OFF (관찰만)"
|
|
190
|
+
print(f"🩺 실시간 감독 시작 — patience {args.patience} · 조기 종료 {es}", file=sys.stderr)
|
|
143
191
|
trainer.train()
|
|
144
192
|
|
|
145
193
|
# 어댑터 + trainer_state.json 저장 (TrainDoctor가 읽음)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structverify
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Compliance & fact verification for documents — check your files against your own rulebook (PDF) or a data source, and read a plain True/False.
|
|
5
5
|
Author-email: "김예슬 (Yeseul Kim)" <yesul0718@gmail.com>
|
|
6
6
|
License: MIT License
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structverify-0.3.1 → structverify-0.3.3}/structverify/detection/prompts/claim_worthiness.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structverify-0.3.1/structverify/storage → structverify-0.3.3/structverify/explanation}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structverify-0.3.1/structverify/retrieval → structverify-0.3.3/structverify/graph}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structverify-0.3.1/structverify/graph → structverify-0.3.3/structverify/retrieval}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structverify-0.3.1/structverify/explanation → structverify-0.3.3/structverify/storage}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|