Image Feature Extraction
Transformers
PyTorch
manekko_3d
feature-extraction
vision-transformer
3d
medical-imaging
manekko
custom_code
Instructions to use Tenbatsu2424/Manekko_OpenMind with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Tenbatsu2424/Manekko_OpenMind with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="Tenbatsu2424/Manekko_OpenMind", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Tenbatsu2424/Manekko_OpenMind", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download convert_checkpoint.py from Tenbatsu2424/Manekko_OpenMind: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/Tenbatsu2424/Manekko_OpenMind/resolve/main/convert_checkpoint.py
- Command line
-
hf download hf://Tenbatsu2424/Manekko_OpenMind/convert_checkpoint.py
-
curl -L -o convert_checkpoint.py https://huggingface.co/Tenbatsu2424/Manekko_OpenMind/resolve/main/convert_checkpoint.py
1.83 kB
| """Export a tensor-only checkpoint as a Manekko model repository. | |
| Usage: | |
| python convert_checkpoint.py /path/student.ckpt --output ./export | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import importlib.util | |
| from pathlib import Path | |
| import sys | |
| def _load_package(folder: Path): | |
| """Load local model code for direct script execution.""" | |
| name = "_manekko_export_code" | |
| spec = importlib.util.spec_from_file_location( | |
| name, folder / "__init__.py", submodule_search_locations=[str(folder)] | |
| ) | |
| module = importlib.util.module_from_spec(spec) | |
| sys.modules[name] = module | |
| spec.loader.exec_module(module) | |
| return module | |
| def main(argv=None): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("checkpoint", type=Path) | |
| parser.add_argument( | |
| "--config", type=Path, default=Path(__file__).parent / "config.json" | |
| ) | |
| parser.add_argument("--output", type=Path, required=True) | |
| args = parser.parse_args(argv) | |
| if not args.checkpoint.is_file(): | |
| parser.error(f"Checkpoint does not exist: {args.checkpoint}") | |
| if not args.config.is_file(): | |
| parser.error(f"Configuration does not exist: {args.config}") | |
| package = _load_package(Path(__file__).resolve().parent) | |
| from _manekko_export_code.modeling_manekko import load_encoder_file | |
| config = package.ManekkoConfig.from_json_file(args.config) | |
| model = package.ManekkoModel(config) | |
| state = load_encoder_file(args.checkpoint) | |
| model.load_state_dict(state, strict=True) | |
| model.eval().save_pretrained(args.output) | |
| print(f"Exported {len(state)} encoder tensors to {args.output.resolve()}") | |
| print("Upload all exported files to the matching model repository.") | |
| if __name__ == "__main__": | |
| main() | |