Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

遇到了如下的问题 #589

Open
slccccccc opened this issue Feb 14, 2025 · 1 comment
Open

遇到了如下的问题 #589

slccccccc opened this issue Feb 14, 2025 · 1 comment

Comments

@slccccccc
Copy link

PGL和PaddlePaddle版本号:
paddlepaddle 2.6.2
pgl 2.2.4
系统环境:
windows11

Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\10453.conda\envs\g\lib\site-packages\pgl\utils\mp_reader.py", line 157, in pipe_reader
p.start()
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\popen_spawn_win32.py", line 93, in init
reduction.dump(process_obj, to_child)
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'multiprocess_reader.._read_into_pipe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\10453.conda\envs\g\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\10453.conda\envs\g\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\10453.conda\envs\g\lib\site-packages\paddle\reader\decorator.py", line 333, in read_worker
for d in r:
File "C:\Users\10453.conda\envs\g\lib\site-packages\pgl\utils\mp_reader.py", line 159, in pipe_reader
raise RuntimeError(
RuntimeError: The program met some problems. If your system is Mac OS and python >= 3.8, please checkout #305 to fix the problem.
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\spawn.py", line 107, in spawn_main
new_handle = reduction.duplicate(pipe_handle,
File "C:\Users\10453.conda\envs\g\lib\multiprocessing\reduction.py", line 79, in duplicate
return _winapi.DuplicateHandle(
OSError: [WinError 6] 句柄无效。

@slccccccc
Copy link
Author

train_loss, train_rmse, train_r2, train_mse = train(model, criterion, optimizer, train_dataloader)
def train(model, criterion, optimizer, dataloader):

model.train()
list_loss = []
train_pred, train_label = [], []
for graphs, proteins_seq, labels in dataloader:
    graphs = graphs.tensor()
    proteins_seq = paddle.to_tensor(proteins_seq)
    labels = paddle.to_tensor(labels)
    
    preds = model(graphs, proteins_seq)
    loss = criterion(preds, labels)
    
    loss.backward()
    optimizer.step()
    optimizer.clear_grad()
    list_loss.append(loss.numpy())
    
    train_pred.append(preds.numpy())
    train_label.append(labels)
    
train_pred = np.concatenate(train_pred, 0).flatten()
train_label = np.concatenate(train_label, 0).flatten()

mse = ((train_label - train_pred) ** 2).mean(axis=0)  
rmse = np.sqrt(mean_squared_error(train_label, train_pred))
r2 = r2_score(train_label, train_pred)
return np.mean(list_loss), rmse, r2, mse 

中间某步导致了这样的报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant