Details

    • Sub-task
    • Status: In Progress
    • P2
    • Resolution: Unresolved
    • None
    • None
    • sdk-py-core
    • None

    Description

      Some models in Pytorch instantiating from torch.nn.Module, has extra parameters in the forward function call. These extra parameters can be passed as Dict or as positional arguments. 

      Example of PyTorch models supported by Hugging Face -> https://huggingface.co/bert-base-uncased

      Some torch models on Hugging face

      Eg: https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel

      inputs = {
           input_ids: Tensor1,
           attention_mask: Tensor2,
           token_type_ids: Tensor3,
      } 
      model = BertModel.from_pretrained("bert-base-uncased") # which is a  
      # subclass of torch.nn.Module
      
      outputs = model(**inputs) # model forward method should be expecting the keys in the inputs as the positional arguments.

       

      Transformers integrated in Pytorch is supported by Hugging Face as well. 

       

      Attachments

        Issue Links

          Activity

            People

              yeandy Andy Ye
              Anand Inguva Anand Inguva
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 8h 20m
                  8h 20m