Skip to content

Is code in openai_transformer.py runnable? #18

@wojtekcz

Description

@wojtekcz

Hi,

I'm trying to instantiate OpenaiTransformer class from openai_transformer.py code in transformer toy problem setting to learn your tsalib a bit. I'm curious to learn how useful tensor shape annotations would be in practice.

However, I've noticed some syntax level errors in code, e.g.:

  1. in Conv1D.forward() body there is self.nx attribute referenced that is not defined.
  2. is "def forward(self, x: (B, T, self.nx)) -> torch.Tensor:" syntax valid? It causes a crash
  3. Attention.forward(self, x: (B, T, self.nx)) -> torch.Tensor: causes a crash "NameError: name 'self' is not defined"
  4. no TransformerConfig class in source file
  5. in class OpenaiTransformer.forward(self, x: (B,T)) -> List[B, T, D]:" last part "[B, T, D]" causes a crash "TypeError: Parameters to generic types must be types. Got Batch."

How would you go about correcting these problems?

Best,
Wojtek

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions