MCPcopy Create free account

hub / github.com/OpenBMB/CPM-Bee / functions

Functions302 in github.com/OpenBMB/CPM-Bee

Method__len__
(self)
src/cpm_live/tokenizers/ant.py:132
Method__len__
(self)
src/cpm_live/tokenizers/bee.py:104
Method__len__
(self)
src/cpm_live/dataset/distributed_dataset.py:613
Method__len__
Number of hypotheses in the list.
src/cpm_live/generation/generation_utils.py:81
Method__len__
(self)
src/cpm_live/training_tasks/bee/pretrain.py:278
Method__len__
(self)
src/cpm_live/training_tasks/ant/pretrain.py:28
Method__repr__
(self)
src/cpm_live/tokenizers/bee.py:47
Method_convert_to_tensors
(self, input_text, task_id=2)
src/cpm_live/generation/ant.py:14
Method_decode
Beam search Args: model_inputs (dict): input ids. beam_size (int, optional, defaults to 3): beam size of beam
src/cpm_live/generation/ant.py:52
Method_decode
Top-k and top-p sampling. Args: model_inputs (dict): input ids generate_length (int, optional, defaults to 10
src/cpm_live/generation/ant.py:279
Method_decode
Beam search Args: model_inputs (dict): input ids. beam_size (int, optional, defaults to 3): beam size of beam
src/cpm_live/generation/bee.py:255
Method_empty_transform_func
(data: CPMBeeInputType, num_sample: int, r: random.Random)
src/cpm_live/training_tasks/bee/pretrain.py:394
Method_expand_mapping
( data: CPMBeeInputType, stars: List[str], path: List[str], target: List[str] )
src/cpm_live/training_tasks/bee/pretrain.py:309
Function_mixed_dataset_process
( config_path: str, q_cmd: multiprocessing.Queue, q_cmd_out: multiprocessing.Queue, q_data: mu
src/cpm_live/training_tasks/bee/pretrain.py:742
Method_put_placeholder
(data: Any, path: List[str] = [])
src/cpm_live/generation/bee.py:21
Method_transform
(data: CPMBeeInputType)
src/cpm_live/training_tasks/bee/pretrain.py:426
Method_walk_transform_dict
(data: Union[Dict[str, Any], str], prefix: str = "")
src/cpm_live/training_tasks/bee/pretrain.py:294
Functionbmt_save
(file_path: str, model: CPMBee, export_files: Optional[List[str]] = None)
src/cpm_live/utils/export.py:38
Methodbod_id
(self)
src/cpm_live/tokenizers/ant.py:105
Methodbos_id
(self)
src/cpm_live/tokenizers/ant.py:117
Methodbos_id
(self)
src/cpm_live/tokenizers/bee.py:93
Methodcheck
(self, token)
src/cpm_live/tokenizers/ant.py:152
Methodclose
(self)
src/cpm_live/dataset/distributed_dataset.py:673
Methodclosed
(self)
src/cpm_live/training_tasks/bee/pretrain.py:979
Functioncompact_dataset
Compact the dataset, removes blocks which the files were deleted. **Note** This may affect the existing dataset state dict. Args: pa
src/cpm_live/dataset/utils.py:128
Methodconvert_ids_to_tokens
(self, ids)
src/cpm_live/tokenizers/ant.py:158
Methodconvert_tokens_to_ids
(self, tokens)
src/cpm_live/tokenizers/ant.py:155
Methoddataset
(self)
src/cpm_live/training_tasks/ant/pretrain.py:32
Methoddecode
Decode ids into a string.
src/cpm_live/tokenizers/bee.py:208
Methoddeserialize
(self, data: bytes)
src/cpm_live/dataset/serializer.py:38
Methoddeserialize
(self, data: bytes)
src/cpm_live/dataset/serializer.py:49
Methoddeserialize
(self, data: bytes)
src/cpm_live/dataset/serializer.py:60
Methodencode
( self, text: str, past_table: Dict[int, str] = {} )
src/cpm_live/tokenizers/bee.py:186
Methodeod_id
(self)
src/cpm_live/tokenizers/ant.py:109
Methodeos_id
(self)
src/cpm_live/tokenizers/ant.py:113
Methodeos_id
(self)
src/cpm_live/tokenizers/bee.py:89
Methodforward
(ctx, x: torch.Tensor, alpha: float)
src/cpm_live/utils/gradient_shrink.py:6
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch_size, seq_len, dim_norm)``): Input tensor that need to be normalized. Retu
src/cpm_live/layers/layernorm.py:30
Methodforward
Args: hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Input of self-attention block. It can be the
src/cpm_live/layers/blocks.py:67
Methodforward
Args: hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Hidden states before feed forward layer.
src/cpm_live/layers/blocks.py:141
Methodforward
Args: self_hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Input of transformer block(self-attenti
src/cpm_live/layers/blocks.py:209
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of linear layer Returns: :obj:
src/cpm_live/layers/linear.py:44
Methodforward
( self, key_pos: torch.Tensor, query_pos: torch.Tensor, key_segment: torch.Ten
src/cpm_live/layers/position_embedding.py:50
Methodforward
( self, query_pos: torch.Tensor, # (batch, len_q) key_pos: torch.Tensor, # (batch, l
src/cpm_live/layers/position_embedding.py:156
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(..., dim)``): Inputs. x_pos (:obj:`torch.Tensor` of shape ``(...)``): Positi
src/cpm_live/layers/position_embedding.py:236
Methodforward
This model inherits from bmt.DistributedModule. Args: hidden_q (:obj:`torch.Tensor` of shape ``(batch, len_q, dim_model)``): Indic
src/cpm_live/layers/attention.py:52
Methodforward
Args: hidden-states (:obj:`torch.Tensor` of shape ``(batch, seq_enc, dim_model)``): Input of encoder, might be the embedding of a
src/cpm_live/layers/transformer.py:87
Methodforward
Args: ids (:obj:`torch.Tensor` of shape ``(batch_size, seq_len)``): Indices of input sequence tokens. Return:
src/cpm_live/layers/embedding.py:44
Methodforward
Args: ids (:obj:`torch.Tensor` of shape ``(batch_size, seq_len)``): Indices of input sequence tokens. ids (:obj:`torc
src/cpm_live/layers/embedding.py:92
Methodforward
This model inherits from bmt.DistributedModule. Transform an input tensor from one feature space to another via a nonlinear operation
src/cpm_live/layers/feedforward.py:46
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of feed-forward module. Return:
src/cpm_live/layers/feedforward.py:107
Methodforward
( self, input: torch.Tensor, # (batch, seqlen) length: torch.Tensor, # (batch)
src/cpm_live/models/ant.py:114
Methodforward
( self, input: torch.Tensor, # (batch, seqlen) int32 input_sub: torch.Tensor, # (bat
src/cpm_live/models/bee_torch.py:55
Methodforward
( self, input: torch.Tensor, # (batch, seqlen) length: torch.Tensor, # (batch)
src/cpm_live/models/ant_torch.py:69
Methodforward
( self, input: torch.Tensor, # (batch, seqlen) int32 input_sub: torch.Tensor, # (bat
src/cpm_live/models/bee.py:104
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch_size, seq_len, dim_norm)``): Input tensor that need to be normalized. Retu
src/cpm_live/native_layers/layernorm.py:29
Methodforward
Args: hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Input of self-attention block. It can be the
src/cpm_live/native_layers/blocks.py:66
Methodforward
Args: hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Hidden states before feed forward layer.
src/cpm_live/native_layers/blocks.py:140
Methodforward
Args: self_hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Input of transformer block(self-attenti
src/cpm_live/native_layers/blocks.py:208
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of linear layer Returns: :obj:
src/cpm_live/native_layers/linear.py:38
Methodforward
( self, key_pos: torch.Tensor, query_pos: torch.Tensor, key_segment: torch.Ten
src/cpm_live/native_layers/position_embedding.py:46
Methodforward
( self, query_pos: torch.Tensor, # (batch, len_q) key_pos: torch.Tensor, # (batch, l
src/cpm_live/native_layers/position_embedding.py:149
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(..., dim)``): Inputs. x_pos (:obj:`torch.Tensor` of shape ``(...)``): Positi
src/cpm_live/native_layers/position_embedding.py:229
Methodforward
Args: hidden_q (:obj:`torch.Tensor` of shape ``(batch, len_q, dim_model)``): Indices of input sequence tokens. It will be embedde
src/cpm_live/native_layers/attention.py:51
Methodforward
Args: hidden-states (:obj:`torch.Tensor` of shape ``(batch, seq_enc, dim_model)``): Input of encoder, might be the embedding of a
src/cpm_live/native_layers/transformer.py:84
Methodforward
Args: ids (:obj:`torch.Tensor` of shape ``(batch_size, seq_len)``): Indices of input sequence tokens. Return:
src/cpm_live/native_layers/embedding.py:40
Methodforward
Args: ids (:obj:`torch.Tensor` of shape ``(batch_size, seq_len)``): Indices of input sequence tokens. ids (:obj:`torc
src/cpm_live/native_layers/embedding.py:85
Methodforward
Transform an input tensor from one feature space to another via a nonlinear operation Args: x (:obj:`torch.Tensor` of shape ``(ba
src/cpm_live/native_layers/feedforward.py:45
Methodforward
Args: x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of feed-forward module. Return:
src/cpm_live/native_layers/feedforward.py:105
Methodgenerate
(self, data_list, **kwargs)
src/cpm_live/generation/bee.py:214
Methodinference
( self, input: torch.Tensor, # (batch, len_q) int32 input_sub: torch.Tensor, # (batc
src/cpm_live/models/bee_torch.py:137
Methodinference
( self, input: torch.Tensor, # (batch, seqlen) length: torch.Tensor, # (batch)
src/cpm_live/models/ant_torch.py:111
Methodinference
( self, input: torch.Tensor, # (batch, len_q) int32 input_sub: torch.Tensor, # (batc
src/cpm_live/models/bee.py:186
Functionjson_save
(file_path: str, obj: object, export_files: Optional[List[str]] = None)
src/cpm_live/utils/export.py:52
Methodload_state_dict
Load dataset state. Args: state (dict): dataset state dict. strict (bool): If `strict` is True, world size needs to b
src/cpm_live/dataset/distributed_dataset.py:467
Functionmask_dataset
Mask one file in dataset. Blocks in masked datasets won't be read later. Args: path (str): path to dataset dbname (str): file nam
src/cpm_live/dataset/utils.py:173
Methodmask_id
(self)
src/cpm_live/tokenizers/bee.py:101
Functionmerge_dataset
(dst: str, src: str)
src/cpm_live/dataset/utils.py:200
Methodnblocks
(self)
src/cpm_live/dataset/distributed_dataset.py:666
Methodnbytes
(self)
src/cpm_live/dataset/distributed_dataset.py:584
Methodnbytes
(self)
src/cpm_live/dataset/distributed_dataset.py:662
Methodnewline_id
(self)
src/cpm_live/tokenizers/ant.py:129
Methodnlines
(self)
src/cpm_live/dataset/distributed_dataset.py:670
Methodpad_id
(self)
src/cpm_live/tokenizers/ant.py:121
Methodprojection
Projection based on embedding's weight. For example, embedding map vocab_size to embed_size, than projection map embed_size back to vocab_siz
src/cpm_live/layers/embedding.py:104
Methodprojection
Projection based on embedding's weight. For example, embedding map vocab_size to embed_size, than projection map embed_size back to vocab_siz
src/cpm_live/native_layers/embedding.py:51
Methodprojection
Projection based on embedding's weight. For example, embedding map vocab_size to embed_size, than projection map embed_size back to vocab_siz
src/cpm_live/native_layers/embedding.py:97
Methodread
Read a piece of data from dataset. Workers in different ranks will read different data.
src/cpm_live/dataset/distributed_dataset.py:548
Functionrename_if_exists_decorator
(func)
src/cpm_live/utils/export.py:29
Methodserialize
(self, obj)
src/cpm_live/dataset/serializer.py:35
Methodserialize
(self, obj)
src/cpm_live/dataset/serializer.py:46
Methodserialize
(self, obj)
src/cpm_live/dataset/serializer.py:57
Methodstate_dict
Returns a state dict representing the read states of the dataset. Example: >>> state = dataset.state_dict() >>> datas
src/cpm_live/dataset/distributed_dataset.py:419
Methodto_json_file
(self, json_file_path: Union[str, os.PathLike])
src/cpm_live/utils/config.py:67
Methodtokenize
(self, token)
src/cpm_live/tokenizers/ant.py:41
Functiontorch_save
(file_path: str, obj: object, export_files: Optional[List[str]] = None)
src/cpm_live/utils/export.py:45
Methodunescape
(text: str)
src/cpm_live/tokenizers/bee.py:183
Methodunk_id
(self)
src/cpm_live/tokenizers/ant.py:125
Methodunk_id
(self)
src/cpm_live/tokenizers/bee.py:97
Methodvocab_size
(self)
src/cpm_live/tokenizers/ant.py:101
← previousnext →201–300 of 302, ranked by callers