| 432 | |
| 433 | |
| 434 | def format_exception(e: Exception): |
| 435 | traceback.print_exc() |
| 436 | msg = '<h3>' + 'ERROR: ' + str(e) + '</h3>' + '\n' |
| 437 | if 'out of GPU memory' in msg: |
| 438 | pass |
| 439 | elif "torch.hub.load('facebookresearch/dinov2'," in traceback.format_exc(): |
| 440 | msg += ('<h4>To use Depth Anything integration in WebUI mode, please add "--disable-safe-unpickle" to the command line flags. ' |
| 441 | 'Alternatively, use Standalone mode. This is a known issue.') |
| 442 | elif "Error(s) in loading state_dict " in traceback.format_exc(): |
| 443 | msg += ('<h4>There was issue during loading the model.' |
| 444 | 'Please add "--disable-safe-unpickle" to the command line flags. This is a known issue.') |
| 445 | elif 'out of GPU memory' not in msg: |
| 446 | msg += \ |
| 447 | 'Please report this issue ' \ |
| 448 | f'<a href="https://github.com/thygate/{REPOSITORY_NAME}/issues">here</a>. ' \ |
| 449 | 'Make sure to provide the full stacktrace: \n' |
| 450 | msg += '<code style="white-space: pre;">' + traceback.format_exc() + '</code>' |
| 451 | return msg |
| 452 | |
| 453 | |
| 454 | def run_generate(*inputs): |