Coder Social home page Coder Social logo

Comments (1)

davidberard98 avatar davidberard98 commented on September 27, 2024

Ideas:

  1. Change model code so that all tensors with the given dimension are marked as dynamic. Note: I don't this isn't as simple as just mark_dynamic() on a bunch of tensors, because we need to make sure the mark_dynamic is applied right before the graph(s) that have issues. Instead, @YuqingJ found that we can wrap the other dense tensors in NestedTensors and use their values, which is effectively the same as forcing a graph break & marking dynamic.
  2. Don't mark_dynamic: ... this means we need to fix NJT flatten/unflatten to work with non-dynamic values/offsets. Also, we may need to introduce an API to turn this on/off. Note that the API needs to be somewhat global; we need to control not only the initial construction of the NJT, but also the results of operations on NJTs (which also construct NJTs internally in their implementations in ops.py)
  3. Relax RelaxedUnspecConstraint asserts or introduce a new API in dynamic shapes: conceptually, for non-export, it seems like mark_dynamic may be too strict. In the NJT (non-export) use case, mark_dynamic is more of a suggestion to reduce the amount of recompilation we do. However, it's not necessary; and practically, in most current NJT enablement work, it's probably true that most graphs dealing with similar jagged data will be recompiling anyway. For this use case, it seems like it would be better to not assert here. Would it be reasonable to add the assert only if we're exporting, or add a different API (e.g. mark_dynamic(..., enforce=False)) which has this behavior?

from pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.