MCPcopy Create free account
hub / github.com/eric-mitchell/direct-preference-optimization / get_remote_file

Function get_remote_file

utils.py:21–37  ·  view source on GitHub ↗
(remote_path, local_path=None)

Source from the content-addressed store, hash-verified

19
20
21def get_remote_file(remote_path, local_path=None):
22 hostname, path = remote_path.split(':')
23 local_hostname = socket.gethostname()
24 if hostname == local_hostname or hostname == local_hostname[:local_hostname.find('.')]:
25 return path
26
27 if local_path is None:
28 local_path = path
29 # local_path = local_path.replace('/scr-ssd', '/scr')
30 if os.path.exists(local_path):
31 return local_path
32 local_dir = os.path.dirname(local_path)
33 os.makedirs(local_dir, exist_ok=True)
34
35 print(f'Copying {hostname}:{path} to {local_path}')
36 os.system(f'scp {remote_path} {local_path}')
37 return local_path
38
39
40def rank0_print(*args, **kwargs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected