Tom Aarsen commited on
Commit
57d567f
1 Parent(s): 13b0b9b

Add "model.safetensors.index.json" support

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -837,6 +837,17 @@ def get_dim_seq_size(model):
837
  url = hf_hub_url(model.modelId, filename="model.safetensors")
838
  meta = get_hf_file_metadata(url)
839
  size = round(meta.size / 1e9, 2)
 
 
 
 
 
 
 
 
 
 
 
840
  return dim, seq, size
841
 
842
  def make_datasets_clickable(df):
 
837
  url = hf_hub_url(model.modelId, filename="model.safetensors")
838
  meta = get_hf_file_metadata(url)
839
  size = round(meta.size / 1e9, 2)
840
+ elif "model.safetensors.index.json" in filenames:
841
+ index_path = hf_hub_download(model.modelId, filename="model.safetensors.index.json")
842
+ """
843
+ {
844
+ "metadata": {
845
+ "total_size": 14483464192
846
+ },....
847
+ """
848
+ size = json.load(open(index_path))
849
+ if ("metadata" in size) and ("total_size" in size["metadata"]):
850
+ size = round(size["metadata"]["total_size"] / 1e9, 2)
851
  return dim, seq, size
852
 
853
  def make_datasets_clickable(df):