feat: Add video support for the Transformers backend (#57441)
Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Harry Mellor
Claude Opus 5
parent
042ab0305c
commit
34051ad714
@@ -683,15 +683,15 @@ def patch_rope_parameters(config: PreTrainedConfig) -> None:
|
||||
config.validate_rope()
|
||||
|
||||
|
||||
def _iter_rope_parameters(config: PreTrainedConfig) -> Iterator[dict[str, Any]]:
|
||||
def iter_rope_parameters(config: PreTrainedConfig) -> Iterator[dict[str, Any]]:
|
||||
"""Yield a config's rope parameters, one dict per layer type if nested."""
|
||||
rope_parameters = getattr(config, "rope_parameters", None)
|
||||
if not isinstance(rope_parameters, dict):
|
||||
return
|
||||
|
||||
if is_rope_parameters_nested(rope_parameters):
|
||||
yield from (p for p in rope_parameters.values() if isinstance(p, dict))
|
||||
else:
|
||||
yield from (p for p in rope_parameters.values() if isinstance(p, dict) and p)
|
||||
elif rope_parameters:
|
||||
yield rope_parameters
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ def _mrope_section(config: PreTrainedConfig) -> Sequence[int] | None:
|
||||
|
||||
names = ("mrope_section", "xdrope_section")
|
||||
|
||||
for params in _iter_rope_parameters(config):
|
||||
for params in iter_rope_parameters(config):
|
||||
for i, name in enumerate(names):
|
||||
section = params.get(name)
|
||||
if isinstance(section, (list, tuple)):
|
||||
|
||||
Reference in New Issue
Block a user