get file root path from context, avoid downloading entire HF repos
This commit is contained in:
parent
6cdba4cebb
commit
ebb5a586ce
|
@ -12,14 +12,9 @@ logger = getLogger(__name__)
|
|||
class FileClient(BaseClient):
|
||||
protocol = "file://"
|
||||
|
||||
root: str
|
||||
|
||||
def __init__(self, root: str):
|
||||
self.root = root
|
||||
|
||||
def download(
|
||||
self,
|
||||
_conversion: ConversionContext,
|
||||
conversion: ConversionContext,
|
||||
_name: str,
|
||||
uri: str,
|
||||
format: Optional[str] = None,
|
||||
|
@ -28,4 +23,4 @@ class FileClient(BaseClient):
|
|||
) -> str:
|
||||
parts = urlparse(uri)
|
||||
logger.info("loading model from: %s", parts.path)
|
||||
return path.join(self.root, parts.path)
|
||||
return path.join(conversion.model_path, parts.path)
|
||||
|
|
|
@ -41,7 +41,4 @@ class HuggingfaceClient(BaseClient):
|
|||
token=self.token,
|
||||
)
|
||||
else:
|
||||
return snapshot_download(
|
||||
repo_id=source,
|
||||
token=self.token,
|
||||
)
|
||||
return source
|
||||
|
|
Loading…
Reference in New Issue