lalamo 0.6.3__tar.gz → 0.6.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lalamo-0.6.3 → lalamo-0.6.4}/PKG-INFO +1 -1
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/__init__.py +1 -1
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/main.py +18 -4
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/estimator.py +11 -9
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/PKG-INFO +1 -1
- {lalamo-0.6.3 → lalamo-0.6.4}/LICENSE +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/README.md +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/commands.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/data/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/data/huggingface_message.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/data/lalamo_completions.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/data/utils.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/message_processor.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/executorch.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/gemma2.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/gemma3.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/gpt_oss.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/lfm2.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/llama.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/llamba.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/mistral.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/modern_bert.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/qwen2.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/qwen3.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/huggingface_generation_config.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/huggingface_tokenizer_config.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/loaders/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/loaders/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/loaders/executorch.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/loaders/huggingface.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/loaders/utils.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/deepseek.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/essential_ai.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/gemma.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/gpt_oss.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/huggingface.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/lfm2.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/llama.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/llamba.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/mirai.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/mistral.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/pleias.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/polaris.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/qwen.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/model_specs/reka.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/models/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/models/classifier.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/models/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/models/language_model.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/activations.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/classifier.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/decoder.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/embedding.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/linear.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/mlp.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/mlx_interop.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/normalization.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/rope.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/attention.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/mamba.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/short_conv.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/state/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/state/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/state/kv_cache.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/state/mamba_state.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/token_mixers/state/short_conv_state.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/torch_interop.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/transformer.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/transformer_layer.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/modules/utils.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/quantization.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/registry_abc.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/safetensors.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/sampling.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/__init__.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/common.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/inference.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/ngram.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/speculator/utils.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo/utils.py +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/SOURCES.txt +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/dependency_links.txt +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/entry_points.txt +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/requires.txt +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/lalamo.egg-info/top_level.txt +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/pyproject.toml +0 -0
- {lalamo-0.6.3 → lalamo-0.6.4}/setup.cfg +0 -0
|
@@ -49,7 +49,10 @@ from lalamo.message_processor import UserMessage
|
|
|
49
49
|
from lalamo.model_import import REPO_TO_MODEL, ModelSpec
|
|
50
50
|
from lalamo.model_import.common import FileSpec
|
|
51
51
|
from lalamo.models import ClassifierModelConfig, LanguageModelConfig
|
|
52
|
-
from lalamo.speculator.estimator import
|
|
52
|
+
from lalamo.speculator.estimator import (
|
|
53
|
+
get_default_device_bytes,
|
|
54
|
+
get_usable_memory_from_bytes,
|
|
55
|
+
)
|
|
53
56
|
from lalamo.speculator.ngram import NGramSpeculator
|
|
54
57
|
from lalamo.speculator.utils import test_speculator
|
|
55
58
|
|
|
@@ -384,6 +387,7 @@ class CliTraceCallbacks(TraceCallbacks):
|
|
|
384
387
|
self.stack.close()
|
|
385
388
|
console.print(f"💾 Trace saved to [cyan]{self.output_path}[/cyan]")
|
|
386
389
|
|
|
390
|
+
|
|
387
391
|
@app.command(help="Trace a model.")
|
|
388
392
|
def trace(
|
|
389
393
|
model_path: Annotated[
|
|
@@ -557,14 +561,24 @@ def estimate_batchsize(
|
|
|
557
561
|
] = None,
|
|
558
562
|
) -> None:
|
|
559
563
|
if vram_gb is not None:
|
|
560
|
-
|
|
561
|
-
|
|
564
|
+
# note that in practice GPUs use GiB in their docs, e.g. H100 actually has 85GB of memory
|
|
565
|
+
mem_bytes = vram_gb * 1000 * 1000 * 1000
|
|
566
|
+
elif (mem_bytes := get_default_device_bytes()) is None:
|
|
562
567
|
err_console.print("Cannot get the default device's memory stats, use --vram-gb")
|
|
563
568
|
raise Exit(1)
|
|
564
569
|
|
|
570
|
+
usable_mem = get_usable_memory_from_bytes(mem_bytes)
|
|
571
|
+
|
|
565
572
|
callbacks_type = CliEstimateBatchsizeCallbacks
|
|
566
573
|
|
|
567
|
-
_estimate_batchsize(
|
|
574
|
+
_estimate_batchsize(
|
|
575
|
+
model_path,
|
|
576
|
+
usable_mem,
|
|
577
|
+
max_input_length,
|
|
578
|
+
max_output_length,
|
|
579
|
+
num_logits_per_token,
|
|
580
|
+
callbacks_type,
|
|
581
|
+
)
|
|
568
582
|
|
|
569
583
|
|
|
570
584
|
@dataclass
|
|
@@ -10,7 +10,7 @@ import jax.numpy as jnp
|
|
|
10
10
|
from lalamo.models import LanguageModel
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def get_default_device_bytes() -> int | None:
|
|
14
14
|
dynamic_allocate = False
|
|
15
15
|
|
|
16
16
|
preallocate = os.getenv("XLA_PYTHON_CLIENT_PREALLOCATE", "")
|
|
@@ -26,20 +26,22 @@ def get_default_device_memory() -> int | None:
|
|
|
26
26
|
if memory_stats is None or "bytes_limit" not in memory_stats:
|
|
27
27
|
return None
|
|
28
28
|
|
|
29
|
-
# discount by 0.98 because if you try to allocate exactly bytes_limit
|
|
30
|
-
# jax will _try_ to allocate a bit more, and then throws an OOM
|
|
31
|
-
bytes_limit = memory_stats["bytes_limit"] * 0.98
|
|
32
|
-
|
|
33
29
|
mem_fraction_raw = os.getenv("XLA_PYTHON_CLIENT_MEM_FRACTION", "")
|
|
34
30
|
try:
|
|
35
31
|
mem_fraction = float(mem_fraction_raw)
|
|
36
32
|
except ValueError:
|
|
37
33
|
mem_fraction = 0.75 # jax default https://docs.jax.dev/en/latest/gpu_memory_allocation.html
|
|
38
34
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
# 500mb is seemingly the usually observed overhead; this tries to match the actual capacity of the gpu
|
|
36
|
+
# so it should correspond to something you'd see in nvidia-smi
|
|
37
|
+
memory_limit = memory_stats["bytes_limit"] / min(mem_fraction, 1.0) + (500 * 1000 * 1000)
|
|
38
|
+
|
|
39
|
+
return get_usable_memory_from_bytes(memory_limit)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def get_usable_memory_from_bytes(limit_bytes: int) -> int:
|
|
43
|
+
# JAX allocates a bit more than it needs, so we discount it by some safety factor
|
|
44
|
+
return int(limit_bytes * 0.95)
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
def estimate_memory_from_batchsize(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lalamo-0.6.3 → lalamo-0.6.4}/lalamo/model_import/decoder_configs/huggingface/modern_bert.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|