CausalEditor¶
- class linear_relational.CausalEditor(model, tokenizer, concepts, layer_matcher=None)[source]¶
Modify model activations during inference to swap concepts
- concepts¶
- property device¶
- layer_matcher¶
- layer_name_to_num¶
- model¶
- swap_subject_concepts_and_predict_all_token_probs_bulk(requests, magnitude_multiplier=1.0, edit_single_layer=False, use_remove_concept_projection_magnitude=False, batch_size=12, show_progress=False)[source]¶
- swap_subject_concepts_and_predict_greedy(text, subject, remove_concept, add_concept, edit_single_layer=False, predict_num_tokens=1, magnitude_multiplier=1.0, use_remove_concept_projection_magnitude=False)[source]¶
- swap_subject_concepts_and_predict_greedy_bulk(requests, edit_single_layer=False, magnitude_multiplier=1.0, use_remove_concept_projection_magnitude=False)[source]¶
- swap_subject_concepts_and_predict_tokens_greedy_bulk(requests, edit_single_layer, magnitude_multiplier=1.0, use_remove_concept_projection_magnitude=False, batch_size=12, show_progress=False)[source]¶
- tokenizer¶