Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] add H0-mini model #770

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[feat] add H0-mini model #770

wants to merge 1 commit into from

Conversation

afilt
Copy link

@afilt afilt commented Feb 27, 2025

This PR integrates:

  • The implementation of H0-mini. The model is available on Hugging Face.
  • The implementation of UNI2-h. The model is available on Hugging Face.
  • The implementation of GPFM (to be discussed). The model is available on Github.

nox pipeline was run successfully on my local workspace.

Note:

  • H0-mini is a ViT-B model with 768 output dimensions
  • UNI2-h is a modified ViT-H model with 1,024 output dimensions

Warning:

  • GPFM implementation is not stable as it relies on querying the weights path to disk (/path/to/gpfm_checkpoint/GPFM.pt). We converted the checkpoint from the original Github into a timm compatible state dict. Let me know if you want to integrate or not this model. If so, what would be your recommendations ?

To reproduce our results, you first need to be granted access to bioptimus/H0-mini on HF. Then, simply run bash train_h0_mini.sh:

EXTRACTORS=(
    "pathology/bioptimus_h0_mini"
)

######################################################################

TASKS=(
    "bach"
    "mhist"
    "crc"
    "patch_camelyon"
)

for task in ${TASKS[*]}
do
    for extractor in ${EXTRACTORS[*]}
    do
        HF_TOKEN="****" \
        OUTPUT_ROOT="/home/owkin/project/eva_benchmarks/" \
        DATA_ROOT="/home/owkin/project/eva_data/${task}" \
        EMBEDDINGS_ROOT="/home/owkin/project/eva_embeddings/" \
        MODEL_NAME=${extractor} \
        N_DATA_WORKERS=16 \
        NORMALIZE_MEAN="[0.707223, 0.578729, 0.703617]" \
        NORMALIZE_STD="[0.211883, 0.230117, 0.177517]" \
        IN_FEATURES=768 \
        eva predict_fit --config configs/vision/pathology/offline/classification/${task}.yaml
    done    
done

######################################################################

TASKS=(
    "camelyon16_small"
    "panda_small"
)

for task in ${TASKS[*]}
do
    for extractor in ${EXTRACTORS[*]}
    do
        HF_TOKEN="****" \
        OUTPUT_ROOT="/home/owkin/project/eva_benchmarks/" \
        DATA_ROOT="/home/owkin/project/eva_data/${task}" \
        EMBEDDINGS_ROOT="/home/owkin/project/eva_embeddings/${extractor}/${task}" \
        MODEL_NAME=${extractor} \
        N_DATA_WORKERS=8 \
        NORMALIZE_MEAN="[0.707223, 0.578729, 0.703617]" \
        NORMALIZE_STD="[0.211883, 0.230117, 0.177517]" \
        IN_FEATURES=768 \
        eva predict_fit --config configs/vision/pathology/offline/classification/${task}.yaml
    done    
done

#####################################################################

TASKS=(
    "consep"
    "monusac"
)

for task in ${TASKS[*]}
do
    for extractor in ${EXTRACTORS[*]}
    do
        HF_TOKEN="****" \
        OUTPUT_ROOT="/home/owkin/project/eva_benchmarks/" \
        DATA_ROOT="/home/owkin/project/eva_data/${task}" \
        MODEL_NAME=${extractor} \
        N_DATA_WORKERS=16 \
        IN_FEATURES=768 \
        NORMALIZE_MEAN="[0.707223, 0.578729, 0.703617]" \
        NORMALIZE_STD="[0.211883, 0.230117, 0.177517]" \
        eva fit --config configs/vision/pathology/online/segmentation/${task}.yaml
    done
done

cc @nkaenzig

@afilt afilt changed the title Add H0-mini model. [feat] add H0-mini model Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant