Giter VIP home page Giter VIP logo

Comments (3)

apivovarov avatar apivovarov commented on August 11, 2024 1

core has hidden module xla_builder which has computation_from_module_proto and get_computation_hlo

import torch_xla.core.xla_builder as xb

fname = "model.hlo"
with open(fname, mode="rb") as f:
  comp = xb.computation_from_module_proto("foo", f.read())
  
print(xb.get_computation_hlo(comp))

BTW, Looks like xla_builder is hidden , at least dir(core) and "tab-tab" do not show it, but it still can be imported

import torch_xla.core as core
>>> dir(core)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'dynamo_bridge', 'xla_env_vars', 'xla_model']

from xla.

JackCaoG avatar JackCaoG commented on August 11, 2024

Looking at the JAX implementation it seems like we just need to expose a pybind(in https://github.com/pytorch/xla/blob/master/torch_xla/csrc/init_python_bindings.cpp) for XlaComputation, its constructor should be able to convert proto to HLO.

I don't know if we currently have bandwidth for that but we are happy to take contributions.

from xla.

JackCaoG avatar JackCaoG commented on August 11, 2024

oh nice finding. We added that python xla builder couple years ago but never really use it that much.

from xla.

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.