<jupyter_start><jupyter_text>2- identify model typeIdentify type of model. Is it `causal` like GPT? `mlm` like BERT, or `enc-dec` like T5? We learn this by reading about the model artchitecture. In this example, deBERTa is based on BERT and so is `mlm`. 3- identify layer namesWe need the names of the embedding layer (to support attribution calculations) and the FFNN layer (to support neuron activation collection).<jupyter_code>model
# Embeddings is:
model.embeddings.word_embeddings
# The FFNN is the one with the widest output dimension
# We take the parts of the name after the layer number. In this case it's 
# intermediate.dense
model.encoder.layer[0].intermediate.dense<jupyter_output><empty_output><jupyter_text>Tokenizer<jupyter_code>ids= tokenizer('tokenization')
ids
tokenizer.convert_ids_to_tokens(ids['input_ids'])<jupyter_output><empty_output><jupyter_text>So `token_prefix` is ▁And `partial_token_prefix` is ''  Model configIf we're passing the model config directly to Ecco, it would look like this:<jupyter_code>model_config = {
    'embedding': "embeddings.word_embeddings",
    'type': 'mlm',
    'activations': ['intermediate\.dense'], #This is a regex
    'token_prefix': '▁',
    'partial_token_prefix': ''
}
ecco_model = ecco.from_pretrained(hf_model_id, 
                                  activations=True,
                                  model_config=model_config)
output.config
text = ''' Now I ask you: \n what can be expected of man since he is a being endowed with strange qualities? Shower upon him every earthly blessing, drown him in a sea of happiness, so that nothing but bubbles of bliss can be seen on the surface; give him economic prosperity, such that he should have nothing else to do but sleep, eat cakes and busy himself with the continuation of his species, and even then out of sheer ingratitude, sheer spite, man would play you some nasty trick. He would even risk his cakes and would deliberately desire the most fatal rubbish, the most uneconomical absurdity, simply to introduce into all this positive good sense his fatal fantastic element. It is just his fantastic dreams, his vulgar folly that he will desire to retain, simply in order to prove to himself--as though that were so necessary-- that men still are men and not the keys of a piano, which the laws of nature threaten to control so completely that soon one will be able to desire nothing but by the calendar. And that is not all: even if man really were nothing but a piano-key, even if this were proved to him by natural science and mathematics, even then he would not become reasonable, but would purposely do something perverse out of simple ingratitude, simply to gain his point. And if he does not find means he will contrive destruction and chaos, will contrive sufferings of all sorts, only to gain his point! He will launch a curse upon the world, and as only man can curse (it is his privilege, the primary distinction between him and other animals), may be by his curse alone he will attain his object--that is, convince himself that he is a man and not a piano-key!
'''

inputs = ecco_model.tokenizer([text], return_tensors="pt")
output = ecco_model(inputs)

nmf_1 = output.run_nmf(n_components=8) 

nmf_1.explore()
output.config<jupyter_output><empty_output><jupyter_text>model-config.yamlIf we're adding to model-config.yaml, the entry looks like this:<jupyter_code>"""

microsoft/deberta-v3-small:
    embedding: "embeddings.word_embeddings"
    type: 'mlm'
    activations:
        - 'intermediate\.dense'
    token_prefix: '▁'
    partial_token_prefix: ''

"""<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06957482054113749, 'fraction_numerical': 0.0022087244616234127, 'mean_word_length': 4.497723823975721, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '609536', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1028, 'n_tokens_neox': 997, 'n_words': 467, 'path': 'notebooks/Identifying model configuration.ipynb', 'repo_name': 'Haziqa-coder/ecco', 'size': '3622'}