Giter Club home page Giter Club logo

Comments (2)

javier-alvarez avatar javier-alvarez commented on July 17, 2024

Ok the issue here is sync_batchnorm=True,

if I switch it to False. It works.

Any ideas about how to convert the model to ORT after sync_batchnorm conversion happens?

from ort.

javier-alvarez avatar javier-alvarez commented on July 17, 2024

I have managed to hack it with this:

from pytorch_lightning.plugins import DDPPlugin
import torch_ort
from pytorch_lightning.overrides import LightningDistributedModule
from torch.nn import Module
from torch.nn.parallel.distributed import DistributedDataParallel
class ORTPlugin(DDPPlugin):
    def _setup_model(self, model: Module) -> DistributedDataParallel:
        """Wraps the model into a :class:`~torch.nn.parallel.distributed.DistributedDataParallel` module."""
        from onnxruntime.training.ortmodule.torch_cpp_extensions import install as ortmodule_install
        ortmodule_install.build_torch_cpp_extensions()
        model.module.model = torch_ort.ORTModule(model.module.model)
        return DistributedDataParallel(module=model, device_ids=self.determine_ddp_device_ids(), **self._ddp_kwargs)

If you have a better way to fix it please let me know.

from ort.

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.