Update custom_generate/generate.py
Browse files1234 unmodified lines8910111213import torchimport types4 unmodified linesfrom transformers.modeling_utils import PreTrainedModelfrom ..functions_2_patch import _validate_model_kwargs, llama_atten_forwardfrom ..monkey_patching_utils import monkey_patchingfrom ..sep_cache_utils import SepCache1234567891011121314151617181920212223242526272829303132334 unmodified lines38394041424344def debug_imports():import sysimport osimport inspectprint("\n===== 导入调试信息 =====")print(f"当前工作目录: {os.getcwd()}")print(f"脚本路径: {os.path.abspath(__file__)}")print(f"脚本所在目录: {os.path.dirname(os.path.abspath(__file__))}")print(f"父目录: {os.path.dirname(os.path.dirname(os.path.abspath(__file__)))}")print(f"Python路径(sys.path):")for p in sys.path:print(f" - {p}")try:from .. import monkey_patching_utilsprint("成功导入 monkey_patching_utils")except ImportError as e:print(f"导入失败: {e}")print(f"当前包: {__package__}")frame = inspect.currentframe().f_backprint(f"调用栈: {inspect.getframeinfo(frame)}")print("=======================\n")# 在脚本开头调用debug_imports()import torchimport types4 unmodified linesfrom transformers.modeling_utils import PreTrainedModelfrom ..functions_2_patch import _validate_model_kwargs, llama_atten_forwardfrom ..monkey_patching_utils import monkey_patchingfrom ..sep_cache_utils import SepCache
custom_generate/generate.py+31