Fix Windows path separators breaking relative imports of Hub custom-generate modules (#48951)
Use forward slashes in hub-relative path for relative imports of custom modules
get_cached_module_file recurses into relative imports of a remote
custom_generate/modeling module, building the child module path with
Path(module_file).parent / module_needed. On Windows that yields a
backslash path (e.g. 'custom_generate\beam_search.py') which the Hub
lookup then cannot find:
OSError: transformers-community/group-beam-search does not appear to
have a file named custom_generate\beam_search.py
Normalize with as_posix() so the Hub-relative path keeps forward slashes.
Local filesystem uses of the same value are unaffected (Windows accepts
forward slashes).
Co-authored-by: dltsum <dltsum@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>