Instructions to use mccaly/test2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mccaly/test2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="mccaly/test2")# Load model directly from transformers import AutoImageProcessor, UperNetForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("mccaly/test2") model = UperNetForSemanticSegmentation.from_pretrained("mccaly/test2") - Notebooks
- Google Colab
- Kaggle
| #!/usr/bin/env python | |
| import functools as func | |
| import glob | |
| import os.path as osp | |
| import re | |
| import numpy as np | |
| url_prefix = 'https://github.com/open-mmlab/mmsegmentation/blob/master/' | |
| files = sorted(glob.glob('../configs/*/README.md')) | |
| stats = [] | |
| titles = [] | |
| num_ckpts = 0 | |
| for f in files: | |
| url = osp.dirname(f.replace('../', url_prefix)) | |
| with open(f, 'r') as content_file: | |
| content = content_file.read() | |
| title = content.split('\n')[0].replace('#', '').strip() | |
| ckpts = set(x.lower().strip() | |
| for x in re.findall(r'https?://download.*\.pth', content) | |
| if 'mmsegmentation' in x) | |
| if len(ckpts) == 0: | |
| continue | |
| _papertype = [x for x in re.findall(r'\[([A-Z]+)\]', content)] | |
| assert len(_papertype) > 0 | |
| papertype = _papertype[0] | |
| paper = set([(papertype, title)]) | |
| titles.append(title) | |
| num_ckpts += len(ckpts) | |
| statsmsg = f""" | |
| \t* [{papertype}] [{title}]({url}) ({len(ckpts)} ckpts) | |
| """ | |
| stats.append((paper, ckpts, statsmsg)) | |
| allpapers = func.reduce(lambda a, b: a.union(b), [p for p, _, _ in stats]) | |
| msglist = '\n'.join(x for _, _, x in stats) | |
| papertypes, papercounts = np.unique([t for t, _ in allpapers], | |
| return_counts=True) | |
| countstr = '\n'.join( | |
| [f' - {t}: {c}' for t, c in zip(papertypes, papercounts)]) | |
| modelzoo = f""" | |
| # Model Zoo Statistics | |
| * Number of papers: {len(set(titles))} | |
| {countstr} | |
| * Number of checkpoints: {num_ckpts} | |
| {msglist} | |
| """ | |
| with open('modelzoo_statistics.md', 'w') as f: | |
| f.write(modelzoo) | |