Run this model with HF Jobs
Run creative-graphic-design/BASNet on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/creative-graphic-design/BASNet. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/creative-graphic-design/BASNet on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use creative-graphic-design/BASNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use creative-graphic-design/BASNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="creative-graphic-design/BASNet", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("creative-graphic-design/BASNet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload processor
Browse files16 unmodified lines1718192021222337 unmodified lines616263646566676 unmodified lines7475767778798016 unmodified linesassert isinstance(output_size, (int, tuple))self.output_size = output_sizedef __call__(self, sample):image, label = sample["image"], sample["label"]h, w = image.shape[:2]37 unmodified linesclass ToTensorLab(object):"""Convert ndarrays in sample to Tensors."""def __init__(self, flag=0):self.flag = flagdef __call__(self, sample):6 unmodified lineselse:label = label / np.max(label)# print('self.flag:', self.flag) # Default: 0# change the color spaceif self.flag == 2: # with rgb and Lab colorstmpImg = np.zeros((image.shape[0], image.shape[1], 6))16 unmodified lines1718192021222337 unmodified lines616263646566676 unmodified lines74757677787916 unmodified linesassert isinstance(output_size, (int, tuple))self.output_size = output_sizedef __call__(self, sample) -> Dict[str, np.ndarray]:image, label = sample["image"], sample["label"]h, w = image.shape[:2]37 unmodified linesclass ToTensorLab(object):"""Convert ndarrays in sample to Tensors."""def __init__(self, flag: int = 0) -> None:self.flag = flagdef __call__(self, sample):6 unmodified lineselse:label = label / np.max(label)# change the color spaceif self.flag == 2: # with rgb and Lab colorstmpImg = np.zeros((image.shape[0], image.shape[1], 6))
image_processing_basnet.py+2-3