-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathllm_artifact_gateway.py
More file actions
62 lines (50 loc) · 1.73 KB
/
llm_artifact_gateway.py
File metadata and controls
62 lines (50 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from abc import ABC, abstractmethod
from typing import Any, Dict, List
class LLMArtifactGateway(ABC):
"""
Abstract Base Class for interacting with llm artifacts.
"""
@abstractmethod
def list_files(self, path: str, **kwargs) -> List[str]:
"""
Gets a list of files from a given path.
Args:
path (str): path to list files
"""
pass
@abstractmethod
def download_files(self, path: str, target_path: str, overwrite=False, **kwargs) -> List[str]:
"""
Download files from a given path to a target path.
Args:
path (str): path to list files
target_path (str): local path to download files
overwrite (bool): whether to overwrite existing local files
"""
pass
@abstractmethod
def get_model_weights_urls(self, owner: str, model_name: str, **kwargs) -> List[str]:
"""
Gets a list of URLs for all files associated with a given model.
Args:
owner (str): owner of the model
model_name (str): name of the model
"""
pass
@abstractmethod
def upload_files(self, local_path: str, remote_path: str, **kwargs) -> None:
"""
Upload all files from a local directory to a remote path.
Args:
local_path (str): local directory containing files to upload
remote_path (str): remote destination path (s3://, gs://, or https://)
"""
pass
@abstractmethod
def get_model_config(self, path: str, **kwargs) -> Dict[str, Any]:
"""
Gets the model config from the model files live at given folder.
Args:
path (str): path to model files
"""
pass