window -> tuner.restor() -> error

Open
#42,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the restore entry points in ray/tune/tuner.py and ray/tune/impl/tuner_internal.py, especially _restore_from_path_or_uri and the failing pathlib replace call. Reproduce the Windows cross-drive restore using the provided script and paths, then verify that restoration no longer raises WinError 17.

Written by the indexing model from the issue text.

Description

bug P2 tune
What happened + What you expected to happen

When I use the restore function of ray, I get an error as follows

can restore
Traceback (most recent call last):
File "E:\work\mapfalgo\test.py", line 42, in
ans = restore(path)
File "E:\work\mapfalgo\test.py", line 33, in restore
tuner.restore(restore_path)
File "E:\work\mapfalgo\venv\lib\site-packages\ray\tune\tuner.py", line 264, in restore
tuner_internal = TunerInternal(
File "E:\work\mapfalgo\venv\lib\site-packages\ray\tune\impl\tuner_internal.py", line 111, in init
self._restore_from_path_or_uri(
File "E:\work\mapfalgo\venv\lib\site-packages\ray\tune\impl\tuner_internal.py", line 360, in _restore_from_path_or_uri
file_dir.replace(new_exp_path / file_dir.name)
File "C:\Users\TOP\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1381, in replace
self._accessor.replace(self, target)
OSError: [WinError 17] 系统无法将文件移到不同的磁盘驱动器。: 'C:\Users\TOP\AppData\Local\Temp\tmpn84ziw3mtmp_experiment_dir\trainable.pkl' -> 'E:\test\PPO\trainable.pkl'

Versions / Dependencies

ray=2.4.0
python=3.8
window

Reproduction script

my code like this:

def train():
import ray
from ray.rllib.algorithms.ppo import PPOConfig
from ray import air
from ray import tune
ray.init()
config = PPOConfig()
config = config.environment(env="CartPole-v1")
# Use to_dict() to get the old-style python config dict
# when running with tune.
tune.Tuner(
"PPO",
run_config=air.RunConfig(stop={"episode_reward_mean": 200},
local_dir=r'E:\test',
),
param_space=config.to_dict(),
).fit()

def restore(restore_path):
from ray import tune
tuner = tune.Tuner
assert tuner.can_restore(restore_path), "restore_path path error! cannot obtain trainable.pkl!"
print('can restore')
# 从指定的checkpoint恢复训练
tuner.restore(restore_path)
print("restore success!")
return tuner

if name == "main":
train()
path = r'E:\test\PPO'
ans = restore(path)

Issue Severity

Low: It annoys or frustrates me.

Dominant language
Python
Stars
43.9k
Forks
8.1k
Avg merge
4d 12h
Merged PRs (30d)
234

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ray-project/ray

All issues in ray-project/ray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.