codeShare/workspace
wdv3-timm small example thing showing how to use timm to run the WD Tagger V3 models. How To Use clone the repository and enter the directory: git clone https://github.com/neggles/wdv3-timm.git cd wd3-timm Create a virtual environment and install the Python requirements. If you're using Linux, you can use the provided script: bash setup.sh Or if you're on Windows (or just want to do it manually), you can do the following: # Create virtual environment… See the full description on the dataset page: https://huggingface.co/datasets/codeShare/workspace.
025
1# wdv3-timm2 3small example thing showing how to use `timm` to run the WD Tagger V3 models.4 5## How To Use6 71. clone the repository and enter the directory:8```sh9git clone https://github.com/neggles/wdv3-timm.git10cd wd3-timm11```12 132. Create a virtual environment and install the Python requirements.14 15If you're using Linux, you can use the provided script:16```sh17bash setup.sh18```19 20Or if you're on Windows (or just want to do it manually), you can do the following:21```sh22# Create virtual environment23python3.10 -m venv .venv24# Activate it25source .venv/bin/activate26# Upgrade pip/setuptools/wheel27python -m pip install -U pip setuptools wheel28# At this point, optionally you can install PyTorch manually (e.g. if you are not using an nVidia GPU)29python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu30# Install requirements31python -m pip install -r requirements.txt32```33 343. Run the example script, picking one of the 3 models to use:35```sh36python wdv3_timm.py <swinv2|convnext|vit> path/to/image.png37```38 39Example output from `python wdv3_timm.py vit a_picture_of_ganyu.png`:40```sh41Loading model 'vit' from 'SmilingWolf/wd-vit-tagger-v3'...42Loading tag list...43Creating data transform...44Loading image and preprocessing...45Running inference...46Processing results...47--------48Caption: 1girl, horns, solo, bell, ahoge, colored_skin, blue_skin, neck_bell, looking_at_viewer, purple_eyes, upper_body, blonde_hair, long_hair, goat_horns, blue_hair, off_shoulder, sidelocks, bare_shoulders, alternate_costume, shirt, black_shirt, cowbell, ganyu_(genshin_impact)49--------50Tags: 1girl, horns, solo, bell, ahoge, colored skin, blue skin, neck bell, looking at viewer, purple eyes, upper body, blonde hair, long hair, goat horns, blue hair, off shoulder, sidelocks, bare shoulders, alternate costume, shirt, black shirt, cowbell, ganyu \(genshin impact\)51--------52Ratings:53 general: 0.82754 sensitive: 0.19955 questionable: 0.00156 explicit: 0.00157--------58Character tags (threshold=0.75):59 ganyu_(genshin_impact): 0.99160--------61General tags (threshold=0.35):62 1girl: 0.99663 horns: 0.95064 solo: 0.94765 bell: 0.91866 ahoge: 0.89767 colored_skin: 0.88168 blue_skin: 0.87269 neck_bell: 0.85470 looking_at_viewer: 0.81771 purple_eyes: 0.73472 upper_body: 0.61573 blonde_hair: 0.60974 long_hair: 0.60775 goat_horns: 0.52476 blue_hair: 0.49677 off_shoulder: 0.47278 sidelocks: 0.47079 bare_shoulders: 0.46480 alternate_costume: 0.43781 shirt: 0.42782 black_shirt: 0.41783 cowbell: 0.41584```85 