Image Segmentation
Transformers
grounding
instance-segmentation
polygon-prediction
baseline
research-code
Instructions to use royguw/ft_qwen3_5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use royguw/ft_qwen3_5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="royguw/ft_qwen3_5")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("royguw/ft_qwen3_5", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download scripts/convert_all.py from royguw/ft_qwen3_5: direct link, hf CLI and curl.
- Browser
- Download file 4.55 kB
-
https://huggingface.co/royguw/ft_qwen3_5/resolve/main/scripts/convert_all.py
- Command line
-
hf download hf://royguw/ft_qwen3_5/scripts/convert_all.py
-
curl -L -o convert_all.py https://huggingface.co/royguw/ft_qwen3_5/resolve/main/scripts/convert_all.py
4.55 kB
| """ | |
| Batch convert all full-mode datasets to JSONL using multiprocessing. | |
| Usage: | |
| python scripts/convert_all.py --output_dir data/ --splits train,val --seed 42 --workers 8 | |
| """ | |
| import argparse | |
| import logging | |
| import os | |
| import subprocess | |
| import sys | |
| import time | |
| from concurrent.futures import ProcessPoolExecutor, as_completed | |
| logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s") | |
| logger = logging.getLogger(__name__) | |
| # All datasets used in full training mode | |
| FULL_MODE_DATASETS = [ | |
| # allvocab | |
| "coconut_vocab_all_cat", | |
| "lvis_vocab_all_cat", | |
| # pos_neg | |
| "coconut_pos_neg", | |
| "ade20k_pos_neg", | |
| "lvis_pos_neg", | |
| # panoptic_caption | |
| "coconut_pancap", | |
| # reference | |
| "refcoco", | |
| "refcoco_plus", | |
| "refclef", | |
| ] | |
| # Eval-only datasets (val split only) | |
| EVAL_ONLY_DATASETS = [ | |
| "refcocog_baseline", | |
| "grefcoco_baseline", | |
| "coconut_pancap_baseline", | |
| ] | |
| def run_one(ds_name, split, output_file, seed, max_examples): | |
| """Run convert_dataset.py as subprocess, return (key, success, msg).""" | |
| script_path = os.path.join(os.path.dirname(__file__), "convert_dataset.py") | |
| cmd = [ | |
| sys.executable, script_path, | |
| "--dataset", ds_name, | |
| "--split", split, | |
| "--output", output_file, | |
| "--seed", str(seed), | |
| "--max_examples", str(max_examples), | |
| ] | |
| key = f"{ds_name}/{split}" | |
| t0 = time.time() | |
| try: | |
| result = subprocess.run(cmd, capture_output=True, text=True, timeout=7200) | |
| elapsed = time.time() - t0 | |
| if result.returncode == 0: | |
| # Extract summary line from stderr | |
| lines = result.stderr.strip().split("\n") | |
| summary = [l for l in lines if "Written:" in l or "Conversion complete" in l] | |
| msg = "; ".join(summary) if summary else f"done in {elapsed:.0f}s" | |
| return key, True, msg | |
| else: | |
| last_lines = result.stderr.strip().split("\n")[-3:] | |
| return key, False, "\n".join(last_lines) | |
| except subprocess.TimeoutExpired: | |
| return key, False, "TIMEOUT (2h)" | |
| except Exception as e: | |
| return key, False, str(e) | |
| def main(): | |
| parser = argparse.ArgumentParser(description="Batch convert all datasets to JSONL (parallel)") | |
| parser.add_argument("--output_dir", type=str, default="data/") | |
| parser.add_argument("--splits", type=str, default="train,val") | |
| parser.add_argument("--seed", type=int, default=42) | |
| parser.add_argument("--max_examples", type=int, default=0) | |
| parser.add_argument("--workers", type=int, default=8, | |
| help="Number of parallel conversion workers") | |
| args = parser.parse_args() | |
| os.makedirs(args.output_dir, exist_ok=True) | |
| splits = [s.strip() for s in args.splits.split(",")] | |
| # Build task list | |
| tasks = [] | |
| for ds_name in FULL_MODE_DATASETS: | |
| for split in splits: | |
| output_file = os.path.join(args.output_dir, f"{ds_name}_{split}.jsonl") | |
| tasks.append((ds_name, split, output_file)) | |
| for ds_name in EVAL_ONLY_DATASETS: | |
| output_file = os.path.join(args.output_dir, f"{ds_name}_val.jsonl") | |
| tasks.append((ds_name, "val", output_file)) | |
| # Skip already-completed files | |
| pending = [] | |
| for ds_name, split, output_file in tasks: | |
| if os.path.isfile(output_file) and os.path.getsize(output_file) > 0: | |
| logger.info(f"SKIP {ds_name}/{split} — {output_file} already exists") | |
| else: | |
| pending.append((ds_name, split, output_file)) | |
| logger.info(f"Total tasks: {len(tasks)}, pending: {len(pending)}, workers: {args.workers}") | |
| if not pending: | |
| logger.info("Nothing to do.") | |
| return | |
| t0 = time.time() | |
| success_count = 0 | |
| fail_count = 0 | |
| with ProcessPoolExecutor(max_workers=args.workers) as executor: | |
| futures = {} | |
| for ds_name, split, output_file in pending: | |
| fut = executor.submit(run_one, ds_name, split, output_file, args.seed, args.max_examples) | |
| futures[fut] = f"{ds_name}/{split}" | |
| for fut in as_completed(futures): | |
| key, ok, msg = fut.result() | |
| if ok: | |
| success_count += 1 | |
| logger.info(f"OK [{success_count}/{len(pending)}] {key}: {msg}") | |
| else: | |
| fail_count += 1 | |
| logger.error(f"FAIL {key}: {msg}") | |
| elapsed = time.time() - t0 | |
| logger.info(f"\nAll done in {elapsed:.0f}s — {success_count} succeeded, {fail_count} failed") | |
| if __name__ == "__main__": | |
| main() | |