joy1515 commited on
Commit
3c3d449
·
verified ·
1 Parent(s): 8d6e541

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -29,24 +29,20 @@ class ImageSearchSystem:
29
 
30
  # Prune the model (access vision module correctly)
31
  parameters_to_prune = (
32
- (self.model.vision_model.encoder.layers, 'attention.self.query.weight'),
33
- (self.model.vision_model.encoder.layers, 'attention.self.key.weight'),
34
- (self.model.vision_model.encoder.layers, 'attention.self.value.weight')
35
  )
36
 
37
  # Prune the weights
38
- prune.l1_unstructured(parameters_to_prune, amount=0.2)
 
39
 
40
  # Initialize dataset
41
  self.image_paths = []
42
  self.index = None
43
  self.initialized = False
44
-
45
- # Initialize dataset
46
- self.image_paths = []
47
- self.index = None
48
- self.initialized = False
49
-
50
  def initialize_dataset(self) -> None:
51
  """Download and process dataset"""
52
  try:
 
29
 
30
  # Prune the model (access vision module correctly)
31
  parameters_to_prune = (
32
+ (self.model.vision_model.encoder.layers[0].attention.self.query.weight, 'attention.self.query.weight'),
33
+ (self.model.vision_model.encoder.layers[0].attention.self.key.weight, 'attention.self.key.weight'),
34
+ (self.model.vision_model.encoder.layers[0].attention.self.value.weight, 'attention.self.value.weight')
35
  )
36
 
37
  # Prune the weights
38
+ for param, name in parameters_to_prune:
39
+ prune.l1_unstructured(param, amount=0.2)
40
 
41
  # Initialize dataset
42
  self.image_paths = []
43
  self.index = None
44
  self.initialized = False
45
+
 
 
 
 
 
46
  def initialize_dataset(self) -> None:
47
  """Download and process dataset"""
48
  try: