MCPcopy Create free account
hub / github.com/BeastyZ/ConvSearch-R1 / hf_processor

Function hf_processor

verl/verl/utils/tokenizer.py:62–80  ·  view source on GitHub ↗

Create a huggingface processor to process multimodal data. Args: name_or_path (str): The name of the processor. Returns: transformers.ProcessorMixin: The pretrained processor.

(name_or_path, **kwargs)

Source from the content-addressed store, hash-verified

60
61
62def hf_processor(name_or_path, **kwargs):
63 """Create a huggingface processor to process multimodal data.
64
65 Args:
66 name_or_path (str): The name of the processor.
67
68 Returns:
69 transformers.ProcessorMixin: The pretrained processor.
70 """
71 from transformers import AutoProcessor
72 try:
73 processor = AutoProcessor.from_pretrained(name_or_path, **kwargs)
74 except Exception:
75 processor = None
76 # Avoid load tokenizer, see:
77 # https://github.com/huggingface/transformers/blob/v4.49.0/src/transformers/models/auto/processing_auto.py#L344
78 if processor is not None and "Processor" not in processor.__class__.__name__:
79 processor = None
80 return processor

Callers 3

runMethod · 0.90

Calls 1

from_pretrainedMethod · 0.80

Tested by

no test coverage detected