Open HassanFahmy opened 2 weeks ago
Removing the comment at output = self.model(**batch)
gives
return method(ctx, node)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/torch/jit/frontend.py", line 1245, in build_DictComp
raise NotSupportedError(r, "Comprehension ifs are not supported yet")
torch.jit.frontend.NotSupportedError: Comprehension ifs are not supported yet:
File "/usr/lib/python3/dist-packages/composer/models/huggingface.py", line 487
if isinstance(batch, Mapping):
# Further input validation is left to the huggingface forward call
batch = {k: v for k, v in batch.items() if k in self.model_forward_args}
output = self.model(**batch)
else:
save_format='torchscript'
does not seem to be supported by torch/HF yet for the model.
When trying to export a model that was built using the hugging face class and trained with composer to torchscript a line of code in forward function in the
hf_from_composer_checkpoint
function causes the following error.https://github.com/mosaicml/composer/blob/6f18ff8641bd87e13f0d51b3b152e4335e6a4b28/composer/models/huggingface.py#L488C1-L489C1
code to repro: