**Ran into an issue while trying your models out.
Made a new environment.
I installed the requirements.txt.
I added the models to a models folder.
When I tried to run your code in any of the notebooks provided I encountered the following error:**
Exception Traceback (most recent call last)
Input In [1], in <cell line: 39>()
37 config = Config(cfg_dict)
38 checkpoint_path = path_to_model + "/model/checkpoint.pt"
---> 39 agent = ParaphraseAgent(config=config, run_id=None, output_path=None, data_path=DATA_PATH, silent=False, verbose=False, training_mode=False)
41 # Load the checkpoint
42 agent.load_checkpoint(checkpoint_path)
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\agents\para_agent.py:76, in ParaphraseAgent.__init__(self, config, run_id, output_path, data_path, silent, training_mode, verbose, cache_root, use_cuda)
73 if training_mode:
74 self.create_optimizer()
---> 76 self.set_device(use_cuda)
78 self.create_samplers()
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\agents\base.py:26, in BaseAgent.set_device(self, use_cuda)
24 if use_cuda and not self.cuda_available:
25 self.logger.error("Use CUDA is set to true, but not CUDA devices were found!")
---> 26 raise Exception("No CUDA devices found")
28 self.cuda = self.cuda_available & use_cuda
30 if self.cuda:
Exception: No CUDA devices found
**When I checked the torch version that was installed it was 1.10.2+cpu.
Your requirements.txt in torchseq was torch=1.11.0 so I am a bit confused how 1.10.2+cpu was installed.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.
torchseq 0.0.1 requires torch==1.10.2, but you have torch 1.11.0+cu113 which is incompatible.
Successfully installed torch-1.11.0+cu113 torchaudio-0.11.0+cu113 torchvision-0.12.0+cu113
**I check my torch version and it is 1.11.0+cu113.
However, when I proceed to run your code provided I encounter the following error:**
Some unexpected keys were found in the loaded checkpoint:
Some unexpected keys were found in the loaded checkpoint:
seq_encoder.embedding_projection.weight_g
seq_encoder.embedding_projection.weight_v
bottleneck.module_list.1.quantizer._alpha
bottleneck.module_list.1.quantizer._ema_cluster_size0
bottleneck.module_list.1.quantizer._ema_cluster_size1
bottleneck.module_list.1.quantizer._ema_cluster_size2
bottleneck.module_list.1.quantizer._ema_w.0
bottleneck.module_list.1.quantizer._ema_w.1
bottleneck.module_list.1.quantizer._ema_w.2
Exception Traceback (most recent call last)
Input In [2], in <cell line: 45>()
42 instance.model.eval()
44 # Finally, run inference
---> 45 _, _, (pred_output, _, _), _ = instance.inference(data_loader.test_loader)
47 print(pred_output)
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\agents\model_agent.py:554, in ModelAgent.inference(self, data_loader, memory_keys_to_return, metric_hooks, use_test, training_loop)
552 with torch.no_grad():
553 num_samples = 0
--> 554 for batch_idx, batch in enumerate(
555 tqdm(data_loader, desc="Validating after {:} epochs".format(self.current_epoch), disable=self.silent)
556 ):
557 batch = {k: (v.to(self.device) if k[-5:] != "_text" and k[0] != "_" else v) for k, v in batch.items()}
559 curr_batch_size = batch[[k for k in batch.keys() if k[-5:] != "_text"][0]].size()[0]
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\tqdm\std.py:1183, in tqdm.__iter__(self)
1180 # If the bar is disabled, then just walk the iterable
1181 # (note: keep this check outside the loop for performance)
1182 if self.disable:
-> 1183 for obj in iterable:
1184 yield obj
1185 return
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\dataloader.py:530, in _BaseDataLoaderIter.__next__(self)
528 if self._sampler_iter is None:
529 self._reset()
--> 530 data = self._next_data()
531 self._num_yielded += 1
532 if self._dataset_kind == _DatasetKind.Iterable and \
533 self._IterableDataset_len_called is not None and \
534 self._num_yielded > self._IterableDataset_len_called:
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\dataloader.py:1224, in _MultiProcessingDataLoaderIter._next_data(self)
1222 else:
1223 del self._task_info[idx]
-> 1224 return self._process_data(data)
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\dataloader.py:1250, in _MultiProcessingDataLoaderIter._process_data(self, data)
1248 self._try_put_index()
1249 if isinstance(data, ExceptionWrapper):
-> 1250 data.reraise()
1251 return data
File C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\_utils.py:457, in ExceptionWrapper.reraise(self)
453 except TypeError:
454 # If the exception takes multiple arguments, don't try to
455 # instantiate since we don't know how to
456 raise RuntimeError(msg) from None
--> 457 raise exception
Exception: Caught Exception in DataLoader worker process 0.
Original Traceback (most recent call last):
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\_utils\worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\datasets\json_dataset.py", line 98, in __getitem__
return JsonDataset.to_tensor(
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\datasets\json_dataset.py", line 121, in to_tensor
parsed = JsonDataInstance(sample, [f["to"] for f in fields])
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\datasets\json_dataset.py", line 210, in __init__
_doc = Tokenizer().tokenise(sample[f])
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\utils\singleton.py", line 6, in __call__
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
File "C:\Workspace\Anaconda3\envs\gen\lib\site-packages\torchseq\utils\tokenizer.py", line 86, in __init__
raise Exception("Tokenizer needs to be initialized with a model name before use!")
Exception: Tokenizer needs to be initialized with a model name before use!