Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/GXimingLu/Quark
/ functions
Functions
75 in github.com/GXimingLu/Quark
⨍
Functions
75
◇
Types & classes
14
↓ 9 callers
Function
reduce_mean
(value, mask, axis=None)
utils/utils.py:20
↓ 7 callers
Method
add
(self, prompts: List[str], responses: List[str], scores: List[float])
data_pool.py:13
↓ 6 callers
Method
update
(self, current, n_steps, lower_bound)
main.py:96
↓ 5 callers
Method
decode
(self, query_input_ids, response_input_ids=None)
main.py:163
↓ 4 callers
Function
reduce_sum
(value, mask, axis=None)
utils/utils.py:14
↓ 4 callers
Method
request
(self, texts: Union[str, List[str]])
utils/perspective_api.py:58
↓ 3 callers
Method
forward_pass
(self, query_input_ids: torch.Tensor, query_mask: torch.Tensor,
policy.py:149
↓ 3 callers
Function
mask_pad
(value, mask)
utils/utils.py:35
↓ 2 callers
Method
add_control_code
(self, input_ids, attention_mask)
main.py:158
↓ 2 callers
Function
batchify
(data: Iterable[T], batch_size: int)
utils/utils.py:96
↓ 2 callers
Function
collate
(dataset: Optional[pd.DataFrame], generations: List[str], responses: Iterable[Dict[str
reward.py:61
↓ 2 callers
Function
ensure_dir
(d)
utils/utils.py:91
↓ 2 callers
Method
eval
(self, step)
main.py:307
↓ 2 callers
Function
expand
(tensor, num_repeat)
sample.py:55
↓ 2 callers
Method
get_reward
(self, prompts: List[str], responses: List[str], epoch: str)
reward.py:26
↓ 2 callers
Function
load_jsonl
(file: Union[str, Path])
utils/utils.py:120
↓ 2 callers
Method
prepare_inputs_for_generation
(self, input_ids, past=None, **kwargs)
model/gpt2.py:30
↓ 2 callers
Method
sample
(self, step)
main.py:174
↓ 2 callers
Method
stop
(self)
utils/perspective_api.py:172
↓ 1 callers
Method
_make_request
(text: str, service)
utils/perspective_api.py:134
↓ 1 callers
Method
_make_service
(api_key: str)
utils/perspective_api.py:126
↓ 1 callers
Function
ceil_div
(a, b)
utils/utils.py:43
↓ 1 callers
Function
chunks
Yield successive n-sized chunks from lst.
sample.py:59
↓ 1 callers
Function
conditional_perplexity
(generations_df, model, tokenizer, device='cuda')
perplexity.py:11
↓ 1 callers
Function
distinctness
(responses, num_sample)
sample.py:65
↓ 1 callers
Function
distinctness
(generations)
utils/utils.py:76
↓ 1 callers
Function
get_args
()
arguments.py:5
↓ 1 callers
Method
get_data
(self)
data_pool.py:28
↓ 1 callers
Function
load_cache
(file: Path)
utils/utils.py:126
↓ 1 callers
Function
logits_to_entropy
(logits)
utils/utils.py:30
↓ 1 callers
Method
loss
(self, step, query_input_ids, query_mask, response_input_ids, response_mask)
main.py:240
↓ 1 callers
Function
main
()
main.py:345
↓ 1 callers
Function
make_generations_col
(generations, responses)
utils/perspective_api.py:40
↓ 1 callers
Method
print_samples
(self, queries, responses, lm_loss, logprobs, ref_logprobs, masks, step)
main.py:286
↓ 1 callers
Function
rec
(nest, prefix, into)
utils/utils.py:63
↓ 1 callers
Method
record_step_stats
(self, data)
main.py:268
↓ 1 callers
Function
reduce_std
(value, mask)
utils/utils.py:26
↓ 1 callers
Method
request_bulk
(self, corpus: Union[Iterable[str], Iterable[Tuple[str, str]]], outp
utils/perspective_api.py:85
↓ 1 callers
Function
reward_to_toxicity
(score)
reward.py:57
↓ 1 callers
Method
sample
(self, prompts: Union[str, List[str]] = None, input_ids: torch.Tensor = None,
policy.py:35
↓ 1 callers
Method
save
(self, step)
main.py:297
↓ 1 callers
Method
step
(self, step_num)
main.py:204
↓ 1 callers
Function
toxicity_to_reward
(score)
reward.py:51
↓ 1 callers
Function
unpack_scores
(response_json: dict)
utils/perspective_api.py:16
Method
__call__
(self, sequences)
main.py:45
Method
__call__
(self, sequences)
main.py:73
Method
__call__
(self, request_id: str, text: str)
utils/perspective_api.py:165
Method
__getitem__
(self, idx)
main.py:37
Method
__getitem__
(self, idx)
main.py:62
Method
__init__
(self, save_path: str, rate_limit: int, batch_size: int)
reward.py:21
Method
__init__
(self, tree_tokens, n_extra_tokens)
data_pool.py:6
Method
__init__
(self, model_name, temperature, device, reward_cond=False, tree_tokens=None)
policy.py:11
Method
__init__
(self, path)
main.py:31
Method
__init__
(self, tokenizer)
main.py:42
Method
__init__
(self, data_pool: DataPool)
main.py:56
Method
__init__
(self, tokenizer)
main.py:70
Method
__init__
(self, coef)
main.py:93
Method
__init__
(self, init_coef, target, horizon)
main.py:101
Method
__init__
(self, params: argparse.Namespace, policy: Policy, ref_poli
main.py:116
Method
__init__
(self, api_key: str = PERSPECTIVE_API_KEY, rate_limit: int = 25)
utils/perspective_api.py:52
Method
__init__
(self, out_file: Path, total: int, rate_limit: int)
utils/perspective_api.py:147
Method
__init__
(self, config)
model/gpt2.py:11
Method
__len__
(self)
main.py:34
Method
__len__
(self)
main.py:59
Function
clamp
(value, min_value, max_value)
utils/utils.py:39
Function
exact_div
(a, b)
utils/utils.py:47
Function
flatten_dict
(nested, sep='.')
utils/utils.py:62
Method
forward
r""" labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): Labels for computing the sequence classification/regression
model/gpt2.py:58
Method
get_reward
(self, prompts: List[str], responses: List[str], epoch: str)
reward.py:47
Method
perspective_worker
(cls, queue: mp.Queue, responses_file: Path, total: int, rate_limit: int)
utils/perspective_api.py:181
Method
response_callback
(request_id, response, exception)
utils/perspective_api.py:73
Function
set_seed
(seed, n_gpu)
utils/utils.py:113
Function
test_perspective_api
()
utils/perspective_api.py:188
Method
update
(self, current, n_steps, lower_bound)
main.py:106
Function
whiten
(values, masks, shift_mean=True)
utils/utils.py:54