Checkpoint
rotated.read_metadata(checkpoint_path)
체크포인트 파일의 metadata 섹션 데이터를 읽어옵니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path |
str
|
checkpoint_path |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict, bool]
|
Union[Dict, bool]: 체크포인트 버전이 맞지 않는 경우 False 값을 리턴 |
Raises:
| Type | Description |
|---|---|
ModelFileNotFoundError
|
checkpoint_path에 해당하는 파일이 없는 경우 |
rotated.write_metadata(checkpoint_path, metadata)
체크포인트 파일의 metadata 섹션 데이터를 수정해 저장합니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path |
str
|
checkpoint_path |
required |
metadata |
Dict
|
metadata |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
체크포인트 버전이 맞지 않는 경우 False 값을 리턴 |
Raises:
| Type | Description |
|---|---|
ModelFileNotFoundError
|
checkpoint_path에 해당하는 파일이 없는 경우 |
rotated.convert_checkpoint(checkpoint_path, save_path=None)
22년12월21일 이전 버전 체크포인트를 최신 구조로 변환해 저장합니다. 저장되어있던 metadata는 제거됩니다.
이 API는 추후 백엔드와의 논의를 통해 점진적으로 사용을 줄이고, 최종적으로는 삭제되어야 합니다. 현재는 torch와의 의존성을 줄이기 위해, 실제 호출 시에만 관련 패키지가 로드되도록 lazy import가 적용되어 있습니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path |
str
|
이전 버전 체크포인트 경로 |
required |
save_path |
Optional[str]
|
저장할 경로. None인 경우 |
None
|