[Perf] Reuse single-element media tensors in qwen3_vl_sft_collator and SequenceContext.cat (follow-up of #2239)
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 62/100
- Tipo de issue
- Refactorización
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- data, machine-learning
Línea de trabajo
Start with the _reuse_single_or_cat helper in xtuner/v1/datasets/collator.py and the qwen3_vl_sft_collator lines around 280-287, then read SequenceContext.cat in xtuner/v1/data_proto/sequence_context.py at about lines 393-418. Apply the single-element reuse pattern at both sites and add a comment about the read-only sharing invariant from #2239. Done means single-media packs skip torch.cat and a test asserts the media tensors are bitwise unchanged after use.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background
#2239 removed full torch.cat copies for single-media packs on the GLM-5.3 SFT
path (collator helper _reuse_single_or_cat, tokenize fn, and the compose model
entry). The same "single-element list still pays a full copy" pattern remains at
two sites outside that PR's scope:
-
qwen3_vl_sft_collator—xtuner/v1/datasets/collator.py:280,287:
pixel_values/image_grid_thware unconditionallytorch.cat-ed even when
the pack contains a single media item. The_reuse_single_or_cathelper added
in #2239 sits in the same file and can be applied directly. -
SequenceContext.cat—xtuner/v1/data_proto/sequence_context.py:393-403
(pixel_values/pixel_values_videos) and:415,418(image_grid_thw/
video_grid_thw): single-element lists are unconditionally copied. This is on
the RL path — the RL controller merges seq_ctx lists viaSequenceContext.cat
(xtuner/v1/rl/trainer/controller.py:236).
Impact
No correctness issue today. GLM-5.3 SFT does not go through either site, so this
is pure follow-up: qwen3_vl SFT benefits for single-media packs; the RL path
benefits if rollout packing of media seq_ctx becomes hot.
Suggested fix
- Apply the same
len == 1 → reuse, else catpattern at both sites. - Mind the invariant pinned in #2239: a reused tensor shares storage with its
source, so the downstream path must stay read-only — add the same kind of
comment + a "media tensor bitwise unchanged after use" test assertion.
- Lenguaje dominante
- Python
- Estrellas
- 5.2k
- Forks
- 466
- Merge medio
- 5 d 8 h
- PR fusionados (30 d)
- 44
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InternLM/xtuner
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 4 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
InternLM/xtuner#2134 · 1 reacción ·
Los mantenedores suelen responder en 4 días
-
[NPU] reduce_sum_across_dp_group builds the all_reduce tensor on CPU when CUDA is unavailablePosiblemente ocupada @li-lizhe la tomó hace 69 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
Los mantenedores suelen responder en 4 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
InternLM/xtuner#2118 · 6 comentarios ·
Los mantenedores suelen responder en 4 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Los mantenedores suelen responder en 4 días
Todos los issues de InternLM/xtuner
Issues similares
-
accepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
future-agi/future-agi#5908 ·
Los mantenedores suelen responder en 1 día
-
Placeholder export disables HTML image input for picture descriptionPosiblemente ocupada @cloudiful la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
docling-project/docling-serve#817 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Techiebutler/freeframe#687 ·
Los mantenedores suelen responder en 1 día
-
Parse truncated verbose GC logs up to the first XML errorPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug verbose GC
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
IBM/javacore-analyser#677 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días