HugoLaurencon commited on
Commit
6e15f62
·
1 Parent(s): 58bcd63

remove test

Browse files
Files changed (1) hide show
  1. convert_siglip_to_hf.py +0 -17
convert_siglip_to_hf.py CHANGED
@@ -260,23 +260,6 @@ def convert_siglip_checkpoint(model_name, pytorch_dump_folder_path, push_to_hub=
260
  #
261
  # pixel_values = processor(image, return_tensors="pt").pixel_values
262
 
263
- filepath = hf_hub_download(repo_id="nielsr/test-image", filename="pixel_values_siglip.npy", repo_type="dataset")
264
- pixel_values = np.load(filepath)
265
- pixel_values = torch.from_numpy(pixel_values).permute(0, 3, 1, 2)
266
- filepath = hf_hub_download(repo_id="nielsr/test-image", filename="input_ids_siglip.npy", repo_type="dataset")
267
- input_ids = np.load(filepath)
268
- input_ids = torch.from_numpy(input_ids)
269
-
270
- with torch.no_grad():
271
- outputs = model(input_ids=input_ids, pixel_values=pixel_values)
272
-
273
- # assert values
274
- expected_slice = torch.tensor(
275
- [[-2.9621, -2.1672, -1.7837], [-0.2713, 0.2910, -10.6595], [-13.6617, -13.1611, -17.4408]]
276
- )
277
- assert torch.allclose(outputs.logits_per_image[:3, :3], expected_slice, atol=1e-4)
278
- print("Looks ok!")
279
-
280
  if pytorch_dump_folder_path is not None:
281
  Path(pytorch_dump_folder_path).mkdir(exist_ok=True)
282
  print(f"Saving model {model_name} to {pytorch_dump_folder_path}")
 
260
  #
261
  # pixel_values = processor(image, return_tensors="pt").pixel_values
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  if pytorch_dump_folder_path is not None:
264
  Path(pytorch_dump_folder_path).mkdir(exist_ok=True)
265
  print(f"Saving model {model_name} to {pytorch_dump_folder_path}")