Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/allenai/RL4LMs
/ functions
Functions
555 in github.com/allenai/RL4LMs
⨍
Functions
555
◇
Types & classes
140
↓ 66 callers
Method
to
(self, device)
rl4lms/envs/text_generation/policy.py:249
↓ 50 callers
Method
get
(cls, metric_id: str, kwargs: Dict[str, Any])
rl4lms/envs/text_generation/registry.py:175
↓ 31 callers
Method
compute
( self, prompt_texts: List[str], generated_texts: List[str], reference_texts:
rl4lms/envs/text_generation/metric.py:533
↓ 28 callers
Method
_update_model_kwargs_for_generation
( outputs: ModelOutput, model_kwargs: Dict[str, Any], is_encoder_decoder: bool = False )
rl4lms/envs/text_generation/hf_generation_utils.py:616
↓ 28 callers
Method
log_prob
(self, actions: th.Tensor)
rl4lms/algorithms/common/maskable/distributions.py:142
↓ 24 callers
Method
proba_distribution
(self, action_logits: th.Tensor)
rl4lms/algorithms/common/maskable/distributions.py:138
↓ 23 callers
Method
split
(self, split_ratios: List[float])
rl4lms/data_pools/text_generation_pool.py:39
↓ 22 callers
Method
prepare_inputs_for_generation
Implement in subclasses of [`PreTrainedModel`] for custom behavior to prepare inputs in the generate method.
rl4lms/envs/text_generation/hf_generation_utils.py:472
↓ 15 callers
Method
to
(self, device: str)
rl4lms/envs/text_generation/policy/causal_policy.py:274
↓ 14 callers
Method
__init__
(self)
rl4lms/envs/text_generation/reward.py:560
↓ 13 callers
Method
__init__
(self, **args)
rl4lms/envs/text_generation/metric.py:556
↓ 11 callers
Method
_prepare_encoder_decoder_kwargs_for_generation
( self, inputs_tensor: torch.Tensor, model_kwargs, model_input_name: Optional[str] = None )
rl4lms/envs/text_generation/hf_generation_utils.py:516
↓ 11 callers
Method
_prepare_model_inputs
This function extracts the model-specific `inputs` for generation.
rl4lms/envs/text_generation/hf_generation_utils.py:401
↓ 11 callers
Method
entropy
(self)
rl4lms/algorithms/common/maskable/distributions.py:87
↓ 11 callers
Method
to
(self, device: str)
rl4lms/envs/text_generation/policy/seq2seq_policy.py:252
↓ 10 callers
Method
apply_masking
Eliminate ("mask out") chosen categorical outcomes by setting their probability to 0. :param masks: An optional boolean ndarray of c
rl4lms/algorithms/common/maskable/distributions.py:47
↓ 10 callers
Method
size
(self)
rl4lms/envs/text_generation/caption_metrics/cider.py:85
↓ 8 callers
Method
gen_split_name
(split: str)
rl4lms/data_pools/custom_text_generation_pools.py:105
↓ 7 callers
Method
_prepare_inputs_for_model
( self, model: AutoModelForCausalLM, input_ids: torch.tensor, model_kwargs: Op
rl4lms/envs/text_generation/policy/causal_policy.py:96
↓ 6 callers
Function
override_generation_routines
(cls)
rl4lms/envs/text_generation/hf_generation_utils.py:3481
↓ 6 callers
Function
write_table_parent_format
(tables, output_path)
rl4lms/data_pools/task_utils/totto/eval_utils/prepare_references_for_eval.py:122
↓ 5 callers
Method
_expand_inputs_for_generation
( input_ids: torch.LongTensor, expand_size: int = 1, is_encoder_decoder: bool = False,
rl4lms/envs/text_generation/hf_generation_utils.py:581
↓ 5 callers
Method
_prepare_inputs_for_model
(self, model: AutoModelForCausalLM, input_ids: torch.tensor,
rl4lms/envs/text_generation/policy.py:87
↓ 5 callers
Function
_text_reader
Returns list of lines from the text file. Performs lowercasing and white-space tokenization on each line before returning. Args: t
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:88
↓ 5 callers
Method
get
(self, batch_size: Optional[int] = None)
rl4lms/algorithms/common/maskable/buffers.py:82
↓ 5 callers
Method
load_from_dict
(self, state_dict: Dict[str, Any])
rl4lms/envs/text_generation/warm_start.py:72
↓ 5 callers
Method
log_metrics
(self, epoch: int, split_name: str, metrics_dict: Dict[str, float])
rl4lms/envs/text_generation/logging_utils.py:101
↓ 5 callers
Method
log_predictions
(self, epoch: int, split_name: str, predictions: List[Dict])
rl4lms/envs/text_generation/logging_utils.py:67
↓ 5 callers
Method
prepare
(cls, wmt_id: str, split: str, source_language: str,
rl4lms/data_pools/custom_text_generation_pools.py:353
↓ 5 callers
Method
reset
Resets the environment and starts a new episode
rl4lms/envs/text_generation/env.py:146
↓ 5 callers
Method
step
Takes a step with the given action and returns (next state, reward, done, info)
rl4lms/envs/common/base_env.py:34
↓ 4 callers
Method
__init__
( self, probs: Optional[th.Tensor] = None, logits: Optional[th.Tensor] = None,
rl4lms/algorithms/common/maskable/distributions.py:34
↓ 4 callers
Method
_prepare_inputs_for_model
(self, model: AutoModelForCausalLM, input_ids: torch.tensor,
rl4lms/envs/text_generation/policy.py:631
↓ 4 callers
Method
_reorder_cache
(self, past, beam_idx)
rl4lms/envs/text_generation/hf_generation_utils.py:645
↓ 4 callers
Method
adjust_logits_during_generation
Implement in subclasses of [`PreTrainedModel`] for custom behavior to adjust the logits in the generate method.
rl4lms/envs/text_generation/hf_generation_utils.py:478
↓ 4 callers
Method
forward
(self, *args, **kwargs)
rl4lms/envs/text_generation/policy.py:202
↓ 4 callers
Method
generate
(self, tokenizer: AutoTokenizer, texts: List[str] = None, max_prompt_length:
rl4lms/envs/text_generation/policy.py:266
↓ 4 callers
Method
get_dataset
(cls, wmt_id: str, source_language: str, target_language: str, split: str)
rl4lms/data_pools/custom_text_generation_pools.py:342
↓ 4 callers
Method
get_distribution
Get the current policy distribution given the observations. :param obs: :param action_masks: :return: the action dis
rl4lms/algorithms/common/maskable/policies.py:292
↓ 4 callers
Method
get_policy_first_device
(self)
rl4lms/envs/text_generation/policy.py:256
↓ 4 callers
Method
get_policy_first_device
(self)
rl4lms/envs/text_generation/policy.py:803
↓ 4 callers
Method
get_policy_first_device
(self)
rl4lms/envs/text_generation/policy/causal_policy.py:257
↓ 4 callers
Method
get_policy_first_device
(self)
rl4lms/envs/text_generation/policy/seq2seq_policy.py:327
↓ 4 callers
Method
log_info
(self, msg: str)
rl4lms/envs/text_generation/logging_utils.py:158
↓ 4 callers
Method
log_rollout_infos
(self, rollout_info: Dict[str, float])
rl4lms/envs/text_generation/logging_utils.py:124
↓ 3 callers
Method
_evaluate_on_datapools
(self, epoch: int, splits: List[str] = ["val", "test"])
rl4lms/envs/text_generation/training_utils.py:180
↓ 3 callers
Method
_get_action_dist_from_latent
Retrieve action distribution given the latent codes. :param latent_pi: Latent code for the actor :return: Action distributio
rl4lms/algorithms/common/maskable/policies.py:187
↓ 3 callers
Function
_get_datapool_by_split
(split: str)
rl4lms/envs/text_generation/training_utils.py:60
↓ 3 callers
Function
_read_results
(path)
rl4lms/data_pools/task_utils/totto/eval_utils/__init__.py:51
↓ 3 callers
Method
_setup_model
(self)
rl4lms/algorithms/ppo/ppo.py:168
↓ 3 callers
Method
add
(cls, id: str, metric_cls: Type[BaseMetric])
rl4lms/envs/text_generation/registry.py:181
↓ 3 callers
Method
compute_score
(self, gts, res)
rl4lms/envs/text_generation/caption_metrics/cider.py:235
↓ 3 callers
Method
evaluate_actions
Evaluate actions according to the current policy, given the observations. :param obs: :param actions: :retur
rl4lms/algorithms/common/maskable/policies.py:268
↓ 3 callers
Method
float_convert
(self, obj)
rl4lms/envs/text_generation/caption_metrics/spice/spice.py:30
↓ 3 callers
Method
forward_value
(self, obs: TensorDict, past_model_kwargs: Optional[Dict[str, torch.tensor]] = None)
rl4lms/envs/text_generation/policy.py:172
↓ 3 callers
Method
forward_value
( self, obs: TensorDict, past_model_kwargs: Optional[Dict[str, torch.tensor]] = None,
rl4lms/envs/text_generation/policy/causal_policy.py:168
↓ 3 callers
Method
get_state_dict
(self)
rl4lms/envs/text_generation/warm_start.py:65
↓ 3 callers
Method
load_from_state_dict
(self, state_dict: Dict[str, Any])
rl4lms/envs/text_generation/kl_controllers.py:30
↓ 3 callers
Method
log_training_infos
(self, training_info: Dict[str, float])
rl4lms/envs/text_generation/logging_utils.py:135
↓ 3 callers
Method
reset
(self)
rl4lms/algorithms/common/maskable/buffers.py:55
↓ 3 callers
Method
score
(self, sources, generateds, **kwargs)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:400
↓ 3 callers
Method
size
(self)
rl4lms/envs/common/action_space.py:22
↓ 3 callers
Method
step
Adapts the KL coeff
rl4lms/envs/text_generation/kl_controllers.py:10
↓ 3 callers
Method
update
Updates the observation using the given action
rl4lms/envs/text_generation/observation.py:72
↓ 3 callers
Function
write_predictions
Write predictions to file.
rl4lms/data_pools/task_utils/totto/eval_utils/prepare_predictions_for_eval.py:30
↓ 3 callers
Function
write_references
Write single and multiple references to file.
rl4lms/data_pools/task_utils/totto/eval_utils/prepare_references_for_eval.py:97
↓ 2 callers
Method
__init__
( self, observation_space: gym.spaces.Space, action_space: gym.spaces.Space, l
rl4lms/algorithms/common/maskable/policies.py:43
↓ 2 callers
Function
_add_adjusted_col_offsets
Add adjusted column offsets to take into account multi-column cells.
rl4lms/data_pools/task_utils/totto/preprocess_utils.py:20
↓ 2 callers
Method
_concat
(prompt: torch.tensor, prompt_mask: torch.tensor, context: torch.tensor, context_mask: torch.t
rl4lms/envs/text_generation/observation.py:53
↓ 2 callers
Method
_evaluate_on_datapools
(self, epoch: int, splits: List[str] = ["val", "test"])
rl4lms/envs/text_generation/training_utils.py:244
↓ 2 callers
Function
_get_heuristic_col_headers
Heuristic to find column headers.
rl4lms/data_pools/task_utils/totto/preprocess_utils.py:47
↓ 2 callers
Function
_get_heuristic_row_headers
Heuristic to find row headers.
rl4lms/data_pools/task_utils/totto/preprocess_utils.py:37
↓ 2 callers
Method
_get_logits_warper
This class returns a [`LogitsProcessorList`] list object that contains all relevant [`LogitsWarper`] instances used for multinomial s
rl4lms/envs/text_generation/hf_generation_utils.py:650
↓ 2 callers
Method
_get_recent_ckpt_path
(self, tracker: Tracker)
rl4lms/envs/text_generation/warm_start.py:94
↓ 2 callers
Method
_merge_criteria_processor_list
( self, default_list: Union[LogitsProcessorList, StoppingCriteriaList], custom_list: U
rl4lms/envs/text_generation/hf_generation_utils.py:803
↓ 2 callers
Function
_ngram_counts
Returns count of all ngrams of given order in sequence.
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:285
↓ 2 callers
Function
_normalize_text
(s)
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:81
↓ 2 callers
Function
_table_reader
Yields tables from the table file. Tables are parsed into a list of tuples with tokenized entries. Args: table_file: String filename.
rl4lms/data_pools/task_utils/totto/eval_utils/totto_parent_eval.py:145
↓ 2 callers
Function
build_datapool
(datapool_config: Dict[str, Any])
rl4lms/envs/text_generation/training_utils.py:58
↓ 2 callers
Method
build_image
(self, original, generated)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:261
↓ 2 callers
Function
build_tokenizer
(tokenizer_config: Dict[str, Any])
rl4lms/envs/text_generation/training_utils.py:34
↓ 2 callers
Method
close
(self)
rl4lms/envs/text_generation/env.py:175
↓ 2 callers
Method
compute_histogram
(self, original=None, generated=None, image=None)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:267
↓ 2 callers
Method
cook_append
called by constructor and __iadd__ to avoid creating new instances.
rl4lms/envs/text_generation/caption_metrics/cider.py:74
↓ 2 callers
Method
date_in_text
(text: str)
rl4lms/envs/text_generation/test_reward.py:56
↓ 2 callers
Function
download_file_using_url
(url: str, dest_path: str)
rl4lms/data_pools/custom_text_generation_pools.py:286
↓ 2 callers
Method
forward
(self, *args, **kwargs)
rl4lms/envs/text_generation/policy/base_policy.py:164
↓ 2 callers
Method
forward_policy
(self, obs: TensorDict, actions: torch.tensor, past_model_kwargs
rl4lms/envs/text_generation/policy.py:135
↓ 2 callers
Method
forward_value
( self, obs: TensorDict, past_model_kwargs: Optional[Dict[str, torch.tensor]] = None,
rl4lms/envs/text_generation/policy/seq2seq_policy.py:168
↓ 2 callers
Method
get_cache_file
(self)
rl4lms/envs/text_generation/summ_metrics/summa_c.py:199
↓ 2 callers
Function
get_dataset
(datapool, label="intent")
scripts/reward-modeling/evaluate_intent_classifier.py:19
↓ 2 callers
Function
get_dataset
(datapool, label="intent")
scripts/reward-modeling/train_intent_classifier.py:8
↓ 2 callers
Function
get_dict_obj
(keys: List, values: List)
rl4lms/core_components/sweep.py:7
↓ 2 callers
Function
get_generated_and_predictions
( prompt_texts: List[str], generated_texts: List[str], reference_texts: List[List[str]], split
rl4lms/envs/text_generation/metric.py:249
↓ 2 callers
Function
get_individual_scores
( prompt_texts: List[str], split_name: str, scores_dict: Dict[str, float] )
rl4lms/envs/text_generation/metric.py:266
↓ 2 callers
Method
get_language_model
(self)
rl4lms/envs/text_generation/policy.py:347
↓ 2 callers
Method
get_observation_dim
Gets the observation dimension
rl4lms/envs/common/base_env.py:60
↓ 2 callers
Method
get_policy_first_device
Returns the first device of the policy. Used in the case of model parallel
rl4lms/envs/text_generation/policy/base_policy.py:349
↓ 2 callers
Function
get_scores
Inputs: - a list of commongens to score, e.g.,: - device: which torch device to load model on, e.g., "cuda:3" Outputs: - P(
rl4lms/envs/text_generation/preference_reward.py:104
↓ 2 callers
Method
init_from_sample
(cls, sample: Sample, tokenizer: AutoTokenizer, max_input_le
rl4lms/envs/text_generation/observation.py:121
next →
1–100 of 555, ranked by callers