higgsfield / np-hard-deep-reinforcement-learning Goto Github PK
View Code? Open in Web Editor NEWpytorch neural combinatorial optimization
pytorch neural combinatorial optimization
In pointer network jupyter notebook,
/pytorch_test/env2/lib/python2.7/site-packages/ipykernel_launcher.py:46: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
Exception NameError: "global name 'FileNotFoundError' is not defined" in <bound method _DataLoaderIter.__del__ of <torch.utils.data.dataloader._DataLoaderIter object at 0x7fdc900d1cd0>> ignored
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-21-0299c228a1ba> in <module>()
15
16 adam.zero_grad()
---> 17 loss.backward()
18 adam.step()
19
/pytorch_test/env2/local/lib/python2.7/site-packages/torch/tensor.pyc in backward(self, gradient, retain_graph, create_graph)
91 products. Defaults to ``False``.
92 """
---> 93 torch.autograd.backward(self, gradient, retain_graph, create_graph)
94
95 def register_hook(self, hook):
/pytorch_test/env2/local/lib/python2.7/site-packages/torch/autograd/__init__.pyc in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables)
87 Variable._execution_engine.run_backward(
88 tensors, grad_tensors, retain_graph, create_graph,
---> 89 allow_unreachable=True) # allow_unreachable flag
90
91
RuntimeError: backward_input can only be called in training mode
Good day,
I want to test the model on windows 10. I assume the code was written for Linux, therefore I am receiving problems related to pip. I found that I should add "if name == 'main':" to protect the main code, however, I wasn't successful in fixing this problem.
Could someone help to solve this issue?
explenation:
https://stackoverflow.com/questions/14207708/ioerror-errno-32-broken-pipe-python
BrokenPipeError Traceback (most recent call last)
in ()
4
5 for epoch in range(n_epochs):
----> 6 for batch_id, sample_batch in enumerate(train_loader):
7
8 inputs = Variable(sample_batch)
~\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in iter(self)
308
309 def iter(self):
--> 310 return DataLoaderIter(self)
311
312 def len(self):
~\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in init(self, loader)
165 for w in self.workers:
166 w.daemon = True # ensure that the worker exits on process exit
--> 167 w.start()
168
169 if self.pin_memory:
~\Anaconda3\lib\multiprocessing\process.py in start(self)
103 'daemonic processes are not allowed to have children'
104 _cleanup()
--> 105 self._popen = self._Popen(self)
106 self._sentinel = self._popen.sentinel
107 # Avoid a refcycle if the target function holds an indirect
~\Anaconda3\lib\multiprocessing\context.py in _Popen(process_obj)
221 @staticmethod
222 def _Popen(process_obj):
--> 223 return _default_context.get_context().Process._Popen(process_obj)
224
225 class DefaultContext(BaseContext):
~\Anaconda3\lib\multiprocessing\context.py in _Popen(process_obj)
320 def _Popen(process_obj):
321 from .popen_spawn_win32 import Popen
--> 322 return Popen(process_obj)
323
324 class SpawnContext(BaseContext):
~\Anaconda3\lib\multiprocessing\popen_spawn_win32.py in init(self, process_obj)
63 try:
64 reduction.dump(prep_data, to_child)
---> 65 reduction.dump(process_obj, to_child)
66 finally:
67 set_spawning_popen(None)
~\Anaconda3\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
58 def dump(obj, file, protocol=None):
59 '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60 ForkingPickler(file, protocol).dump(obj)
61
62 #
BrokenPipeError: [Errno 32] Broken pipe
I want to save the trained model and load it up for use.
I am getting a broken pipe error. I have worked for two months to solve this problem but still I am unable to resolve it. Can you suggest any solution?
Regards
Tariq Shah
Ph.D. students
Thammasat University, Thailand
Brief looking at the code:
for i in range(seq_len):
...
for i in range(self.n_glimpses):
...
loss += self.criterion(logits, target[:,i])
i
will always be self.n_glimpses - 1
, so the displayed loss is meaningless. Sorting predicted by the model will also be meaningless. After fixing it, the loss won't change and the model doesn't train at all. Logits are not softmaxed after pointing. Masks are never applied since idxs
are never initialized.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.