`HyperParameterTuningJob.create` rejects tuner tags on Python 3.14
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Inizia dall'annotazione tags su HyperParameterTuningJob.create nel modulo delle risorse di sagemaker-core e dagli oggetti Tag costruiti in HyperparameterTuner.tune(). Il bug è che il nome Tag non qualificato viene risolto nel modello delle risorse su Python 3.14. Il lavoro è completato quando una richiesta HPO con tag viene validata su Python 3.14 e un test di regressione che copre questo caso passa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
PySDK Version
- PySDK V2 (2.x)
- PySDK V3 (3.x)
Describe the bug
Tagged HyperparameterTuner requests fail validation on Python 3.14.
Equivalent requests succeed on Python 3.12.
The tuner creates request tags as sagemaker.core.shapes.Tag.
On Python 3.14, HyperParameterTuningJob.create() resolves its tags
annotation as list[sagemaker.core.resources.Tag].
Both classes have the same key and value fields. However, they are separate
Pydantic models. Pydantic rejects the shapes model instead of converting it to
the generated resource model.
The failure occurs before the SDK calls SageMaker.
This is not a SageMaker v3.28 regression. The behavior also reproduces with the
v3.27 component set on Python 3.14.
To reproduce
Save this script as reproduce.py. It does not call a live AWS service.
import importlib.metadata
import inspect
import sys
from pydantic import TypeAdapter
from sagemaker.core.resources import HyperParameterTuningJob
from sagemaker.core.shapes import Tag
tags_annotation = inspect.signature(
HyperParameterTuningJob.create
).parameters["tags"].annotation
print("Python:", sys.version)
print("SageMaker:", importlib.metadata.version("sagemaker"))
print("SageMaker Core:", importlib.metadata.version("sagemaker-core"))
print("Resource annotation:", tags_annotation)
validated_tags = TypeAdapter(tags_annotation).validate_python(
[
Tag(
key="project",
value="hpo-tag-reproduction",
)
]
)
print("Validated tags:", validated_tags)
Run it with Python 3.12:
uvx --python 3.12 --from sagemaker==3.28.0 python reproduce.py
The script succeeds. The annotation resolves to
sagemaker.core.shapes.Tag.
Run it with Python 3.14:
uvx --python 3.14 --from sagemaker==3.28.0 python reproduce.py
The script fails. The annotation resolves to
sagemaker.core.resources.Tag.
The same mismatch occurs during HyperparameterTuner.tune(). The tuner creates
its request tags with this code:
from sagemaker.core.shapes import Tag
tag_objects = [
Tag(key=boto_tag["Key"], value=boto_tag["Value"])
for boto_tag in (_to_boto_tag(tag) for tag in self.tags)
]
Expected behavior
HyperParameterTuningJob.create() must accept the tag model produced by
HyperparameterTuner on every supported Python version.
Screenshots or logs
Python 3.14 produces this error:
Resource annotation: typing.List[sagemaker.core.resources.Tag] | None
Traceback (most recent call last):
...
pydantic_core._pydantic_core.ValidationError:
1 validation error for nullable[list[Tag]]
0
Input should be a valid dictionary or instance of Tag
[type=model_type,
input_value=Tag(key='project', value='hpo-tag-reproduction'),
input_type=Tag]
System information
- SageMaker Python SDK version: 3.28.0
- SageMaker Core version: 2.28.0
- SageMaker Train version: 1.28.0
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): Framework-independent
- Framework version: Not applicable
- Python version: 3.14
- CPU or GPU: CPU
- Custom Docker image (Y/N): Reproduces before image selection
Additional context
Python 3.14 uses deferred annotation evaluation. The unqualified Tag name
resolves after sagemaker.core.resources.Tag exists in the module.
Earlier Python versions capture the imported sagemaker.core.shapes.Tag when
the function is defined.
A stable fix can import the public shape with an unambiguous alias:
from sagemaker.core.shapes import Tag as ShapeTag
def create(
# ...
tags: list[ShapeTag] | None = None,
):
...
Tests must exercise tagged HPO request validation on Python 3.14.
- Lingua principale
- Python
- Stelle
- 2.3k
- Fork
- 1.3k
- Merge medio
- 1g 14h
- PR unite (30g)
- 62
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/sagemaker-python-sdk
-
get_base_python_image_uri() returns URIs for unsupported Python versionsForse già presa @Fire162 l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
aws/sagemaker-python-sdk#6539 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] ModelTrainer with no input channels emits InputDataConfig: [], which CreatePipeline rejects (min=1) — v2 omitted the keyForse già presa @sagemaker-bot l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
aws/sagemaker-python-sdk#6156 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
sagemaker-train should depend on mlflow-skinny, following sagemaker-mlflow 0.5.0Forse già presa @mohamedzeidan2021 l’ha presa 35 giorni fa. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
aws/sagemaker-python-sdk#6152 ·
I maintainer di solito rispondono entro 1 giorno
-
`ModelTrainer` bug with method to load hyperparameters from file for Amazon Nova RecipeForse già presa @sagemaker-bot l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
aws/sagemaker-python-sdk#5770 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
aws/sagemaker-python-sdk#5588 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di aws/sagemaker-python-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
elviskahoro/sdk-python-attio#144 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
RenyiELBO raises TypeError when model has no sample sitesForse già presa @alibb007 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Four evaluation scripts unpack init_memmachine_params's five return values into three namesAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
MemMachine/MemMachine#1911 ·
I maintainer di solito rispondono entro 3 giorni