Skip to content

Commit

Permalink
Change owner -> owned_by in models endpoint response (pytorch#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmpuri authored Aug 7, 2024
1 parent a9d386e commit fe73ef7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ModelInfo:

id: str
created: int
owner: str
owned_by: str
object: str = "model"


Expand Down Expand Up @@ -56,9 +56,9 @@ def retrieve_model_info(args, model_id: str) -> Union[ModelInfo, None]:
if is_model_downloaded(model_id, args.model_directory):
path = args.model_directory / model_config.name
created = int(os.path.getctime(path))
owner = getpwuid(os.stat(path).st_uid).pw_name
owned_by = getpwuid(os.stat(path).st_uid).pw_name

return ModelInfo(id=model_config.name, created=created, owner=owner)
return ModelInfo(id=model_config.name, created=created, owned_by=owned_by)
return None
return None

Expand All @@ -79,8 +79,10 @@ def get_model_info_list(args) -> ModelInfo:
if is_model_downloaded(model_id, args.model_directory):
path = args.model_directory / model_config.name
created = int(os.path.getctime(path))
owner = getpwuid(os.stat(path).st_uid).pw_name
owned_by = getpwuid(os.stat(path).st_uid).pw_name

data.append(ModelInfo(id=model_config.name, created=created, owner=owner))
data.append(
ModelInfo(id=model_config.name, created=created, owned_by=owned_by)
)
response = ModelInfoList(data=data)
return response

0 comments on commit fe73ef7

Please sign in to comment.