aws / aws/sagemaker-python-sdk

`ModelTrainer` bug with method to load hyperparameters from file for Amazon Nova Recipe

Đang mở Phù hợp với người mới
#5,770 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2.3k
Fork
1.3k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
35

Mô tả

`**PySDK` Version**
- [ ] PySDK V2 (2.x)
- [x ] PySDK V3 (3.x)

**Describe the bug**
[Code](https://github.com/aws/sagemaker-python-sdk/blob/98683ac4cf5fcb0e734ff46ec046d32ade44494e/sagemaker-train/src/sagemaker/train/model_trainer.py#L1215-L1220) is using method `self._validate_and_load_hyperparameters_file` instead of self._validate_and_fetch_hyperparameters_file`:
```
if is_nova:
if hyperparameters and isinstance(hyperparameters, str):
hyperparameters = cls._validate_and_load_hyperparameters_file(hyperparameters) # bug
model_trainer_args["hyperparameters"].update(hyperparameters)
elif hyperparameters and isinstance(hyperparameters, dict):
model_trainer_args["hyperparameters"].update(hyperparameters)
```

**To reproduce**
```
from sagemaker.train.model_trainer import ModelTrainer
from sagemaker.train.configs import Compute

model_trainer = ModelTrainer.from_recipe(
training_image="327873000638.dkr.ecr.us-east-1.amazonaws.com/hyperpod-recipes:verl-v1.0.0-smtj",
training_recipe="training/nova/nova_1_0/nova_lite/CPT/nova_lite_1_0_p5x16_gpu_pretrain",
compute=Compute(instance_type="ml.m5.xlarge"),
hyperparameters="test",
)
```
```
│ │
│ 287 │ │ │ private_attributes = self.__dict__.get('__private_attributes__') │
│ 288 │ │ │ if private_attributes and item in private_attributes: │
│ 289 │ │ │ │ return private_attributes[item] │
│ ❱ 290 │ │ │ raise AttributeError(item) │
│ 291 │ │
│ 292 │ @classmethod │
│ 293 │ def __prepare__(cls, *args: Any, **kwargs: Any) -> dict[str, object]: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: _validate_and_load_hyperparameters_file
```
**Expected behavior**
No `AttributeError` to be raised when using hyperparameter file (string).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong sagemaker-train/src/sagemaker/train/model_trainer.py, tại logic ModelTrainer.from_recipe quanh các dòng 1215-1220. Theo dõi đường đi của các siêu tham số dạng chuỗi và so sánh các phương thức xác thực được tham chiếu. Hoàn tất khi một chuỗi tệp siêu tham số không còn gây ra AttributeError đối với một Amazon Nova Recipe và được lấy thông qua phương thức dự kiến.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
machine-learning
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
82/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.