MCPcopy Create free account

hub / github.com/SchwinnL/LLM_Embedding_Attack / functions

Functions37 in github.com/SchwinnL/LLM_Embedding_Attack

↓ 4 callersFunctioncreate_one_hot_and_embeddings
(tokens, embed_weights, model)
unlearning_utils.py:15
↓ 4 callersFunctionget_embedding_matrix
(model)
unlearning_utils.py:121
↓ 4 callersMethodlog
( self, logits, input_tokens, target_tokens, embeddings_attack,
embedding_attack_unlearning.py:346
↓ 3 callersMethodadjust_shape_il
(self, tensor_to_adjust, intermediate_layers)
embedding_attack_unlearning.py:182
↓ 3 callersMethodcalc_loss
(self, input_tokens, target_tokens, embeddings_attack)
embedding_attack_unlearning.py:214
↓ 3 callersFunctioncreate_one_hot_and_embeddings
(tokens, embed_weights, model)
embedding_attack_toxic.py:108
↓ 3 callersMethodforward
(self, inputs_embeds, intermediate_layers, attention_mask=None)
embedding_attack_unlearning.py:190
↓ 2 callersFunctiongenerate
(model, input_embeddings, num_tokens=50)
embedding_attack_toxic.py:69
↓ 2 callersFunctionget_embedding_matrix
(model)
embedding_attack_toxic.py:57
↓ 2 callersFunctioninit_attack_embeddings
(model, tokenizer, control_prompt, device, repeat=0)
unlearning_utils.py:37
↓ 2 callersMethodset_il_tensor
(self, intermediate_layers, add_last_layer=True)
embedding_attack_unlearning.py:159
↓ 1 callersMethodattack
(self, dataset_name, dataloader_train, dataloader_test=None)
embedding_attack_unlearning.py:566
↓ 1 callersFunctioncalc_loss
(model, embeddings, embeddings_attack, embeddings_target, targets)
embedding_attack_toxic.py:100
↓ 1 callersFunctioncreate_one_hot
(model, tokens)
unlearning_utils.py:24
↓ 1 callersFunctioncreate_pytorch_dataset_from_csv
Create a PyTorch dataset from a list of string tuples. Args: model (torch.nn.Module): The PyTorch model. tokenizer (transfor
unlearning_utils.py:192
↓ 1 callersMethodgenerate_text
(self, input_tokens, embeddings_attack, num_tokens=50, decode_input=False)
embedding_attack_unlearning.py:257
↓ 1 callersFunctionget_attention_mask
(model, input_tokens, target_tokens, embeddings_attack)
unlearning_utils.py:129
↓ 1 callersFunctionget_config
(attack_config, model_name, dataset_name, shuffle, seed, test_split)
unlearning_utils.py:281
↓ 1 callersFunctionget_experiment_path
(model_name, dataset_name)
unlearning_utils.py:292
↓ 1 callersMethodindividual_attack
(self, dataloader)
embedding_attack_unlearning.py:505
↓ 1 callersFunctionload_dataset_and_dataloader
( tokenizer, dataset_name, batch_size, csv_columns=[0, 1], test_split=0, shuffle=True, device="cuda:0" )
unlearning_utils.py:164
↓ 1 callersFunctionload_model_and_tokenizer
(model_path, tokenizer_path=None, device="cuda:0", **kwargs)
embedding_attack_toxic.py:26
↓ 1 callersFunctionload_model_and_tokenizer
(model_path, tokenizer_path=None, device="cuda:0", **kwargs)
unlearning_utils.py:80
↓ 1 callersFunctionload_tokenizer
(tokenizer_path)
unlearning_utils.py:94
↓ 1 callersMethodlogit_lense
(self, inputs_embeds, intermediate_layers, attention_mask=None)
embedding_attack_unlearning.py:200
↓ 1 callersMethodno_attack
(self, dataloader)
embedding_attack_unlearning.py:544
↓ 1 callersFunctionnum_affirmative_response
(logits_pred, target_tokens, return_sample_wise=False)
unlearning_utils.py:145
↓ 1 callersFunctionprint_result_dict
(result_dict)
unlearning_utils.py:48
↓ 1 callersFunctionrun
Embedding space attack on Llama2. String will overall look like: [fixed_prompt] + [control_prompt] + [target]
embedding_attack_toxic.py:121
↓ 1 callersFunctionrun_attack
Embedding space attack on Llama2. String will overall look like: [fixed_prompt] + [control_prompt] + [target]
embedding_attack_unlearning.py:53
↓ 1 callersFunctionsave_results
(result_dict, attack_config, model_name, dataset_name, shuffle, seed, test_split)
unlearning_utils.py:261
↓ 1 callersMethoduniversal_attack
(self, dataloader_train, dataloader_test=None)
embedding_attack_unlearning.py:443
Method__getitem__
(self, indices)
unlearning_utils.py:256
Method__init__
( self, model, tokenizer, attack_type="individual", iters=10,
embedding_attack_unlearning.py:119
Method__init__
(self, data, max_length=256)
unlearning_utils.py:249
Method__len__
(self)
unlearning_utils.py:253
Methodadd_to_dict
(key, value, num_repeats, repeat_type="list", flatten=False)
embedding_attack_unlearning.py:392