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

Add ability to change Loihi Learning Rule during runtime #542

Closed
2 of 10 tasks
JuliaA369 opened this issue Dec 19, 2022 · 5 comments
Closed
2 of 10 tasks

Add ability to change Loihi Learning Rule during runtime #542

JuliaA369 opened this issue Dec 19, 2022 · 5 comments
Assignees
Labels
0-needs-estimate Issue needs to be estimated with story points 1-feature New feature request
Milestone

Comments

@JuliaA369
Copy link

JuliaA369 commented Dec 19, 2022

Objective of issue: It would be greatly desirable if we could change parameters of a Loihi2FLearningRule during runtime, particularly for the CPU and/or GPU implimenations.

Lava version:

  • 0.6.0 (feature release)
  • 0.5.1 (bug fixes)
  • 0.5.0 (current version)
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.1.2

I'm submitting a ...

  • bug report
  • feature request
  • documentation request

Current behavior:

Expected behavior:

It would be amazing if there was something like there is for Dense synapse where you can do something like:

dense.weights.set()

Except in this case it would be providing something like:
lr.dw.set()
lr.dt.set()
lr.x1_impulse.set()
lr.x1_tau.set()
lr.y1_impulse.set()
lr.y1_tau.set()
lr.t_epoch.set()

This would allow us to perform offline trainings that we could then deploy to hardware.

Steps to reproduce:

Related code:

num_steps = 5000
du = 10
dv = 100
vth = 4900
if __name__ == "__main__":
    # Create processes
    lif1 = LIF(shape=(3, ),                         
            vth=vth,                             
            dv=dv,                              
            du=du,                              
            bias_mant=(1, 3, 2),           
            name="lif1")

    lr= Loihi2FLearningRule(dw=dw,
                               x1_impulse=x1_impulse,
                               x1_tau=x1_tau,
                               y1_impulse=y1_impulse,
                               y1_tau=y1_tau,
                               t_epoch=t_epoch)

    plast_conn = LearningDense(weights=wgt_plast_conn,
                               learning_rule=stdp,
                               name='plastic_dense')

    lif1.s_out.connect(plast_conn .s_in)
    dense.a_out.connect(lif2.a_in)

    for k in range(num_steps):

        if k > 0:
            lr.dw.set(dw_new)
            lr.x1_impulse.set(x1_impulse_new)
            lr.x1_tau.set(x1_tau_new)
            lr.y1_impulse.set(y1_impulse_new)
            lr.y1_tau.set(y1_tau_new)
            lr.t_epoch.set(t_epoch_new)
        
        lif2.run(condition=RunSteps(num_steps=10),
            run_cfg=Loihi1SimCfg(select_tag="fixed_pt"))

    lif2.stop()


Other information:

insert the output from lava debug here
@PhilippPlank PhilippPlank added the 1-feature New feature request label Dec 20, 2022
@PhilippPlank PhilippPlank added this to the Release v0.7 milestone Dec 20, 2022
@mathisrichter mathisrichter added the 0-needs-review For all new issues label Jan 3, 2023
@weidel-p
Copy link
Contributor

Thanks for this suggestion, that would be a great feature to support. It should be straight forward to implement that for the CPU/Python version but might need some work on hardware. @mz-ncl could you comment if this is possible at all?

@weidel-p weidel-p added 0-needs-estimate Issue needs to be estimated with story points and removed 0-needs-review For all new issues labels Jan 12, 2023
@JuliaA369
Copy link
Author

Thanks @weidel-p. I've edited the issue to clarify that we are requesting this for CPU (and potentially future GPU) implementations, and not for hardware.

@weidel-p
Copy link
Contributor

Hi @JuliaA369, thanks for your patience. We added this feature now in #622 which is now merged to the main branch. Please take a look.

@JuliaA369
Copy link
Author

Thanks! This is exciting! Looking forward to trying this out soon.

@tim-shea
Copy link
Contributor

@weidel-p it looks like this was fixed already. Please reopen and clarify what else needs to be done if that's not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-needs-estimate Issue needs to be estimated with story points 1-feature New feature request
Projects
None yet
Development

No branches or pull requests

6 participants