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

Support for ScriptModule and methods #593

Merged
merged 39 commits into from
Jul 1, 2021
Merged

Support for ScriptModule and methods #593

merged 39 commits into from
Jul 1, 2021

Conversation

dfalbel
Copy link
Member

@dfalbel dfalbel commented Jun 16, 2021

We need to make sure to:

  • fix jit_trace strips names from lists of tensors #537
  • Figure out how to share code between the ScriptModule R7 class and nn_Module so we only need to provide the basic types and all the rest is managed by the same code base.
  • Assert returned modules are callable
  • Assert modules returned by script$modules are also callable
  • Make sure self$parameters_[[name]] correctly calls the register_parameter method.

Refactor the conversion from SEXP to torch::jit::Stack:

  • Add lantern functions allowing to create IValues
  • Create XPtrTorch subclasses for IValues and operators to convert from and to SEXPs
  • Create Stack from IValues, instead of directly from R objects
  • Refactor the callables creation for ScriptMethod and ScriptModule
  • Add handling of vector of doubles with XPtrTorch subclasses.
  • Add GenericDict handling types
  • Add List handling type
  • operator::SEXP() for XPtrTorchstring and support IValue <-> R character vector.
  • Support NamedTuples IValue -> R
  • Support named list R (with arbitrary types) -> GenericDict
  • Support named list R (with arbitrary types) -> NamedTuple
  • Think about how to clearly differentiate Tuple and List , NamedTuple and Dict - specially when they only contain tensors.
  • Add a custom XPtrTorch type for the traced function.
  • Fix windows builds
  • Support for NULL type when tracing
  • Improve jit documentation
  • Add jit_scalar wrapper and convert length 1 numeric vectors to lists
  • Support for optional types (probably can go in a different PR)

@dfalbel dfalbel added the lantern Use this label if your PR affects lantern so it's built in the CI label Jun 16, 2021
plumbing to allow querying parameters of a saved ScriptModule.
@dfalbel dfalbel merged commit cb1c15b into master Jul 1, 2021
@dfalbel dfalbel deleted the feature/jit-nn-module branch July 1, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lantern Use this label if your PR affects lantern so it's built in the CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jit_trace strips names from lists of tensors
1 participant