tracebloc 5.0.2__tar.gz → 5.0.4__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.
- {tracebloc-5.0.2 → tracebloc-5.0.4}/PKG-INFO +2 -1
- {tracebloc-5.0.2 → tracebloc-5.0.4}/pyproject.toml +2 -1
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/checks.py +1 -1
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/client.py +10 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/contracts/training_requirements.source.json +2 -2
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/contracts/training_requirements.txt +3 -5
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/downloads/seed_weights.py +21 -18
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/loss_config.py +49 -45
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/model_upload.py +43 -33
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/nlp_probes.py +8 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/weights_averaging.py +17 -9
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/model_params.py +112 -88
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/sklearn_checks.py +37 -29
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc.egg-info/PKG-INFO +2 -1
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc.egg-info/requires.txt +1 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/MANIFEST.in +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/README.md +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/license.txt +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/setup.cfg +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/api/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/api/experiment_status.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/api/responses.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/auth/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/auth/env_login.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/compat/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/compat/deprecation.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/compat/frameworks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/config.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/contracts/stage_urls.v1.json +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/contracts/survival_payload.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/acceptance.py +0 -0
- {tracebloc-5.0.2/tracebloc/validation → tracebloc-5.0.4/tracebloc/convert/families}/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/hf/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/hf/_build.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/hf/_model_type.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/tabular.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/vision/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/families/vision/_matching.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/gate.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/heads.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/interfaces.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/licence/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/licence/spdx.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/outputs.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/arguments.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/assemble.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/checkpoint.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/gate_rules.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/generate.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/head.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/import_check.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/layer0.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/live.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/model_class.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/remote.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/repo.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/shake.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/owncode/source_tree.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/package.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/padding.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/report.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/tokenizers.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/convert/training_versions.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/base.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/detection.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/keypoint_detection.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/semantic_segmentation.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/tabular.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/text.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/time_series.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/datasets/time_to_event.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/downloads/lifelines_weights.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/exceptions.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/fetch.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/inference.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/answer.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/augmentation_methods.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/check_model.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/conversion.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/data_methods.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/library.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/model_dataset.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/regeneration.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/response.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/stored.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/training_methods.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/linking/user_methods.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/_partials.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/embeddings.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/survival.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/classes.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/declaration.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/fitted_model.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/frame_recording.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/link_check.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/pairs.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/schema.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/seed_prefixes.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/sklearn_check.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/survival.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/torch_checks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/raw_mode/width_note.py +0 -0
- {tracebloc-5.0.2/tracebloc/utils → tracebloc-5.0.4/tracebloc/training}/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/augmentation.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/callbacks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/converted.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/features.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/image_channels.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/image_size.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/link_total.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/lora.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/lora_validation.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/loss.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/loss_policy.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/loss_source.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/memory_estimate.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/memory_sizing.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/plan.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/preprocessing.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/shape.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/subdataset.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/submitter.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/training/summary.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/lifelines_time_to_event.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/model_params.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/sequence_length.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/skl_tabular_base.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/skl_tabular_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/skl_tabular_regression.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/statistical_base.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/survival_base.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_embeddings.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_handler.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_image_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_key_point_detector.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_multi_label_text_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_nlp_base.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_object_detector.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_semantic_segmentation.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_seq2seq_modeler.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_tabular_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_tabular_regression.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_text_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_text_regressor.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_time_series_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_time_series_forecaster.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_time_to_event.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/torch_token_classifier.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/user_methods.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/weight_loaders.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/weights_check.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/upload/weights_parts.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/user.py +0 -0
- {tracebloc-5.0.2/tracebloc/training → tracebloc-5.0.4/tracebloc/utils}/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/class_order.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/constants.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/custom_loss_probe.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/data_probes.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/declared_classes.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/declared_cls.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/detection_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/device.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/entry_point.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/errors.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/feature_dict.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/model_loading.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/registry.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/resources.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/safetensors_io.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/staging.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/tabular_classification_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/tabular_regression_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/text_classification_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/time_series_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/time_to_event_utils.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/utils/warnings_once.py +0 -0
- {tracebloc-5.0.2/tracebloc/convert/families → tracebloc-5.0.4/tracebloc/validation}/__init__.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/checker.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/estimator_checks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/header_rules.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/lifelines_checks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/pytorch_checks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/rewriter.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc/validation/scikit_survival_checks.py +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc.egg-info/SOURCES.txt +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc.egg-info/dependency_links.txt +0 -0
- {tracebloc-5.0.2 → tracebloc-5.0.4}/tracebloc.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tracebloc
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.4
|
|
4
4
|
Summary: Build AI with anyone. On data that can't move. SDK for the tracebloc collaborative AI workspace.
|
|
5
5
|
Author-email: tracebloc <lukas@tracebloc.io>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -54,6 +54,7 @@ Provides-Extra: training
|
|
|
54
54
|
Requires-Dist: numpy==2.3.2; python_version < "3.14" and extra == "training"
|
|
55
55
|
Requires-Dist: pandas==2.3.3; python_version < "3.14" and extra == "training"
|
|
56
56
|
Requires-Dist: psutil==7.0.0; extra == "training"
|
|
57
|
+
Requires-Dist: requests==2.34.2; extra == "training"
|
|
57
58
|
Requires-Dist: pillow==13.0.0; extra == "training"
|
|
58
59
|
Requires-Dist: safetensors>=0.8.0; extra == "training"
|
|
59
60
|
Requires-Dist: torch==2.14.1; extra == "training"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tracebloc"
|
|
7
|
-
version = "5.0.
|
|
7
|
+
version = "5.0.4"
|
|
8
8
|
description = "Build AI with anyone. On data that can't move. SDK for the tracebloc collaborative AI workspace."
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["license.txt"]
|
|
@@ -122,6 +122,7 @@ training = [
|
|
|
122
122
|
"numpy==2.3.2; python_version < '3.14'",
|
|
123
123
|
"pandas==2.3.3; python_version < '3.14'",
|
|
124
124
|
"psutil==7.0.0",
|
|
125
|
+
"requests==2.34.2",
|
|
125
126
|
"pillow==13.0.0",
|
|
126
127
|
"safetensors>=0.8.0",
|
|
127
128
|
"torch==2.14.1",
|
|
@@ -247,7 +247,7 @@ def _parameter_count(task):
|
|
|
247
247
|
return None
|
|
248
248
|
try:
|
|
249
249
|
return int(get_model_params_count(framework=task.framework, model=task.model))
|
|
250
|
-
except Exception:
|
|
250
|
+
except Exception: # noqa: BLE001 - counts through the user's own model code
|
|
251
251
|
return None
|
|
252
252
|
|
|
253
253
|
|
|
@@ -376,6 +376,16 @@ class TraceblocClient:
|
|
|
376
376
|
raise APIError(response.status_code, _error_message(response))
|
|
377
377
|
return response
|
|
378
378
|
|
|
379
|
+
def get_external(self, url: str, *, stream: bool = False) -> requests.Response:
|
|
380
|
+
"""GET ``url`` on another host (a presigned download) on this session,
|
|
381
|
+
with its timeout, 5xx retries and 429 waits but no tracebloc header.
|
|
382
|
+
Any status is returned; no answer raises :class:`requests.RequestException`
|
|
383
|
+
as is, for the caller to name the host."""
|
|
384
|
+
timeout = self._config.timeout_seconds
|
|
385
|
+
return _send_honouring_429(
|
|
386
|
+
lambda: self._session.get(url, stream=stream, timeout=timeout), retry=True
|
|
387
|
+
)
|
|
388
|
+
|
|
379
389
|
# Convenience shortcuts mirroring requests.* names.
|
|
380
390
|
|
|
381
391
|
def get(self, path: str, **kwargs: Any) -> requests.Response:
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"//": "Pin for tracebloc/contracts/training_requirements.txt, the training images' exact library versions. The txt is tracebloc-engine's use_cases/requirements.txt copied byte-for-byte at `sha`; `blobSha` is its git blob sha there, which tests/test_convert_training_versions.py recomputes. tracebloc.convert.training_versions reads it to refuse a conversion made under other library versions. Re-pin with scripts/sync-training-requirements.sh (put the new commit in `sha` and run it; org-config's contract-pin-bump.yml does the same), then run that test.",
|
|
3
3
|
"repo": "tracebloc/tracebloc-engine",
|
|
4
4
|
"ref": "develop",
|
|
5
|
-
"sha": "
|
|
5
|
+
"sha": "3b83e9a701cd8b33413acd20cf1bfe3c247d4b85",
|
|
6
6
|
"path": "use_cases/requirements.txt",
|
|
7
|
-
"blobSha": "
|
|
7
|
+
"blobSha": "b6ed1fbaea7d8dc79009a175046a56882a4f390c",
|
|
8
8
|
"fetched": "2026-11-12"
|
|
9
9
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# Shared use-case requirements. Used by all use-case base images.
|
|
2
2
|
psutil==7.0.0
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
# it; it used to arrive transitively via the kubernetes pin. Keep it explicit.
|
|
7
|
-
websocket-client==1.9.0
|
|
3
|
+
# The engine's HTTP client, for the egress gate (core/interfaces/gate.py). It
|
|
4
|
+
# used to arrive with the Service Bus SDK, which the engine no longer installs.
|
|
5
|
+
requests==2.34.2
|
|
8
6
|
# ONE cv2, the headless build (backend#3456, RFC-0087 W2). albumentations 2.0.5
|
|
9
7
|
# requires `opencv-python-headless>=4.9.0.80`, so pinning the GUI build here put
|
|
10
8
|
# TWO cv2 distributions in every image, unpacked into one `cv2/` (63 + 61 MB
|
|
@@ -15,8 +15,9 @@ host. :func:`fetch_seed_weights` downloads it and writes
|
|
|
15
15
|
(``category`` in its record) -- a backend that resolves by the stem alone
|
|
16
16
|
would pass the other category's seed, valid sha and all. A bare stem asks by
|
|
17
17
|
the backend's key alone, as before.
|
|
18
|
-
* The presigned GET
|
|
19
|
-
|
|
18
|
+
* The presigned GET goes out on the client's session, with its timeout and
|
|
19
|
+
retries, through ``client.get_external``, which sends no tracebloc header:
|
|
20
|
+
the ``Authorization`` header must not reach another host.
|
|
20
21
|
* The file is streamed to a temporary file in the target directory, checked
|
|
21
22
|
against ``size_bytes`` and ``sha256``, and only then renamed into place, so a
|
|
22
23
|
failed or corrupt download leaves no partial ``_weights.pkl``.
|
|
@@ -26,8 +27,9 @@ host. :func:`fetch_seed_weights` downloads it and writes
|
|
|
26
27
|
or ``.safetensors`` of this stem that no fetch wrote is the user's, and is
|
|
27
28
|
never replaced or left to shadow the seed (``get_paths`` prefers
|
|
28
29
|
``.safetensors`` over ``.pkl``) -- the fetch refuses instead. An earlier
|
|
29
|
-
fetch's weights of this stem, any extension, are replaced.
|
|
30
|
-
replace a seed like any other
|
|
30
|
+
fetch's weights of this stem, any extension, are replaced.
|
|
31
|
+
``fetch_zoo_template`` and ``fetch_model`` replace a seed like any other
|
|
32
|
+
fetched weights, so fetch the template first.
|
|
31
33
|
|
|
32
34
|
The presigned host is not one of the tracebloc hosts the embedded notebook pod
|
|
33
35
|
may reach, so there the download fails with a message saying so.
|
|
@@ -43,7 +45,6 @@ import hashlib
|
|
|
43
45
|
import os
|
|
44
46
|
import re
|
|
45
47
|
import zipfile
|
|
46
|
-
from typing import Optional
|
|
47
48
|
from urllib.parse import urlsplit
|
|
48
49
|
|
|
49
50
|
import requests
|
|
@@ -90,7 +91,7 @@ def _sha256_of(path: str) -> str:
|
|
|
90
91
|
return digest.hexdigest()
|
|
91
92
|
|
|
92
93
|
|
|
93
|
-
def _describe(client, stem: str, category:
|
|
94
|
+
def _describe(client, stem: str, category: str | None = None) -> dict:
|
|
94
95
|
"""The backend's seed record for ``stem`` -- the one built for ``category``
|
|
95
96
|
when given -- validated."""
|
|
96
97
|
query = {"params": {"category": category}} if category else {}
|
|
@@ -172,11 +173,10 @@ def _refuse_foreign_weights(directory, stem, fetched_before, record) -> bool:
|
|
|
172
173
|
return have_seed
|
|
173
174
|
|
|
174
175
|
|
|
175
|
-
def _open_presigned(url: str
|
|
176
|
+
def _open_presigned(client, url: str):
|
|
176
177
|
host = urlsplit(url).hostname
|
|
177
178
|
try:
|
|
178
|
-
|
|
179
|
-
response = requests.get(url, stream=True, timeout=timeout)
|
|
179
|
+
response = client.get_external(url, stream=True)
|
|
180
180
|
except requests.RequestException as error:
|
|
181
181
|
raise APIError(
|
|
182
182
|
0,
|
|
@@ -249,7 +249,7 @@ def fetch_seed_weights(client, template: str, directory: str = ".") -> str:
|
|
|
249
249
|
if not have_seed:
|
|
250
250
|
_clear_abandoned_temps(directory)
|
|
251
251
|
digest = hashlib.sha256()
|
|
252
|
-
response = _open_presigned(record["url"]
|
|
252
|
+
response = _open_presigned(client, record["url"])
|
|
253
253
|
tmp = _stage(response, directory, digest)
|
|
254
254
|
try:
|
|
255
255
|
_verify(tmp, record, digest)
|
|
@@ -287,7 +287,7 @@ def _model_source(model_file_path: str) -> str:
|
|
|
287
287
|
return handle.read()
|
|
288
288
|
|
|
289
289
|
|
|
290
|
-
def seed_template_of(model_file_path: str) ->
|
|
290
|
+
def seed_template_of(model_file_path: str) -> str | None:
|
|
291
291
|
"""The zoo template stem whose seed ``model_file_path`` names, or ``None``.
|
|
292
292
|
|
|
293
293
|
Read from the file's text, not its name: a renamed copy keeps it, and a
|
|
@@ -301,7 +301,7 @@ def seed_template_of(model_file_path: str) -> Optional[str]:
|
|
|
301
301
|
return stem if stem in names else None
|
|
302
302
|
|
|
303
303
|
|
|
304
|
-
def _template_id_of(model_file_path: str, stem: str) ->
|
|
304
|
+
def _template_id_of(model_file_path: str, stem: str) -> str | None:
|
|
305
305
|
"""The zoo id of the template ``model_file_path`` is, from the ``category``
|
|
306
306
|
and ``framework`` it declares, or ``None`` when it does not declare exactly
|
|
307
307
|
one of each."""
|
|
@@ -318,13 +318,13 @@ def _template_id_of(model_file_path: str, stem: str) -> Optional[str]:
|
|
|
318
318
|
return template_id if zoo_template_stem(template_id) == stem else None
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
def skipped_seed_warning(client, model_file_path: str) ->
|
|
321
|
+
def skipped_seed_warning(client, model_file_path: str) -> str | None:
|
|
322
322
|
"""The warning for uploading ``model_file_path`` without weights when it is
|
|
323
323
|
a zoo template with a seed in the store, else ``None``.
|
|
324
324
|
|
|
325
|
-
Best effort: an unreadable file, a lookup
|
|
326
|
-
|
|
327
|
-
never a warning the backend did not confirm.
|
|
325
|
+
Best effort: an unreadable file, or a lookup the backend fails (no seed,
|
|
326
|
+
refused, unreachable, malformed: :class:`APIError`), is ``None`` -- never
|
|
327
|
+
an error, and never a warning the backend did not confirm.
|
|
328
328
|
"""
|
|
329
329
|
try:
|
|
330
330
|
template = seed_template_of(model_file_path)
|
|
@@ -333,9 +333,12 @@ def skipped_seed_warning(client, model_file_path: str) -> Optional[str]:
|
|
|
333
333
|
# By the template's id where it declares one: its stem alone can name
|
|
334
334
|
# another category's seed (``bert_base_uncased``).
|
|
335
335
|
fetch_as = _template_id_of(model_file_path, template) or template
|
|
336
|
-
|
|
336
|
+
except Exception: # noqa: BLE001 - the user's file or archive, after its upload succeeded
|
|
337
|
+
return None
|
|
338
|
+
category = fetch_as.split("/")[0] if fetch_as != template else None
|
|
339
|
+
try:
|
|
337
340
|
_describe(client, template, category)
|
|
338
|
-
except
|
|
341
|
+
except APIError:
|
|
339
342
|
return None
|
|
340
343
|
directory = os.path.dirname(model_file_path) or "."
|
|
341
344
|
stem = os.path.splitext(os.path.basename(model_file_path))[0]
|
|
@@ -42,51 +42,7 @@ class LossConfigMixin:
|
|
|
42
42
|
return None
|
|
43
43
|
|
|
44
44
|
if custom_loss or (category == OBJECT_DETECTION and model_type == YOLO):
|
|
45
|
-
|
|
46
|
-
if not os.path.exists(loss_file_path):
|
|
47
|
-
raise FileNotFoundError(missing_loss_message(category, model_type))
|
|
48
|
-
|
|
49
|
-
# Load loss.py FRESH by explicit file path every call. Using the
|
|
50
|
-
# global ``loss`` module name (``from loss import Custom_loss``)
|
|
51
|
-
# caches the first model's module in ``sys.modules['loss']``, so a
|
|
52
|
-
# second model validated in the same process (e.g. upload A then
|
|
53
|
-
# upload/link B in one notebook) would silently reuse A's
|
|
54
|
-
# Custom_loss — validating B against the wrong loss. importlib with
|
|
55
|
-
# a unique spec re-reads the actual file each time and never touches
|
|
56
|
-
# the cached module name.
|
|
57
|
-
#
|
|
58
|
-
# The directory is still placed on sys.path for the duration of the
|
|
59
|
-
# exec so loss.py's own intra-file imports keep resolving as before.
|
|
60
|
-
import importlib.util
|
|
61
|
-
import inspect
|
|
62
|
-
|
|
63
|
-
sys.path.insert(0, self.tmp_dir_path)
|
|
64
|
-
try:
|
|
65
|
-
spec = importlib.util.spec_from_file_location(
|
|
66
|
-
"tracebloc_custom_loss", loss_file_path
|
|
67
|
-
)
|
|
68
|
-
if spec is None or spec.loader is None:
|
|
69
|
-
raise ImportError(
|
|
70
|
-
f"Could not create import spec for {loss_file_path}."
|
|
71
|
-
)
|
|
72
|
-
module = importlib.util.module_from_spec(spec)
|
|
73
|
-
spec.loader.exec_module(module)
|
|
74
|
-
custom_loss_obj = module.Custom_loss
|
|
75
|
-
|
|
76
|
-
if inspect.isclass(custom_loss_obj):
|
|
77
|
-
return custom_loss_obj()
|
|
78
|
-
else:
|
|
79
|
-
return custom_loss_obj
|
|
80
|
-
except (ImportError, AttributeError) as e:
|
|
81
|
-
raise ImportError(
|
|
82
|
-
f"Failed to import loss function from {loss_file_path}. "
|
|
83
|
-
f"Error: {format_exception(e)}"
|
|
84
|
-
) from e
|
|
85
|
-
finally:
|
|
86
|
-
try:
|
|
87
|
-
sys.path.remove(self.tmp_dir_path)
|
|
88
|
-
except ValueError:
|
|
89
|
-
pass
|
|
45
|
+
return self._load_custom_loss(category, model_type)
|
|
90
46
|
|
|
91
47
|
if self.framework == PYTORCH_FRAMEWORK:
|
|
92
48
|
from torch import nn
|
|
@@ -129,3 +85,51 @@ class LossConfigMixin:
|
|
|
129
85
|
# Non-PyTorch frameworks (sklearn returns above; lifelines /
|
|
130
86
|
# scikit-survival) build no loss object.
|
|
131
87
|
return None
|
|
88
|
+
|
|
89
|
+
def _load_custom_loss(self, category, model_type):
|
|
90
|
+
"""Load ``Custom_loss`` from ``loss.py`` in the model's temp dir."""
|
|
91
|
+
loss_file_path = os.path.join(self.tmp_dir_path, "loss.py")
|
|
92
|
+
if not os.path.exists(loss_file_path):
|
|
93
|
+
raise FileNotFoundError(missing_loss_message(category, model_type))
|
|
94
|
+
|
|
95
|
+
# Load loss.py FRESH by explicit file path every call. Using the
|
|
96
|
+
# global ``loss`` module name (``from loss import Custom_loss``)
|
|
97
|
+
# caches the first model's module in ``sys.modules['loss']``, so a
|
|
98
|
+
# second model validated in the same process (e.g. upload A then
|
|
99
|
+
# upload/link B in one notebook) would silently reuse A's
|
|
100
|
+
# Custom_loss — validating B against the wrong loss. importlib with
|
|
101
|
+
# a unique spec re-reads the actual file each time and never touches
|
|
102
|
+
# the cached module name.
|
|
103
|
+
#
|
|
104
|
+
# The directory is still placed on sys.path for the duration of the
|
|
105
|
+
# exec so loss.py's own intra-file imports keep resolving as before.
|
|
106
|
+
import importlib.util
|
|
107
|
+
import inspect
|
|
108
|
+
|
|
109
|
+
sys.path.insert(0, self.tmp_dir_path)
|
|
110
|
+
try:
|
|
111
|
+
spec = importlib.util.spec_from_file_location(
|
|
112
|
+
"tracebloc_custom_loss", loss_file_path
|
|
113
|
+
)
|
|
114
|
+
if spec is None or spec.loader is None:
|
|
115
|
+
raise ImportError(
|
|
116
|
+
f"Could not create import spec for {loss_file_path}."
|
|
117
|
+
)
|
|
118
|
+
module = importlib.util.module_from_spec(spec)
|
|
119
|
+
spec.loader.exec_module(module)
|
|
120
|
+
custom_loss_obj = module.Custom_loss
|
|
121
|
+
|
|
122
|
+
if inspect.isclass(custom_loss_obj):
|
|
123
|
+
return custom_loss_obj()
|
|
124
|
+
else:
|
|
125
|
+
return custom_loss_obj
|
|
126
|
+
except (ImportError, AttributeError) as e:
|
|
127
|
+
raise ImportError(
|
|
128
|
+
f"Failed to import loss function from {loss_file_path}. "
|
|
129
|
+
f"Error: {format_exception(e)}"
|
|
130
|
+
) from e
|
|
131
|
+
finally:
|
|
132
|
+
try:
|
|
133
|
+
sys.path.remove(self.tmp_dir_path)
|
|
134
|
+
except ValueError:
|
|
135
|
+
pass
|
|
@@ -126,23 +126,7 @@ class Model(WeightsCheckMixin, WeightsAveragingMixin, LossConfigMixin):
|
|
|
126
126
|
def validate_model_file(self, upload=True):
|
|
127
127
|
# upload=False: every check, then no POST (see _stored_link).
|
|
128
128
|
self.validated = False
|
|
129
|
-
|
|
130
|
-
# check if model has supported parameters
|
|
131
|
-
# Exclude statistical frameworks (sklearn, lifelines, scikit_survival) from parameter checking
|
|
132
|
-
# as they don't have trainable parameters in the neural network sense
|
|
133
|
-
if self.framework not in [SKLEARN_FRAMEWORK, LIFELINES_FRAMEWORK, SCIKIT_SURVIVAL_FRAMEWORK]:
|
|
134
|
-
self.check_model_support()
|
|
135
|
-
gc.collect()
|
|
136
|
-
except Exception as e:
|
|
137
|
-
self.failure_reason = f"model-support pre-check raised: {format_exception(e)}"
|
|
138
|
-
print_error(
|
|
139
|
-
text=f"\nUpload failed due to {format_exception(e)}",
|
|
140
|
-
docs_print=True,
|
|
141
|
-
docs="For more information check the [link=https://docs.tracebloc.io/user-uploadModel]docs["
|
|
142
|
-
"/link]",
|
|
143
|
-
)
|
|
144
|
-
remove_tmp_file(tmp_dir_path=self.tmp_dir_path)
|
|
145
|
-
self.progress_bar.close()
|
|
129
|
+
if not self._passes_model_support_check():
|
|
146
130
|
return None
|
|
147
131
|
# The user explicitly opted into pretrained weights — a failed
|
|
148
132
|
# staging must abort, not silently continue from random init.
|
|
@@ -210,6 +194,28 @@ class Model(WeightsCheckMixin, WeightsAveragingMixin, LossConfigMixin):
|
|
|
210
194
|
self.progress_bar.close()
|
|
211
195
|
return None
|
|
212
196
|
|
|
197
|
+
def _passes_model_support_check(self):
|
|
198
|
+
"""The parameter-count pre-check; on failure, clean up and say why."""
|
|
199
|
+
try:
|
|
200
|
+
# check if model has supported parameters
|
|
201
|
+
# Exclude statistical frameworks (sklearn, lifelines, scikit_survival) from parameter checking
|
|
202
|
+
# as they don't have trainable parameters in the neural network sense
|
|
203
|
+
if self.framework not in [SKLEARN_FRAMEWORK, LIFELINES_FRAMEWORK, SCIKIT_SURVIVAL_FRAMEWORK]:
|
|
204
|
+
self.check_model_support()
|
|
205
|
+
gc.collect()
|
|
206
|
+
except Exception as e:
|
|
207
|
+
self.failure_reason = f"model-support pre-check raised: {format_exception(e)}"
|
|
208
|
+
print_error(
|
|
209
|
+
text=f"\nUpload failed due to {format_exception(e)}",
|
|
210
|
+
docs_print=True,
|
|
211
|
+
docs="For more information check the [link=https://docs.tracebloc.io/user-uploadModel]docs["
|
|
212
|
+
"/link]",
|
|
213
|
+
)
|
|
214
|
+
remove_tmp_file(tmp_dir_path=self.tmp_dir_path)
|
|
215
|
+
self.progress_bar.close()
|
|
216
|
+
return None
|
|
217
|
+
return True
|
|
218
|
+
|
|
213
219
|
def upload_model(self):
|
|
214
220
|
model_file = None
|
|
215
221
|
model_weights = None
|
|
@@ -282,22 +288,26 @@ class Model(WeightsCheckMixin, WeightsAveragingMixin, LossConfigMixin):
|
|
|
282
288
|
print(text, "\n")
|
|
283
289
|
self.progress_bar_2.close()
|
|
284
290
|
finally:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
291
|
+
self._release_upload_files(model_file, model_weights, tokenizer_file)
|
|
292
|
+
|
|
293
|
+
def _release_upload_files(self, model_file, model_weights, tokenizer_file):
|
|
294
|
+
"""Close the upload handles, then drop the re-emitted SafeTensors dir."""
|
|
295
|
+
# Close every opened upload handle on all paths — including the
|
|
296
|
+
# exception path (e.g. check_weights or _client.post raising) —
|
|
297
|
+
# so a contributor tokenizer / model / weights file isn't leaked
|
|
298
|
+
# until garbage collection. ``close()`` is idempotent.
|
|
299
|
+
for fh in (model_file, model_weights, tokenizer_file):
|
|
300
|
+
if fh is not None:
|
|
301
|
+
try:
|
|
302
|
+
fh.close()
|
|
303
|
+
except Exception:
|
|
304
|
+
pass
|
|
305
|
+
# Drop the re-emitted SafeTensors temp dir (handles above are
|
|
306
|
+
# closed first — required for rmtree on Windows).
|
|
307
|
+
emit_dir = getattr(self, "_safetensors_emit_dir", None)
|
|
308
|
+
if emit_dir is not None:
|
|
309
|
+
shutil.rmtree(emit_dir, ignore_errors=True)
|
|
310
|
+
self._safetensors_emit_dir = None
|
|
301
311
|
|
|
302
312
|
# ------------------------------------------------------------------
|
|
303
313
|
# model_func_checks — template method (#267, WS-U step 0)
|
|
@@ -61,6 +61,13 @@ class TorchNLPProbesMixin:
|
|
|
61
61
|
)
|
|
62
62
|
check_declared_sequence_length(int(self.data_shape), self.sequence_limit)
|
|
63
63
|
|
|
64
|
+
self._validate_vocab_and_layers(is_hf_model, declared_vocab)
|
|
65
|
+
|
|
66
|
+
# 6. The tokenizer (see _validate_tokenizer).
|
|
67
|
+
self._validate_tokenizer()
|
|
68
|
+
|
|
69
|
+
def _validate_vocab_and_layers(self, is_hf_model, declared_vocab):
|
|
70
|
+
"""Checks 2-5: the embedding table, the declared vocab, nn.Linear for LoRA."""
|
|
64
71
|
# 2. nn.Embedding check for non-HF models (vocab families only).
|
|
65
72
|
if self._requires_embedding_layer and not is_hf_model:
|
|
66
73
|
embeddings = [
|
|
@@ -111,6 +118,7 @@ class TorchNLPProbesMixin:
|
|
|
111
118
|
f"exceed the embedding table size."
|
|
112
119
|
)
|
|
113
120
|
|
|
121
|
+
def _validate_tokenizer(self):
|
|
114
122
|
# 6. Tokenizer is the federation's single source of truth (#805):
|
|
115
123
|
# non-HF models must ship a tokenizer.json; HF models must declare
|
|
116
124
|
# a tokenizer_id. Enforce that, then validate the actual tokenizer
|
|
@@ -96,15 +96,7 @@ class WeightsAveragingMixin:
|
|
|
96
96
|
self.tmp_dir_path, f"{AVERAGED_WEIGHTS_PATH}.pkl"
|
|
97
97
|
)
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
try:
|
|
101
|
-
with open(weights_file_path_1, "rb") as pkl_file, open(
|
|
102
|
-
weights_file_path_2, "rb"
|
|
103
|
-
) as pkl_file2:
|
|
104
|
-
weights.append(pickle.load(pkl_file))
|
|
105
|
-
weights.append(pickle.load(pkl_file2))
|
|
106
|
-
except Exception as e:
|
|
107
|
-
raise
|
|
99
|
+
self._read_weight_files(weights, weights_file_path_1, weights_file_path_2)
|
|
108
100
|
|
|
109
101
|
# ``subset_v1`` format (PEFT path): both pickles are dicts with
|
|
110
102
|
# ``{"format", "keys", "values"}``. Average only ``values`` and
|
|
@@ -156,6 +148,22 @@ class WeightsAveragingMixin:
|
|
|
156
148
|
except Exception as e:
|
|
157
149
|
raise
|
|
158
150
|
|
|
151
|
+
self._save_averaged_weights(new_weights)
|
|
152
|
+
|
|
153
|
+
def _read_weight_files(self, weights, weights_file_path_1, weights_file_path_2):
|
|
154
|
+
"""Append the unpickled pretrained then trained weights to weights."""
|
|
155
|
+
# Load weights from files
|
|
156
|
+
try:
|
|
157
|
+
with open(weights_file_path_1, "rb") as pkl_file, open(
|
|
158
|
+
weights_file_path_2, "rb"
|
|
159
|
+
) as pkl_file2:
|
|
160
|
+
weights.append(pickle.load(pkl_file))
|
|
161
|
+
weights.append(pickle.load(pkl_file2))
|
|
162
|
+
except Exception as e:
|
|
163
|
+
raise
|
|
164
|
+
|
|
165
|
+
def _save_averaged_weights(self, new_weights):
|
|
166
|
+
"""Pickle the averaged weights to average_weights_file_path."""
|
|
159
167
|
# Save averaged weights
|
|
160
168
|
try:
|
|
161
169
|
with open(self.average_weights_file_path, "wb") as f:
|