@@ -67,11 +67,8 @@ async def _save_snapshot() -> dict[str, Any]:
6767 return json .load (f )
6868
6969
70- async def _write_snapshot (path : ZPath , data : dict , models : list | None = None ) -> None :
70+ async def _write_snapshot (path : ZPath , data : dict , models : list ) -> None :
7171 snapshot = await _save_snapshot ()
72- if models is None :
73- print ("Package => Writing models" )
74- models = await _get_models ()
7572 for package in list (snapshot ["pips" ]):
7673 if any (
7774 fnmatch (normalize_name (package .split ("==" )[0 ]), pat )
@@ -162,7 +159,6 @@ async def _get_models(
162159 model_data ["sha256" ],
163160 cache_only = not ensure_source ,
164161 )
165- model_data ["source" ] = {}
166162 # should_store = store_models and (
167163 # model_data["source"].get("source") != "huggingface"
168164 # or model_data["source"].get("repo", "").startswith("datasets/")
@@ -437,11 +433,13 @@ async def _prepare_pack(
437433 working_dir : ZPath ,
438434 data : dict ,
439435 store_models : bool = False ,
436+ ensure_source : bool = True ,
440437) -> None :
441438 model_filter = set (data .get ("models" , []))
442439 models = await _get_models (
443440 store_models = store_models ,
444441 model_filter = model_filter ,
442+ ensure_source = ensure_source ,
445443 )
446444
447445 await _write_snapshot (working_dir , data , models )
@@ -509,7 +507,7 @@ async def build_bento_api(request):
509507
510508 with tempfile .TemporaryDirectory (suffix = "-bento" , prefix = "comfy-pack-" ) as temp_dir :
511509 temp_dir_path = Path (temp_dir )
512- await _prepare_pack (temp_dir_path , data , store_models = True )
510+ await _prepare_pack (temp_dir_path , data , store_models = True , ensure_source = False )
513511
514512 # create a bento
515513 try :
0 commit comments