質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -177,3 +177,119 @@
|
|
177
177
|
[2]
|
178
178
|
|
179
179
|
```
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
追記
|
188
|
+
|
189
|
+
いくつか修正を加えましたが 新たなエラーになりました
|
190
|
+
|
191
|
+
パラメーターが間違っています。
|
192
|
+
|
193
|
+
となっていますが どこが間違えてるのかわかりませんprocess1.start()に入れる
|
194
|
+
|
195
|
+
変数はなかったはずです
|
196
|
+
|
197
|
+
```ここに言語を入力
|
198
|
+
|
199
|
+
import numpy as np
|
200
|
+
|
201
|
+
import time
|
202
|
+
|
203
|
+
import torch.multiprocessing as mp
|
204
|
+
|
205
|
+
import torch.nn as nn
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
class main_(nn.Module):
|
212
|
+
|
213
|
+
def __init__(self):
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
super(main_, self).__init__()
|
218
|
+
|
219
|
+
self.flan=True
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
def process1(main):
|
224
|
+
|
225
|
+
print(main.flan,"pro")
|
226
|
+
|
227
|
+
main.flan=False
|
228
|
+
|
229
|
+
if __name__ == '__main__':
|
230
|
+
|
231
|
+
main=main_()
|
232
|
+
|
233
|
+
main.share_memory()
|
234
|
+
|
235
|
+
process1 = mp.Process(target=process1, args=(main,))
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
process1.start()
|
240
|
+
|
241
|
+
process1.join()
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
print(main.flan,"ok")
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
```ここに言語を入力
|
250
|
+
|
251
|
+
Traceback (most recent call last):
|
252
|
+
|
253
|
+
File "shead_testR.py", line 23, in <module>
|
254
|
+
|
255
|
+
process1.start()
|
256
|
+
|
257
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\process.py", line 112, in start
|
258
|
+
|
259
|
+
self._popen = self._Popen(self)
|
260
|
+
|
261
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\context.py", line 223, in _Popen
|
262
|
+
|
263
|
+
return _default_context.get_context().Process._Popen(process_obj)
|
264
|
+
|
265
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\context.py", line 322, in _Popen
|
266
|
+
|
267
|
+
return Popen(process_obj)
|
268
|
+
|
269
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
|
270
|
+
|
271
|
+
reduction.dump(process_obj, to_child)
|
272
|
+
|
273
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\reduction.py", line 60, in dump
|
274
|
+
|
275
|
+
ForkingPickler(file, protocol).dump(obj)
|
276
|
+
|
277
|
+
_pickle.PicklingError: Can't pickle <function process1 at 0x000002570CDCF438>: it's not the same object as __main__.process1
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
(testpyflan) C:\Users\PC_User\Desktop\AGI>Traceback (most recent call last):
|
282
|
+
|
283
|
+
File "<string>", line 1, in <module>
|
284
|
+
|
285
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\spawn.py", line 99, in spawn_main
|
286
|
+
|
287
|
+
new_handle = reduction.steal_handle(parent_pid, pipe_handle)
|
288
|
+
|
289
|
+
File "C:\Users\PC_User\Anaconda3\envs\testpyflan\lib\multiprocessing\reduction.py", line 82, in steal_handle
|
290
|
+
|
291
|
+
_winapi.PROCESS_DUP_HANDLE, False, source_pid)
|
292
|
+
|
293
|
+
OSError: [WinError 87] パラメーターが間違っています。
|
294
|
+
|
295
|
+
```
|