mirror of
https://github.com/huggingface/accelerate.git
synced 2025-11-13 19:04:39 +08:00
Compare commits
4 Commits
v0.22-rele
...
v0.13.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d0a3eeaf7 | |||
| 2a810a0ebd | |||
| 0f3828a4a0 | |||
| 2ef7973baf |
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ extras["sagemaker"] = [
|
||||
|
||||
setup(
|
||||
name="accelerate",
|
||||
version="0.13.0",
|
||||
version="0.13.2",
|
||||
description="Accelerate",
|
||||
long_description=open("README.md", "r", encoding="utf-8").read(),
|
||||
long_description_content_type="text/markdown",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# There's no way to ignore "F401 '...' imported but unused" warnings in this
|
||||
# module, but to preserve other warnings. So, don't check this module at all.
|
||||
|
||||
__version__ = "0.13.0"
|
||||
__version__ = "0.13.2"
|
||||
|
||||
from .accelerator import Accelerator
|
||||
from .big_modeling import cpu_offload, disk_offload, dispatch_model, init_empty_weights, load_checkpoint_and_dispatch
|
||||
|
||||
@ -35,6 +35,7 @@ def get_cluster_input():
|
||||
|
||||
machine_rank = 0
|
||||
num_machines = 1
|
||||
num_processes = 1
|
||||
gpu_ids = None
|
||||
main_process_ip = None
|
||||
main_process_port = None
|
||||
@ -294,12 +295,6 @@ def get_cluster_input():
|
||||
default=1,
|
||||
error_message="Please enter an integer.",
|
||||
)
|
||||
|
||||
if distributed_type in [DistributedType.MULTI_GPU, DistributedType.NO] and not use_cpu:
|
||||
gpu_ids = _ask_field(
|
||||
"What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:",
|
||||
default="all",
|
||||
)
|
||||
elif distributed_type in [DistributedType.FSDP, DistributedType.DEEPSPEED]:
|
||||
num_processes = _ask_field(
|
||||
"How many GPU(s) should be used for distributed training? [1]:",
|
||||
@ -310,6 +305,12 @@ def get_cluster_input():
|
||||
else:
|
||||
num_processes = 1
|
||||
|
||||
if distributed_type in [DistributedType.MULTI_GPU, DistributedType.NO] and not use_cpu:
|
||||
gpu_ids = _ask_field(
|
||||
"What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]:",
|
||||
default="all",
|
||||
)
|
||||
|
||||
if distributed_type != DistributedType.TPU:
|
||||
if distributed_type == DistributedType.DEEPSPEED and use_deepspeed_config:
|
||||
mixed_precision = "no"
|
||||
|
||||
@ -258,7 +258,7 @@ def get_max_layer_size(
|
||||
modules_to_treat = modules.copy()
|
||||
while len(modules_to_treat) > 0:
|
||||
module_name, module = modules_to_treat.pop(0)
|
||||
modules_children = list(module.named_children())
|
||||
modules_children = list(module.named_children()) if isinstance(module, torch.nn.Module) else []
|
||||
if len(modules_children) == 0 or module.__class__.__name__ in no_split_module_classes:
|
||||
# No splitting this one so we compare to the max_size
|
||||
size = module_sizes[module_name]
|
||||
|
||||
Reference in New Issue
Block a user