SYMBOL INDEX (240 symbols across 31 files) FILE: VisCPM/cpm_tokenizers/bee.py function load_vocab (line 23) | def load_vocab(fp: IO[bytes]) -> Dict[str, int]: class Token (line 36) | class Token(object): method __init__ (line 37) | def __init__(self, token: str, start: int, is_unk: bool, is_special: b... method __str__ (line 43) | def __str__(self): method __repr__ (line 48) | def __repr__(self): class CPMBeeTokenizer (line 52) | class CPMBeeTokenizer(object): method __init__ (line 53) | def __init__( method get_piece (line 79) | def get_piece(self, text: str) -> str: method vocab_size (line 89) | def vocab_size(self): method eos_id (line 93) | def eos_id(self): method bos_id (line 97) | def bos_id(self): method unk_id (line 101) | def unk_id(self): method mask_id (line 105) | def mask_id(self): method __len__ (line 108) | def __len__(self): method tokenize (line 111) | def tokenize(self, text: str) -> List[Token]: method escape (line 183) | def escape(text: str) -> str: method unescape (line 187) | def unescape(text: str) -> str: method encode (line 190) | def encode( method decode (line 212) | def decode(self, tokens: List[int], ext_table: Optional[Dict[int, str]... FILE: VisCPM/generation/generation_utils.py function top_k_top_p_filtering (line 5) | def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-floa... function apply_repetition_penalty (line 34) | def apply_repetition_penalty( class BeamHypotheses (line 69) | class BeamHypotheses: method __init__ (line 70) | def __init__(self, n_hyp, max_len, length_penalty, early_stopping): method __len__ (line 81) | def __len__(self): method add (line 87) | def add(self, hyp, sum_logprobs): method is_done (line 102) | def is_done(self, best_sum_logprobs, cur_len): FILE: VisCPM/generation/vllm_bee.py class VLLMCPMBeeGeneration (line 14) | class VLLMCPMBeeGeneration: method __init__ (line 15) | def __init__(self, model: VLU_CPMBee, tokenizer: CPMBeeTokenizer, tran... method _convert_to_tensors (line 22) | def _convert_to_tensors(self, data: Any, in_context_samples: List[Any]... method _process_list (line 137) | def _process_list(self, data_list: List[Any], max_inp_length: Optional... method generate (line 223) | def generate(self, img_list, max_inp_length: Optional[int] = None, ext... method _decode (line 283) | def _decode(self, model_inputs, other_info, **kwargs): class VLLMCPMBeeBeamSearch (line 287) | class VLLMCPMBeeBeamSearch(VLLMCPMBeeGeneration): method _decode (line 294) | def _decode( FILE: VisCPM/models/beit3.py function trunc_normal_ (line 18) | def trunc_normal_(tensor, mean=0., std=1.): function _get_base_config (line 22) | def _get_base_config( function _get_large_config (line 35) | def _get_large_config( class BEiT3Wrapper (line 48) | class BEiT3Wrapper(nn.Module): method __init__ (line 49) | def __init__(self, args, **kwargs): method fix_init_weight (line 58) | def fix_init_weight(self): method get_num_layers (line 66) | def get_num_layers(self): method no_weight_decay (line 70) | def no_weight_decay(self): method _init_weights (line 73) | def _init_weights(self, m): method forward (line 82) | def forward(self, pixel_values, query_embed=None): function beit3_large_patch16_224 (line 105) | def beit3_large_patch16_224(pretrained=False, **kwargs): FILE: VisCPM/models/cpmbee.py class CPMBeeInferenceState (line 11) | class CPMBeeInferenceState(TypedDict): class CPMBeeConfig (line 20) | class CPMBeeConfig(Config): method __init__ (line 21) | def __init__( class CPMBeeTorch (line 57) | class CPMBeeTorch(torch.nn.Module): method __init__ (line 58) | def __init__(self, config: CPMBeeConfig): method forward (line 89) | def forward( method inference (line 185) | def inference( FILE: VisCPM/models/modeling_utils.py function numpy_to_pil (line 5) | def numpy_to_pil(images): function randn_tensor (line 21) | def randn_tensor( FILE: VisCPM/models/modules/attention.py class Attention (line 22) | class Attention(torch.nn.Module): method __init__ (line 23) | def __init__( method forward (line 51) | def forward( FILE: VisCPM/models/modules/blocks.py class SelfAttentionBlock (line 23) | class SelfAttentionBlock(torch.nn.Module): method __init__ (line 35) | def __init__( method forward (line 66) | def forward( class FFNBlock (line 101) | class FFNBlock(torch.nn.Module): method __init__ (line 112) | def __init__( method forward (line 140) | def forward( class TransformerBlock (line 160) | class TransformerBlock(torch.nn.Module): method __init__ (line 173) | def __init__( method forward (line 208) | def forward( FILE: VisCPM/models/modules/config.py class Config (line 7) | class Config(object): method __init__ (line 10) | def __init__(self): method from_json_file (line 14) | def from_json_file(cls, json_file: Union[str, os.PathLike], **args): method _dict_from_json_file (line 19) | def _dict_from_json_file(cls, json_file: Union[str, os.PathLike], **ar... method to_json_file (line 27) | def to_json_file(self, json_file_path: Union[str, os.PathLike]): method to_json_string (line 31) | def to_json_string(self) -> str: method to_dict (line 35) | def to_dict(self) -> Dict[str, Any]: FILE: VisCPM/models/modules/embedding.py class Embedding (line 23) | class Embedding(torch.nn.Module): method __init__ (line 24) | def __init__( method forward (line 40) | def forward(self, ids: torch.Tensor): method projection (line 51) | def projection(self, x: torch.Tensor): class EmbeddingExt (line 63) | class EmbeddingExt(torch.nn.Module): method __init__ (line 64) | def __init__( method forward (line 85) | def forward(self, ids: torch.Tensor, ids_sub: torch.Tensor): method projection (line 97) | def projection(self, x: torch.Tensor, ext_table: Optional[torch.Tensor... FILE: VisCPM/models/modules/feedforward.py class DenseGatedACT (line 21) | class DenseGatedACT(torch.nn.Module): method __init__ (line 22) | def __init__( method forward (line 45) | def forward(self, x: torch.Tensor): class FeedForward (line 62) | class FeedForward(torch.nn.Module): method __init__ (line 77) | def __init__( method forward (line 105) | def forward(self, x: torch.Tensor): FILE: VisCPM/models/modules/layernorm.py function rms_layernorm (line 5) | def rms_layernorm(hidden: torch.Tensor, weight: torch.Tensor, eps: float): class LayerNorm (line 12) | class LayerNorm(torch.nn.Module): method __init__ (line 15) | def __init__( method forward (line 29) | def forward(self, x: torch.Tensor): FILE: VisCPM/models/modules/linear.py class Linear (line 21) | class Linear(torch.nn.Module): method __init__ (line 22) | def __init__( method forward (line 38) | def forward(self, x: torch.Tensor): FILE: VisCPM/models/modules/position_embedding.py class SegmentPositionEmbedding (line 21) | class SegmentPositionEmbedding(torch.nn.Module): method __init__ (line 22) | def __init__( method forward (line 46) | def forward( method _segment_relative_position_bucket (line 97) | def _segment_relative_position_bucket(self, query_segment, key_segment): method _position_bucket (line 100) | def _position_bucket( class BucketPositionBias (line 127) | class BucketPositionBias(torch.nn.Module): method __init__ (line 128) | def __init__( method forward (line 149) | def forward( method _position_bucket (line 189) | def _position_bucket(self, relative_position, num_buckets=32, max_dist... class RotaryEmbedding (line 212) | class RotaryEmbedding(torch.nn.Module): method __init__ (line 213) | def __init__( method forward (line 229) | def forward(self, x: torch.Tensor, x_pos: torch.Tensor): FILE: VisCPM/models/modules/transformer.py class Encoder (line 23) | class Encoder(torch.nn.Module): method __init__ (line 37) | def __init__( method forward (line 84) | def forward( FILE: VisCPM/models/stablediffusion.py class CPMBeeTransBlock (line 13) | class CPMBeeTransBlock(torch.nn.Module): method __init__ (line 14) | def __init__( method forward (line 35) | def forward(self, hidden_states: torch.Tensor): class SDWrapper (line 43) | class SDWrapper(torch.nn.Module): method __init__ (line 44) | def __init__(self, image_safety_checker=True): method forward (line 64) | def forward(self, pixel_values, text_hidden_states): method generate (line 85) | def generate(self, method decode_latents (line 163) | def decode_latents(self, latents): method prepare_latents (line 171) | def prepare_latents(self, batch_size, num_channels_latents, height, wi... method numpy_to_pil (line 188) | def numpy_to_pil(self, images): method run_image_safety_checker (line 203) | def run_image_safety_checker(self, image, device, dtype): FILE: VisCPM/models/vlg_cpmbee.py class VLG_CPMBee (line 5) | class VLG_CPMBee(torch.nn.Module): method __init__ (line 6) | def __init__(self, llm, sd) -> None: method forward (line 11) | def forward(self, data): method generate (line 36) | def generate( FILE: VisCPM/models/vlu_cpmbee.py function construct_query_parameter (line 13) | def construct_query_parameter(query_k, h_size, init_weights): class CausalVLLMOutput (line 24) | class CausalVLLMOutput(ModelOutput): class VLU_CPMBee (line 32) | class VLU_CPMBee(torch.nn.Module): method __init__ (line 33) | def __init__(self, llm: CPMBeeTorch, vpm, vision_dim, query_num, devic... method get_vllm_embedding (line 56) | def get_vllm_embedding(self, data): method forward (line 80) | def forward(self, data, **kwargs): FILE: VisCPM/utils/utils.py function pad (line 23) | def pad(orig_items, key, max_length=None, padding_value=0, padding_side=... class CPMBeeCollater (line 68) | class CPMBeeCollater: method __init__ (line 76) | def __init__(self, tokenizer: CPMBeeTokenizer, max_len): method __call__ (line 82) | def __call__(self, batch): class _DictTree (line 148) | class _DictTree(TypedDict): class _PrevExtTableStates (line 157) | class _PrevExtTableStates(TypedDict): class _TransformFuncDict (line 162) | class _TransformFuncDict(TypedDict): class CPMBeeBatch (line 171) | class CPMBeeBatch(TypedDict): function rel_to_bucket (line 190) | def rel_to_bucket(n_up: int, n_down: int, max_depth: int = 8): function convert_data_to_id (line 199) | def convert_data_to_id( function identity_func (line 356) | def identity_func(img): function autocontrast_func (line 360) | def autocontrast_func(img, cutoff=0): function equalize_func (line 392) | def equalize_func(img): function rotate_func (line 416) | def rotate_func(img, degree, fill=(0, 0, 0)): function solarize_func (line 427) | def solarize_func(img, thresh=128): function color_func (line 437) | def color_func(img, factor): function contrast_func (line 459) | def contrast_func(img, factor): function brightness_func (line 472) | def brightness_func(img, factor): function sharpness_func (line 481) | def sharpness_func(img, factor): function shear_x_func (line 502) | def shear_x_func(img, factor, fill=(0, 0, 0)): function translate_x_func (line 509) | def translate_x_func(img, offset, fill=(0, 0, 0)): function translate_y_func (line 519) | def translate_y_func(img, offset, fill=(0, 0, 0)): function posterize_func (line 529) | def posterize_func(img, bits): function shear_y_func (line 537) | def shear_y_func(img, factor, fill=(0, 0, 0)): function cutout_func (line 544) | def cutout_func(img, pad_size, replace=(0, 0, 0)): function enhance_level_to_args (line 558) | def enhance_level_to_args(MAX_LEVEL): function shear_level_to_args (line 564) | def shear_level_to_args(MAX_LEVEL, replace_value): function translate_level_to_args (line 574) | def translate_level_to_args(translate_const, MAX_LEVEL, replace_value): function cutout_level_to_args (line 584) | def cutout_level_to_args(cutout_const, MAX_LEVEL, replace_value): function solarize_level_to_args (line 592) | def solarize_level_to_args(MAX_LEVEL): function none_level_to_args (line 599) | def none_level_to_args(level): function posterize_level_to_args (line 603) | def posterize_level_to_args(MAX_LEVEL): function rotate_level_to_args (line 610) | def rotate_level_to_args(MAX_LEVEL, replace_value): class RandomAugment (line 662) | class RandomAugment(object): method __init__ (line 664) | def __init__(self, N=2, M=10, isPIL=False, augs=[]): method get_random_ops (line 673) | def get_random_ops(self): method __call__ (line 677) | def __call__(self, img): function build_transform (line 689) | def build_transform(is_train, randaug=True, input_size=224, interpolatio... function _urlretrieve (line 720) | def _urlretrieve(url: str, filename: str, chunk_size: int = 1024) -> None: FILE: VisCPM/viscpm_chat.py function grid_image (line 21) | def grid_image(images: List[Image.Image]) -> Image.Image: class VisCPMChat (line 30) | class VisCPMChat(object): method __init__ (line 31) | def __init__(self, model_path, config_path=None, image_safety_checker=... method chat (line 90) | def chat(self, image, question, context='', vision_hidden_states=None): method numpy_to_pil (line 122) | def numpy_to_pil(self, images): method run_image_safety_checker (line 137) | def run_image_safety_checker(self, image, device, dtype): FILE: VisCPM/viscpm_paint.py function grid_image (line 19) | def grid_image(images: List[Image.Image]) -> Image.Image: class VisCPMPaint (line 28) | class VisCPMPaint: method __init__ (line 29) | def __init__(self, model_path, image_safety_checker=True, prompt_safet... method load_model (line 73) | def load_model(self, model_path): method build_input (line 91) | def build_input( method generate (line 163) | def generate( FILE: demo_chat.py function upload_img (line 14) | def upload_img(image,_chatbot,_app_session): function respond (line 23) | def respond( _question, _chat_bot,_app_cfg): FILE: demo_paint.py function gen_img (line 13) | def gen_img(txt, imgs): FILE: finetune/dataset/bee.py class _DictTree (line 31) | class _DictTree(TypedDict): class _PrevExtTableStates (line 40) | class _PrevExtTableStates(TypedDict): class _TransformFuncDict (line 45) | class _TransformFuncDict(TypedDict): class CPMBeeBatch (line 54) | class CPMBeeBatch(TypedDict): function rel_to_bucket (line 73) | def rel_to_bucket(n_up: int, n_down: int, max_depth: int = 8): function convert_data_to_id (line 82) | def convert_data_to_id( FILE: finetune/dataset/itembuilder.py function maybe_select_text (line 23) | def maybe_select_text(raw_text): function maybe_parse_json (line 28) | def maybe_parse_json(raw_text: str): function clean_text (line 44) | def clean_text(raw_text): function check_text_valid (line 50) | def check_text_valid(raw_text): class ItemBuilder (line 60) | class ItemBuilder(): method __init__ (line 61) | def __init__(self, transform=None): method build_item (line 64) | def build_item(self, data): class CPMBeeImageTextBuilder (line 70) | class CPMBeeImageTextBuilder(ItemBuilder): method __init__ (line 94) | def __init__(self, tokenizer: CPMBeeTokenizer, max_len, transform=None... method build_item (line 107) | def build_item(self, data): FILE: finetune/dataset/transformeddataset.py class TransformedDataset (line 8) | class TransformedDataset(Dataset): method __init__ (line 9) | def __init__(self, dataset, builder, local_image_dir='./data/coco', da... method load_raw_data (line 17) | def load_raw_data(self, dataset): method load_hf_data (line 25) | def load_hf_data(self, dataset): method __len__ (line 45) | def __len__(self): method __getitem__ (line 48) | def __getitem__(self, idx): FILE: finetune/exporter.py function export (line 10) | def export(vllm_engine, global_step, epoch, args): FILE: finetune/ft_viscpm_chat/train_viscpm_chat.py function get_dataloader (line 27) | def get_dataloader(tokenizer, args): function train (line 77) | def train(vllm_model, args): function setup_model (line 171) | def setup_model(args): function main (line 195) | def main(): FILE: finetune/initializer.py function get_args (line 27) | def get_args(): function _extract_ckpt_path (line 120) | def _extract_ckpt_path(base_dir: str): function setup (line 132) | def setup(args): function load_llm (line 154) | def load_llm(args): function load_llm_tokenizer (line 167) | def load_llm_tokenizer(args): function load_vpm (line 170) | def load_vpm(args): FILE: finetune/utils/logger.py class ShortNameFormatter (line 32) | class ShortNameFormatter(logging.Formatter): method format (line 33) | def format(self, record: logging.LogRecord): class StyleAdapter (line 42) | class StyleAdapter(logging.LoggerAdapter): method __init__ (line 43) | def __init__(self, logger, extra=None, style="default"): method _enable (line 49) | def _enable(cls): method _format (line 58) | def _format(self, *msgs, color: str = None): method log (line 71) | def log(self, level, msg, *args, **kwargs): function init_logger (line 80) | def init_logger(name="ai", filename=os.environ.get("LOG_FILE", ""), fmt=... FILE: finetune/utils/utils.py function all_gather (line 13) | def all_gather(data): function mean (line 55) | def mean(lst): function _get_rank_env (line 58) | def _get_rank_env(): function _get_local_rank_env (line 65) | def _get_local_rank_env(): function _get_world_size_env (line 72) | def _get_world_size_env(): function setup_for_distributed (line 78) | def setup_for_distributed(is_master): function stop_gradient_by_name (line 92) | def stop_gradient_by_name(name: str): function init_distributed_mode (line 99) | def init_distributed_mode(args): function is_dist_avail_and_initialized (line 137) | def is_dist_avail_and_initialized(): function get_world_size (line 145) | def get_world_size(): function get_rank (line 151) | def get_rank(): function is_main_process (line 157) | def is_main_process(): function is_contain_chinese (line 161) | def is_contain_chinese(check_str): function collect_statsd_metric (line 172) | def collect_statsd_metric(name, time_monitor): function interpolate_embed_positions (line 176) | def interpolate_embed_positions(beit3, state_dict, pos_embed_key='beit3....