(
self,
repo_id: str,
operations: Iterable[CommitOperation],
*,
commit_message: str,
commit_description: Optional[str] = None,
token: Union[str, bool, None] = None,
repo_type: Optional[str] = None,
revision: Optional[str] = DEFAULT_REPOSITORY_REVISION,
**kwargs,
)
| 819 | |
| 820 | @future_compatible |
| 821 | def create_commit( |
| 822 | self, |
| 823 | repo_id: str, |
| 824 | operations: Iterable[CommitOperation], |
| 825 | *, |
| 826 | commit_message: str, |
| 827 | commit_description: Optional[str] = None, |
| 828 | token: Union[str, bool, None] = None, |
| 829 | repo_type: Optional[str] = None, |
| 830 | revision: Optional[str] = DEFAULT_REPOSITORY_REVISION, |
| 831 | **kwargs, |
| 832 | ) -> Union[CommitInfo, Future[CommitInfo]]: |
| 833 | from modelscope.hub.api import HubApi |
| 834 | api = HubApi() |
| 835 | if any(['Add' not in op.__class__.__name__ for op in operations]): |
| 836 | raise ValueError( |
| 837 | 'ModelScope create_commit only support Add operation for now.') |
| 838 | if revision is None or revision == 'main': |
| 839 | revision = 'master' |
| 840 | all_files = [op.path_or_fileobj for op in operations] |
| 841 | api.upload_folder( |
| 842 | repo_id=repo_id, |
| 843 | folder_path=all_files, |
| 844 | commit_message=commit_message, |
| 845 | commit_description=commit_description, |
| 846 | token=token, |
| 847 | revision=revision, |
| 848 | repo_type=repo_type or 'model') |
| 849 | |
| 850 | def load( |
| 851 | cls, |
nothing calls this directly
no test coverage detected
searching dependent graphs…