kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | 66f28e997a43b8d301cfa9b988bc90654628e780ff5377888b309d8a0fc6f7fe |
|---|---|
| Author | Ashwin Bharambe <ashwin@meta.com> · 2024-09-13 16:39 -07:00 |
| Committer | Ashwin Bharambe <ashwin@meta.com> · 2024-09-13 16:39 -07:00 |
| Parents | 394f69174ca8 |
4 files changed
modified llama_toolchain/cli/model/list.py +0 −4
| @@ -38,7 +38,6 @@ | ||
| 38 | 38 | "Model Descriptor", |
| 39 | 39 | "HuggingFace Repo", |
| 40 | 40 | "Context Length", |
| 41 | - "Hardware Requirements", | |
| 42 | 41 | ] |
| 43 | 42 | |
| 44 | 43 | rows = [] |
| @@ -46,15 +45,12 @@ | ||
| 46 | 45 | if not args.show_all and not model.is_featured: |
| 47 | 46 | continue |
| 48 | 47 | |
| 49 | - req = model.hardware_requirements | |
| 50 | - | |
| 51 | 48 | descriptor = model.descriptor() |
| 52 | 49 | rows.append( |
| 53 | 50 | [ |
| 54 | 51 | descriptor, |
| 55 | 52 | model.huggingface_repo, |
| 56 | 53 | f"{model.max_seq_length // 1024}K", |
| 57 | - f"{req.gpu_count} GPU{'s' if req.gpu_count > 1 else ''}, each >= {req.memory_gb_per_gpu}GB VRAM", | |
| 58 | 54 | ] |
| 59 | 55 | ) |
| 60 | 56 | print_table( |
modified llama_toolchain/inference/meta_reference/config.py +15 −1
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | from llama_models.datatypes import ModelFamily |
| 10 | 10 | |
| 11 | 11 | from llama_models.schema_utils import json_schema_type |
| 12 | -from llama_models.sku_list import all_registered_models | |
| 12 | +from llama_models.sku_list import all_registered_models, resolve_model | |
| 13 | 13 | |
| 14 | 14 | from pydantic import BaseModel, Field, field_validator |
| 15 | 15 | |
| @@ -41,3 +41,17 @@ | ||
| 41 | 41 | f"Unknown model: `{model}`. Choose from [\n\t{model_list}\n]" |
| 42 | 42 | ) |
| 43 | 43 | return model |
| 44 | + | |
| 45 | + @property | |
| 46 | + def model_parallel_size(self) -> int: | |
| 47 | + # HUGE HACK ALERT: this will be fixed when we move inference configuration | |
| 48 | + # to ModelsRegistry and we can explicitly ask for `model_parallel_size` | |
| 49 | + # as configuration there | |
| 50 | + gpu_count = 1 | |
| 51 | + resolved = resolve_model(self.model) | |
| 52 | + assert resolved is not None | |
| 53 | + descriptor = resolved.descriptor().lower() | |
| 54 | + if "-70b" in descriptor or "-405b" in descriptor: | |
| 55 | + gpu_count = 8 | |
| 56 | + | |
| 57 | + return gpu_count |
modified llama_toolchain/inference/meta_reference/generation.py +1 −1
| @@ -79,7 +79,7 @@ | ||
| 79 | 79 | if not torch.distributed.is_initialized(): |
| 80 | 80 | torch.distributed.init_process_group("nccl") |
| 81 | 81 | |
| 82 | - model_parallel_size = model.hardware_requirements.gpu_count | |
| 82 | + model_parallel_size = config.model_parallel_size | |
| 83 | 83 | if not model_parallel_is_initialized(): |
| 84 | 84 | initialize_model_parallel(model_parallel_size) |
| 85 | 85 |
modified llama_toolchain/inference/meta_reference/model_parallel.py +1 −1
| @@ -79,7 +79,7 @@ | ||
| 79 | 79 | |
| 80 | 80 | def __enter__(self): |
| 81 | 81 | self.group = ModelParallelProcessGroup( |
| 82 | - self.model.hardware_requirements.gpu_count, | |
| 82 | + self.config.model_parallel_size, | |
| 83 | 83 | init_model_cb=partial(init_model_cb, self.config), |
| 84 | 84 | ) |
| 85 | 85 | self.group.start() |