MCPcopy Create free account

hub / github.com/allenai/RL4LMs / functions

Functions555 in github.com/allenai/RL4LMs

↓ 2 callersMethodis_encoder_decoder
(self, model)
rl4lms/envs/text_generation/policy.py:259
↓ 2 callersMethodis_encoder_decoder
(self, model: PreTrainedModel)
rl4lms/envs/text_generation/policy/base_policy.py:175
↓ 2 callersMethodload_cache
(self)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:207
↓ 2 callersMethodnormalize_text
(cls, text, strip: bool)
rl4lms/data_pools/custom_text_generation_pools.py:292
↓ 2 callersFunctionprecook
Takes a string as input and returns an object that can be given to either cook_refs or cook_test. This is optional: cook_refs and cook_test
rl4lms/envs/text_generation/caption_metrics/cider.py:14
↓ 2 callersMethodpredict
Get the policy action and state from an observation (and optional state). Includes sugar-coating to handle different observations (e.
rl4lms/algorithms/common/maskable/policies.py:213
↓ 2 callersMethodreward_increasing_numbers_in_text
(gen_text: str, min_tokens: int)
rl4lms/envs/text_generation/test_reward.py:23
↓ 2 callersMethodsample
r""" Generates sequences of token ids for models with a language modeling head using **multinomial sampling** and can be used for text
rl4lms/envs/text_generation/hf_generation_utils.py:1787
↓ 2 callersMethodsave_auto_model
(self, model: AutoModel)
rl4lms/envs/text_generation/logging_utils.py:150
↓ 2 callersMethodsave_cache
(self)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:202
↓ 2 callersMethodsplit_paragraphs
(self, text)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:112
↓ 2 callersMethodsplit_sentences
(self, text)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:100
↓ 2 callersMethodsplit_text
(self, text, granularity="sentence")
rl4lms/envs/text_generation/summ_metrics/summa_c.py:119
↓ 2 callersMethodstep
(self, action: int)
rl4lms/envs/text_generation/env.py:104
↓ 2 callersMethodto_dict
For stable baselines (only return tensor items)
rl4lms/envs/text_generation/observation.py:37
↓ 2 callersMethodtokenize
(self, dict)
rl4lms/envs/text_generation/caption_metrics/cider.py:222
↓ 2 callersMethodtokenize
(self, dict)
rl4lms/envs/text_generation/caption_metrics/spice/spice.py:36
↓ 2 callersMethodtrain
Update policy using the currently gathered rollout buffer (one gradient step over whole data).
rl4lms/algorithms/a2c/a2c.py:127
↓ 2 callersMethodupdate
(self, item: Any, priority: float)
rl4lms/core_components/sampler.py:33
↓ 1 callersMethod__init__
(self, observation_space: DictSpace, action_space: Discrete, lr_schedule: Sc
rl4lms/envs/text_generation/policy.py:26
↓ 1 callersMethod__init__
(self, data, tokenizer)
rl4lms/envs/text_generation/preference_reward.py:91
↓ 1 callersMethod__init__
( self, observation_space: DictSpace, action_space: Discrete, lr_schedule: Sch
rl4lms/envs/text_generation/policy/causal_policy.py:38
↓ 1 callersMethod__init__
( self, observation_space: DictSpace, action_space: Discrete, lr_schedule: Sch
rl4lms/envs/text_generation/policy/seq2seq_policy.py:36
↓ 1 callersMethod__init__
(self, model_name="mnli", granularity="paragraph", op1="max", op2="mean", use_ent=True, use_con=True, imager_l
rl4lms/envs/text_generation/summ_metrics/summa_c.py:357
↓ 1 callersMethod__init__
(self, *args, **kwargs)
rl4lms/algorithms/common/maskable/buffers.py:51
↓ 1 callersMethod__init__
( self, mask_model, action_space, top_mask, apply_model_parallel,
rl4lms/algorithms/common/maskable/logits_processor.py:14
↓ 1 callersMethod_add_to_buffer
( self, rollout_buffer, episode_wise_transitions, rollout_info )
rl4lms/envs/text_generation/alg_wrappers.py:290
↓ 1 callersMethod_build
Create the networks and the optimizer. :param lr_schedule: Learning rate schedule lr_schedule(1) is the initial learning
rl4lms/algorithms/common/maskable/policies.py:154
↓ 1 callersMethod_build_mlp_extractor
Create the policy and value networks. Part of the layers can be shared.
rl4lms/algorithms/common/maskable/policies.py:139
↓ 1 callersMethod_build_model_heads
(self, model_name: str)
rl4lms/envs/text_generation/policy.py:50
↓ 1 callersMethod_build_model_heads
(self, model_name: str)
rl4lms/envs/text_generation/policy.py:586
↓ 1 callersMethod_build_model_heads
Builds policy and value models and sets self._policy_model and self._value_model
rl4lms/envs/text_generation/policy/base_policy.py:270
↓ 1 callersMethod_build_model_heads
(self, model_name: str)
rl4lms/envs/text_generation/policy/causal_policy.py:68
↓ 1 callersMethod_build_model_heads
(self, model_name: str)
rl4lms/envs/text_generation/policy/seq2seq_policy.py:66
↓ 1 callersMethod_can_retrieve_inputs_from_name
If `inputs` is None and `name` is in both forward function and keyword arguments, then inputs can be retrieved from name
rl4lms/envs/text_generation/hf_generation_utils.py:455
↓ 1 callersMethod_compute_actor_grad
Compute actor gradients for kl div and surrogate objectives. :param kl_div: The KL divergence objective :param policy_object
rl4lms/algorithms/trpo/trpo.py:172
↓ 1 callersMethod_get_action_masks
(self, input_ids: torch.tensor, attention_mask: torch.tensor)
rl4lms/envs/text_generation/policy.py:643
↓ 1 callersMethod_get_action_masks
(self, model_inputs, decoder_attn_mask)
rl4lms/envs/text_generation/policy.py:968
↓ 1 callersMethod_get_action_masks
( self, input_ids: torch.tensor, attention_mask: torch.tensor )
rl4lms/envs/text_generation/policy/causal_policy.py:386
↓ 1 callersMethod_get_action_masks
(self, model_inputs, decoder_attn_mask)
rl4lms/envs/text_generation/policy/seq2seq_policy.py:511
↓ 1 callersMethod_get_action_masks
( self, input_ids: torch.Tensor, scores: torch.FloatTensor, model_inputs: dict
rl4lms/algorithms/common/maskable/logits_processor.py:65
↓ 1 callersMethod_get_action_masks
( self, input_ids: torch.Tensor, scores: torch.FloatTensor, model_inputs: dict
rl4lms/algorithms/common/maskable/logits_processor.py:209
↓ 1 callersMethod_get_decoder_start_token_id
(self, decoder_start_token_id: int = None, bos_token_id: int = None)
rl4lms/envs/text_generation/hf_generation_utils.py:554
↓ 1 callersMethod_get_logits_processor
This class returns a [`LogitsProcessorList`] list object that contains all relevant [`LogitsProcessor`] instances used to modify the
rl4lms/envs/text_generation/hf_generation_utils.py:686
↓ 1 callersMethod_get_meteor_scores
(self, gen: str, references: List[str])
rl4lms/envs/text_generation/preference_reward.py:214
↓ 1 callersMethod_get_missing_concepts
(self, gen: str, concepts: List[str])
rl4lms/envs/text_generation/preference_reward.py:206
↓ 1 callersMethod_get_samples
(self, batch_inds: np.ndarray, env: Optional[VecNormalize] = None)
rl4lms/algorithms/common/maskable/buffers.py:109
↓ 1 callersMethod_get_samples
(self, batch_inds: np.ndarray, env: Optional[VecNormalize] = None)
rl4lms/algorithms/common/maskable/buffers.py:214
↓ 1 callersMethod_get_stopping_criteria
( self, max_length: Optional[int], max_time: Optional[float], stopping_criteria: Optional[StoppingCrit
rl4lms/envs/text_generation/hf_generation_utils.py:791
↓ 1 callersMethod_init
(self)
rl4lms/envs/text_generation/logging_utils.py:34
↓ 1 callersMethod_init_callback
:param callback: Callback(s) called at every step with state of the algorithm. :param eval_freq: How many steps between evaluations;
rl4lms/algorithms/nlpo/nlpo.py:181
↓ 1 callersFunction_lcs
Computes the length of the LCS between two seqs. The implementation below uses a DP programming algorithm and runs in O(nm) time where n = le
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:251
↓ 1 callersFunction_len_lcs
Returns the length of the Longest Common Subsequence between two seqs. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:234
↓ 1 callersFunction_ngrams
Yields all ngrams of given order in sequence.
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:278
↓ 1 callersMethod_predict
Get the action according to the policy for a given observation. :param observation: :param deterministic: Whether to use sto
rl4lms/algorithms/common/maskable/policies.py:197
↓ 1 callersMethod_prepare_attention_mask_for_generation
( self, inputs: torch.Tensor, pad_token_id: int, eos_token_id: int, )
rl4lms/envs/text_generation/hf_generation_utils.py:497
↓ 1 callersMethod_prepare_decoder_input_ids_for_generation
( self, batch_size: int, decoder_start_token_id: int = None, bos_token_id: int
rl4lms/envs/text_generation/hf_generation_utils.py:539
↓ 1 callersMethod_prepare_input_ids_for_generation
( self, bos_token_id: Optional[int], encoder_outputs: Optional[ModelOutput] )
rl4lms/envs/text_generation/hf_generation_utils.py:484
↓ 1 callersMethod_prepare_inputs_for_model
( self, model: Union[AutoModelForCausalLM, AutoModelForSeq2SeqLM], input_ids: torch.Te
rl4lms/algorithms/common/maskable/logits_processor.py:45
↓ 1 callersMethod_rouge_max_over_ground_truths
Computes max of Rouge-L (https://github.com/allenai/unifiedqa/blob/bad6ef339db6286f0d8bd0661a2daeeb0f800f59/evaluation/evaluate_narrativeqa.p
rl4lms/envs/text_generation/metric.py:560
↓ 1 callersMethod_set_spaces
(self, observation_featurizer: BaseObservationFeaturizer)
rl4lms/envs/common/base_env.py:101
↓ 1 callersMethod_setup
(self)
rl4lms/envs/text_generation/training_utils.py:151
↓ 1 callersMethod_setup
(self)
rl4lms/envs/text_generation/training_utils.py:259
↓ 1 callersMethod_setup_learn
Initialize different variables needed for training. :param total_timesteps: The total number of samples (env steps) to train on
rl4lms/algorithms/nlpo/nlpo.py:225
↓ 1 callersMethod_setup_model
(self)
rl4lms/algorithms/nlpo/nlpo.py:143
↓ 1 callersMethod_setup_optimizer
(self, optimizer_kwargs: Dict[str, Any], weight_decay: float, optimizer_class: torch.
rl4lms/envs/text_generation/policy.py:73
↓ 1 callersMethod_setup_optimizer
(self, optimizer_kwargs: Dict[str, Any], weight_decay: float, optimizer_class: torch.
rl4lms/envs/text_generation/policy.py:617
↓ 1 callersMethod_setup_optimizer
( self, optimizer_kwargs: Dict[str, Any], weight_decay: float, optimizer_class
rl4lms/envs/text_generation/policy/base_policy.py:141
↓ 1 callersFunction_text_reference_reader
Returns list of references in both the single and multi-reference setting. Performs lowercasing and white-space tokenization on each line before
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:105
↓ 1 callersMethodactions_from_params
(self, action_logits: th.Tensor, deterministic: bool = False)
rl4lms/algorithms/common/maskable/distributions.py:158
↓ 1 callersMethodactions_from_params
(self, action_logits: th.Tensor, deterministic: bool = False)
rl4lms/algorithms/common/maskable/distributions.py:231
↓ 1 callersMethodadd
(self, item: Any, priority: float)
rl4lms/core_components/sampler.py:20
↓ 1 callersMethodadd
:param action_masks: Masks applied to constrain the choice of possible actions.
rl4lms/algorithms/common/maskable/buffers.py:72
↓ 1 callersFunctionbatcher
(iterator, batch_size=4, progress=False)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:15
↓ 1 callersMethodbeam_sample
r""" Generates sequences of token ids for models with a language modeling head using **beam search multinomial sampling** and can be u
rl4lms/envs/text_generation/hf_generation_utils.py:2394
↓ 1 callersMethodbeam_search
r""" Generates sequences of token ids for models with a language modeling head using **beam search decoding** and can be used for text
rl4lms/envs/text_generation/hf_generation_utils.py:2056
↓ 1 callersFunctionbuild_alg
(alg_config: Dict[str, Any], env: TextGenEnv, tracker: Tracker, poli
rl4lms/envs/text_generation/training_utils.py:98
↓ 1 callersFunctionbuild_env
(env_config: Dict[str, Any], reward_fn: RewardFunction, tokenizer: AutoTokenizer,
rl4lms/envs/text_generation/training_utils.py:79
↓ 1 callersFunctionbuild_metrics
(metric_configs: List[Dict[str, Any]])
rl4lms/envs/text_generation/training_utils.py:52
↓ 1 callersFunctionbuild_reward_fn
(reward_config: Dict[str, Any])
rl4lms/envs/text_generation/training_utils.py:46
↓ 1 callersMethodcollect_rollouts
( self, env: VecEnv, callback: BaseCallback, rollout_buffer: R
rl4lms/envs/text_generation/alg_wrappers.py:352
↓ 1 callersFunctioncompute_batched_rewards
( episode_wise_transitions: List[List[TransitionInfo]], reward_fn: RewardFunction )
rl4lms/envs/text_generation/alg_wrappers.py:57
↓ 1 callersMethodcompute_beam_search_raw_logits
Compute raw logits for beam search
rl4lms/envs/text_generation/hf_generation_utils.py:825
↓ 1 callersFunctioncompute_bleu
(predicted_texts: List[str], raw_tables: List[dict])
rl4lms/data_pools/task_utils/totto/eval_utils/__init__.py:48
↓ 1 callersMethodcompute_cider
(self)
rl4lms/envs/text_generation/caption_metrics/cider.py:115
↓ 1 callersMethodcompute_doc_freq
Compute term frequency for reference data. This will be used to compute idf (inverse document frequency later) The term frequ
rl4lms/envs/text_generation/caption_metrics/cider.py:102
↓ 1 callersFunctioncompute_metrics
(metrics_config_dict: List[Dict[str, Any]], samples: List[Sample], all
rl4lms/envs/text_generation/utils_supervised.py:209
↓ 1 callersFunctioncompute_parent
(predicted_texts: List[str], raw_tables: List[dict])
rl4lms/data_pools/task_utils/totto/eval_utils/__init__.py:9
↓ 1 callersMethodcompute_score
(self, option=None, verbose=0)
rl4lms/envs/text_generation/caption_metrics/cider.py:193
↓ 1 callersMethodcompute_score
(self, gts, res)
rl4lms/envs/text_generation/caption_metrics/spice/spice.py:49
↓ 1 callersFunctionconjugate_gradient_solver
Finds an approximate solution to a set of linear equations Ax = b Sources: - https://github.com/ajlangley/trpo-pytorch/blob/master/conj
rl4lms/algorithms/common/algo_utils.py:74
↓ 1 callersMethodconstrained_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **constrained beam search decoding** and can be u
rl4lms/envs/text_generation/hf_generation_utils.py:3123
↓ 1 callersFunctioncook_refs
Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them
rl4lms/envs/text_generation/caption_metrics/cider.py:32
↓ 1 callersFunctioncook_test
Takes a test sentence and returns an object that encapsulates everything that BLEU needs to know about it. :param test: list of string : hypot
rl4lms/envs/text_generation/caption_metrics/cider.py:43
↓ 1 callersMethodcopy
copy the refs.
rl4lms/envs/text_generation/caption_metrics/cider.py:57
↓ 1 callersFunctiondict_hash
MD5 hash of a dictionary.
rl4lms/core_components/sweep.py:62
↓ 1 callersMethoddone
(self)
rl4lms/envs/text_generation/logging_utils.py:146
↓ 1 callersFunctionevaluate_on_samples
(model: PreTrainedModel, tokenizer: AutoTokenizer, samples: Li
rl4lms/envs/text_generation/utils_supervised.py:22
↓ 1 callersFunctionevaluate_on_samples
( policy: BasePolicy, tokenizer: AutoTokenizer, samples: List[Sample], batch_size: int, ma
rl4lms/envs/text_generation/evaluation_utils.py:21
↓ 1 callersFunctionevaluate_policy
Runs policy for ``n_eval_episodes`` episodes and returns average reward. If a vector env is passed in, this divides the episodes to evaluate
rl4lms/algorithms/common/maskable/evaluation.py:13
← previousnext →101–200 of 555, ranked by callers