question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

some accelerator enhancements

See original GitHub issue

Hi,

My main code base have been switched to be based on accelerate for a while, it works grate! Thank you guys so much!

There are a few things I think it’s a common need.

The first is .distsibuted attributes, which is basically .num_processes > 1. I mean, it’s not a lot of works but … I’m an extremely lazy person.

def distsibuted(self):
    """
    Runs in distributed mode
    """
    return self.num_processes > 1

Besides, these two decorators are often used in my code when saving models and downloading datasets, I think it could be useful.

def on_main_process(func):
    """
    Run func on main process
    """
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        if self.is_main_process or not self.distributed:
            return func(self, *args, **kwargs)
    return wrapper


def on_local_main_process(func):
    """
    Run func on local main process
    """
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        if self.is_local_main_process or not self.distributed:
            return func(self, *args, **kwargs)
    return wrapper

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
sguggercommented, May 16, 2022

I don’t mind having wrappers on the Accelerator for those. As long as the naming is clear, it’s not a bad thing to have multiple properties/methods/context managers for different use cases 😃

0reactions
ZhiyuanChencommented, Jul 27, 2022

I believe everything has been merged now, so I’m gonna close this issue.

Thanks again for this grate work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Increase Throttle Response - Best 2022 Upgrade
Some people have the misconception that throttle response is a car's engine or air volume. This is not true, and I'm going to...
Read more >
Accelerators Allow Experts to Increase Efficiency
Any system that will be repeatedly used should cater to both new users and ... Because accelerators are enhancements to the interface, ...
Read more >
A Power Efficiency Enhancements of a Multi-Bit Accelerator for ...
A Power Efficiency Enhancements of a Multi-Bit Accelerator for Memory ... part without any further training on the original network.
Read more >
Data enhancements in education accelerator
Version 4 of the education accelerator features enhanced data model ... with the education accelerator are available to any Microsoft Power ...
Read more >
Accelerator New Features and Enhancements
You can now add comments to any guide or article page. To provide feedback and suggestions, log in with your Informatica credentials. Then,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found