mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-07-12 20:15:31 +08:00
feat(test): add collect test images notebook and replace BitImageProcessorFast
This commit is contained in:
@@ -15,7 +15,7 @@ def benchmark(
|
||||
import torch.nn.functional as F
|
||||
from benchmarks import run_benchmark
|
||||
from configs import cfg_manager
|
||||
from transformers import AutoImageProcessor, AutoModel, BitImageProcessorFast
|
||||
from transformers import AutoImageProcessor, AutoModel, BitImageProcessor
|
||||
from utils import get_device
|
||||
|
||||
config = cfg_manager.get()
|
||||
@@ -25,7 +25,7 @@ def benchmark(
|
||||
|
||||
model_cfg = config.model
|
||||
processor = cast(
|
||||
BitImageProcessorFast,
|
||||
BitImageProcessor,
|
||||
AutoImageProcessor.from_pretrained(model_cfg.dino_model, device_map=device),
|
||||
)
|
||||
|
||||
@@ -63,7 +63,9 @@ def benchmark(
|
||||
def encode(self, images: list) -> torch.Tensor:
|
||||
if self.compressor is None:
|
||||
return self.extract_features(images)
|
||||
tokens = self.dino(**processor(images, return_tensors="pt").to(device)).last_hidden_state
|
||||
tokens = self.dino(
|
||||
**processor(images, return_tensors="pt").to(device)
|
||||
).last_hidden_state
|
||||
_, _, bits = self.compressor(tokens)
|
||||
return bits
|
||||
|
||||
|
||||
Reference in New Issue
Block a user