Fill `result` with errors for all target model arch if we can't build processor
(result, error, trace, models_to_create)
| 1059 | |
| 1060 | |
| 1061 | def fill_result_with_error(result, error, trace, models_to_create): |
| 1062 | """Fill `result` with errors for all target model arch if we can't build processor""" |
| 1063 | error = (error, trace) |
| 1064 | result["error"] = error |
| 1065 | |
| 1066 | if "pytorch" in models_to_create: |
| 1067 | result["pytorch"] = {} |
| 1068 | for model_arch in models_to_create["pytorch"]: |
| 1069 | result["pytorch"][model_arch.__name__] = {"model": None, "checkpoint": None, "error": error} |
| 1070 | |
| 1071 | # TODO: check what should we do with error/warning etc. |
| 1072 | # if we can't get any processor, we fill the report with the class name |
| 1073 | # otherwise, we could not build with these obtained processors, as we get the error |
| 1074 | # `error = f"No processor is returned by `convert_processors` for {config_class.__name__}."` |
| 1075 | |
| 1076 | |
| 1077 | def upload_model(model_dir, organization, token): |