Commit History

Guarantee completely safe memory bounds by chunking to 1024 and compiling every single layer independently, preventing the XLA scheduler from overlapping chunk lifetimes across layers
7976ec3

Akfmsk commited on

Revert padding and use a 4-chunk Memory-Efficient Attention to perfectly balance the 4.2GB peak memory and 16-node XLA graph size, compiling instantly without OOMing the TPU or Host RAM
5aa7afb

Akfmsk commited on

Fix severe XLA compiler memory leak and 10-minute hang by padding both head_dim and seq_len to multiples of 128 to perfectly satisfy the TPU Flash Attention kernel, completely eliminating the fallback graph explosion
fe892dd

Akfmsk commited on

Fix type error for Transformers 5.12+ where DynamicCache uses '.layers' instead of '.key_cache'
3f5fa6d

Akfmsk commited on

Fix type error: 'DynamicCache' object is not subscriptable by explicitly accessing .key_cache and .value_cache on newer Transformers versions
7e3f58a

Akfmsk commited on

Implement manual Memory-Efficient Attention by chunking the Query sequence dimension to forcefully bound the memory of PyTorch XLA's naive fallback kernel from 17.2 GB down to safe 1 GB blocks
2e46ef6

Akfmsk commited on

Pad head_dim from 72 to 128 to trick PyTorch XLA into mapping the attention calculation to the highly-optimized Pallas TPU Flash Attention kernel, completely avoiding the catastrophic O(N^2) memory fallback
8f6ba09

Akfmsk commited on

Trigger PyTorch XLA Flash Attention kernel natively by calling F.scaled_dot_product_attention without any explicit masks or eager math, resolving the 8.26GB Out-Of-Memory failure and restoring the chunked graph execution
d72b51f

Akfmsk commited on

Inject xm.mark_step() every 4 layers inside the Vision Model encoder to prevent PyTorch XLA from accumulating 8.3GB of intermediate activations during graph compilation and execution
703d98a

Akfmsk commited on

Defeat XLA compiler graph rewriter by injecting mathematical fusion breakers into the vision model batched matmuls, preventing XLA from aggressively flattening them back into a single massive 16416x16416 SDPA
672baa4

Akfmsk commited on

Fix massive OOM in the vision model by replacing the 16416x16416 block-diagonal attention mask with a memory-efficient batched slice SDPA
e640dfc

Akfmsk commited on

Sever XLA upper bound tracking on chunk_embeds slice to prevent the compiler from padding the attention matrix back to 16416x16416
2d02f79

Akfmsk commited on

Switch to dynamic torch.where fusion breaker to guarantee XLA algebraic simplifier cannot bypass it
3b4b10e

Akfmsk commited on

Disable PyTorch XLA dot_product_attention_fusion pattern matching by adding a mathematically invisible constant, preventing the TPU compiler from padding q_len to kv_len in the SDPA CustomCall fallback
0075ff2

Akfmsk commited on

Force eager attention mode to bypass PyTorch XLA Math SDPA padding bug which allocates a square matrix for dynamic sequence lengths
8ed3055

Akfmsk commited on

Pad final chunk to keep q_len perfectly static, preventing PyTorch XLA from bucketing q_len to 16416 and allocating a 17GB square matrix during Math SDPA
4c381d5

Akfmsk commited on

Remove forced attention_mask=None to prevent PyTorch XLA Math SDPA from allocating a full max_len^2 causal mask during generation chunks
deef94a

Akfmsk commited on

Move 16416-sized StaticCache and padded_input_ids allocations after the chunked prefill loop to prevent XLA dynamic shape padding from blowing up the Math SDPA matrix to 17GB
c0aebd8

Akfmsk commited on

Implement chunked prefill (4096 tokens per chunk) to avoid Math backend OOM on TPU
cbd3875

Akfmsk commited on

Explicitly set attention_mask=None for SDPA prefill to trigger Pallas FlashAttention and avoid OOM
1c64569

Akfmsk commited on

Fix DynamicCache iteration in transformers 5.0
40a8955

Akfmsk commited on

Fix DynamicCache indexing
cceb21b

Akfmsk commited on

Fix next_decoder_cache.to_legacy_cache() error in Qwen2Model
01e5143

Akfmsk commited on

Fix max_cache_len property conflict in LocateAnythingStaticCache
a5ae7ae

Akfmsk commited on

Fix TPU OOM by bypassing StaticCache for prefill and implementing custom caching logic without explicit 4D masks
98e1225

Akfmsk commited on

Safely retrieve max_cache_length in Qwen2ForCausalLM
6ef731e

Akfmsk commited on

Use get_seq_length() instead of seen_tokens in Qwen2ForCausalLM
00c4f1b

Akfmsk commited on

Call post_init in LocateAnythingForConditionalGeneration constructor
aa5099a

Akfmsk commited on

Remove _tied_weights_keys from Qwen2ForCausalLM
cf5963c

Akfmsk commited on

Use getattr for pad_token_id in Qwen2Model
306fd68

Akfmsk commited on

Set default attention implementation to sdpa
d208661

Akfmsk commited on

Use relative import for Qwen2Config in configuration_locateanything.py
e5f776d

Akfmsk commited on

Set _MAGI_AVAILABLE = False in modeling_qwen2.py
e125991

Akfmsk commited on

Restore _CONFIG_FOR_DOC and other doc strings in modeling_qwen2.py
75157c2

Akfmsk commited on

Initial custom version
6fd1cee

Akfmsk commited on

Document LA Flash implementation details
c32291c
verified

ShihaoW commited on

Refine LA Flash plan documentation
fb9f8b1
verified

ShihaoW commited on

Update README.md
fd5777e
verified

ShihaoW commited on

Add batch inference and LA Flash runtime
8d21b77
verified

ShihaoW commited on

Update README.md
272068e
verified

Zhiding commited on

Update README.md
7a81d81
verified

ShihaoW commited on

Update README.md
567ab66
verified

ShihaoW commited on

Initial snapshot
d979fab

exiawsh commited on