Files already downloaded and verified
Files already downloaded and verified
2022-06-24 10:58:49,474: Running on: 1 images per class.
2022-06-24 10:58:49,475: Starting at img number: 0 per class.
/usr/local/lib/python3.7/dist-packages/pytorch_influence_functions/influence_function.py:70: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
y = torch.nn.functional.log_softmax(y)
Calc. s_test recursions: [=================================================] 1 / 1
Averaging r-times: [=======================================================] 1 / 1
Calc. influence function: [========================================] 49999 / 50000
Calc. influence function: [========================================] 50000 / 50000
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[<ipython-input-17-f738cfd2c21e>](https://localhost:8080/#) in <module>()
3 trainloader, testloader = load_data()
4 ptif.init_logging()
----> 5 inf = ptif.calc_img_wise(config, model, trainloader, testloader)
5 frames
[/usr/local/lib/python3.7/dist-packages/pytorch_influence_functions/calc_influence_function.py](https://localhost:8080/#) in calc_img_wise(config, model, train_loader, test_loader)
469 influence, harmful, helpful, _ = calc_influence_single(
470 model, train_loader, test_loader, test_id_num=i, gpu=config['gpu'],
--> 471 recursion_depth=config['recursion_depth'], r=config['r_averaging'])
472 end_time = time.time()
473
[/usr/local/lib/python3.7/dist-packages/pytorch_influence_functions/calc_influence_function.py](https://localhost:8080/#) in calc_influence_single(model, train_loader, test_loader, test_id_num, gpu, recursion_depth, r, s_test_vec, time_logging)
344 display_progress("Calc. influence function: ", i, train_dataset_size)
345
--> 346 harmful = np.argsort(influences)
347 helpful = harmful[::-1]
348
<__array_function__ internals> in argsort(*args, **kwargs)
[/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py](https://localhost:8080/#) in argsort(a, axis, kind, order)
1112
1113 """
-> 1114 return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order)
1115
1116
[/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py](https://localhost:8080/#) in _wrapfunc(obj, method, *args, **kwds)
52 bound = getattr(obj, method, None)
53 if bound is None:
---> 54 return _wrapit(obj, method, *args, **kwds)
55
56 try:
[/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py](https://localhost:8080/#) in _wrapit(obj, method, *args, **kwds)
41 except AttributeError:
42 wrap = None
---> 43 result = getattr(asarray(obj), method)(*args, **kwds)
44 if wrap:
45 if not isinstance(result, mu.ndarray):
[/usr/local/lib/python3.7/dist-packages/torch/_tensor.py](https://localhost:8080/#) in __array__(self, dtype)
731 if dtype is None:
732 return self.numpy()
--> 733 else:
734 return self.numpy().astype(dtype, copy=False)
735
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
I can't figure out why it is not working, as I assume it worked for you and I haven't changed anything.
Does anyone else have this issue or can tell me how to solve it?