Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MultKAN.py #383

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Update MultKAN.py #383

wants to merge 11 commits into from

Conversation

rgambord
Copy link

Fix: call to save_act_in_fit() without required positional argument

Fix is for bug:
TypeError: MultKAN.recover_save_act_in_fit() missing 1 required positional argument: 'old_save_act' ... kan/MultKan.py:940

KindXiaoming and others added 11 commits July 21, 2024 20:36
Fix: call to save_act_in_fit() without required positional argument

Fix is for bug:
TypeError: MultKAN.recover_save_act_in_fit() missing 1 required positional argument: 'old_save_act'
... kan/MultKan.py:940
@francescoporta
Copy link

francescoporta commented Sep 30, 2024

Good morning,

I found some issues and some possible improvements in the MultKAN library.

The MultKAN modulus seems not to be capable to deal with "int values" of mult_arity when multiplication nodes exists. I fixed it by pre-processing the mult_arity vector as follows:

if multiplication_bool:

if isinstance(mult_arity, int):
    mult_arity_list - [[]]


        for i in range(len(width)-2):
            value = []
            for j in range(width[i+1][1]):
                value.append(mult_arity)
                
            mult_arity_list.append(value)
        
        mult_arity_list.append([])    
        mult_arity = mult_arity_list

This could be implemented directly into the KAN molulus.

Prune() not working properly with MultKAN. Fixed line 1950 as follows:
subnode_score = torch.cat([subnode_score, node_score[:, width[0]+i].unsqueeze(1).expand(out_dim, mult_arity[i])], dim=1) # Added by Francesco Porta

Automatically saving in desired format the tree plot in the function model.plot().
Added a line code that saves the model in a desired folder (line 1295):
plt.savefig(f"{folder}/{imageName}.svg", bbox_inches="tight", dpi=400) # Added by Francesco Porta
plt.close()

function get_act() not handling different devices. Solved by modifying line 2674:
self.forward(x.to(self.device))

Hope this can help someone having the same issues.

[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants