Slightly improve the sampler to skip unnecessary steps (#6956)
This commit is contained in:
@@ -1928,16 +1928,18 @@ def next_power_of_2(n: int):
|
||||
setattr(triton, "next_power_of_2", next_power_of_2)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def empty_context(*args, **kwargs):
|
||||
try:
|
||||
# Setup code goes here
|
||||
yield
|
||||
finally:
|
||||
# Cleanup code goes here
|
||||
class EmptyContextManager:
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
pass
|
||||
|
||||
|
||||
def empty_context(*args, **kwargs):
|
||||
return EmptyContextManager()
|
||||
|
||||
|
||||
def add_prefix(name: str, prefix: str) -> str:
|
||||
"""Add a weight path prefix to a module name.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user