mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-06-18 13:18:57 +08:00
[v1] Add FlashAttention selection and implement normal / padding-free / dynamic batching (#10469)
This commit is contained in:
@@ -33,6 +33,10 @@ class StatefulBuffer:
|
||||
def size(self) -> int:
|
||||
return self._buffer_size
|
||||
|
||||
@property
|
||||
def samples(self) -> list[ModelInput]:
|
||||
return self._buffer
|
||||
|
||||
def put(self, samples: list[ModelInput]) -> None:
|
||||
"""Add samples to the buffer."""
|
||||
num_tokens = sum(len(sample["input_ids"]) for sample in samples)
|
||||
|
||||
Reference in New Issue
Block a user