[object Object]

← back to Exo

ignore files that dont match allow patterns

3bd5a116df054e64698032e55fbf20aba2191c52 · 2024-08-09 11:38:50 +0100 · Alex Cheema

Files touched

Diff

commit 3bd5a116df054e64698032e55fbf20aba2191c52
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Fri Aug 9 11:38:50 2024 +0100

    ignore files that dont match allow patterns
---
 exo/inference/tinygrad/tinygrad_helpers.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/exo/inference/tinygrad/tinygrad_helpers.py b/exo/inference/tinygrad/tinygrad_helpers.py
index fdea7f5e..52a4d155 100644
--- a/exo/inference/tinygrad/tinygrad_helpers.py
+++ b/exo/inference/tinygrad/tinygrad_helpers.py
@@ -5,6 +5,8 @@ import json
 from typing import List
 from exo.inference.shard import Shard
 from exo.helpers import DEBUG
+from exo.download.hf.hf_helpers import get_allow_patterns
+from fnmatch import fnmatch
 
 # **** helper functions ****
 def concat_weights(models, device=None):
@@ -22,7 +24,10 @@ def load(fn:str, shard: Shard):
     with open(fn) as fp: weight_map = json.load(fp)['weight_map']
     parts = {}
     filtered_weight_map = {}
+    allow_patterns = get_allow_patterns(weight_map, shard)
     for k, n in weight_map.items():
+      if allow_patterns is not None and not any(fnmatch(n, r) for r in allow_patterns):
+        continue
       if k.startswith("model.layers."):
         layer_num = int(k.split('.')[2])
         if layer_num < shard.start_layer or layer_num > shard.end_layer:

← 3db3e829 make download panel slightly larger  ·  back to Exo  ·  display all interfaces web chat and chatgpt api are availabl 71591d2e →