From fb6fd35f1583ad3d88c8cc0287e053546fe1ce90 Mon Sep 17 00:00:00 2001 From: adarshramiyer Date: Wed, 28 May 2025 14:00:49 -0700 Subject: [PATCH 1/2] added a tensor dimension annotation rule --- .continue/rules/tensor-annotation.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .continue/rules/tensor-annotation.md diff --git a/.continue/rules/tensor-annotation.md b/.continue/rules/tensor-annotation.md new file mode 100644 index 000000000..fd6617688 --- /dev/null +++ b/.continue/rules/tensor-annotation.md @@ -0,0 +1,16 @@ +--- +globs: /**/*.{py,ipynb} +description: Clean Tensor Dimension Annotation +--- + +# Tensor Dimension Annotation + +The goal is to help developers easily read, understand, and debug code in pytorch and JAX code where tensor computation plays a major role. + +- Import the typing and jaxtyping libraries and use them throughout according to their best practices (i.e., in a very pythonic way) +- Explicitly include the type of each function argument wherever it is possible to determine, e.g. `image: np.ndarray` +- Explicitly include the return type of each function wherever it is possible to determine, e.g. `def get_x(): -> int:` +- Include jaxtyping annotations of tensor dimensions for all tensor arguments to functions, wherever the dimensions are possible to determine. If the numeric values are unclear, use symbolic notation like "batch", "channel", "height", or "width". Create and use these symbolic dimensions in such a way that they are consistent, semantically meaningful, short, and human-readable. If einops is used, ensure that the symbolic values used there are the same as for the dimension annotations. +- Ensure that the dimension annotations are just strict enough to hold up to all edge cases. +- In the docstring of every function where tensor dimensions play a major role in the computation, incorporate a very short but detailed rationale for the input tensor dimensions. There is no need to do this for very simple functions. +- If it is possible to determine and would assist with readability, include annotations for the tensor dimensions of function outputs as well. From b7e97fcb67e93005558cc6f3b31846e3b5296d73 Mon Sep 17 00:00:00 2001 From: adarshramiyer Date: Wed, 28 May 2025 17:08:06 -0700 Subject: [PATCH 2/2] updated rule to be relevant to continue codebase --- .continue/rules/llm-specificity.md | 11 +++++++++++ .continue/rules/tensor-annotation.md | 16 ---------------- 2 files changed, 11 insertions(+), 16 deletions(-) create mode 100644 .continue/rules/llm-specificity.md delete mode 100644 .continue/rules/tensor-annotation.md diff --git a/.continue/rules/llm-specificity.md b/.continue/rules/llm-specificity.md new file mode 100644 index 000000000..4ff15c9e7 --- /dev/null +++ b/.continue/rules/llm-specificity.md @@ -0,0 +1,11 @@ +--- +globs: core/llm/llms/**/*.{ts,test.ts} +description: Tailor recommendations for LLM code based on which specific LLM is being used. +--- + +# LLM Model Specificity + +- Refer to the file name and names of big classes to determine which LLM is being used in a file. +- Ground all observations and recommendations with knowledge of that LLM. +- Consider items such as context length, architecture, speed, and such. +- Pay attention to the parent classes in these files. diff --git a/.continue/rules/tensor-annotation.md b/.continue/rules/tensor-annotation.md deleted file mode 100644 index fd6617688..000000000 --- a/.continue/rules/tensor-annotation.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -globs: /**/*.{py,ipynb} -description: Clean Tensor Dimension Annotation ---- - -# Tensor Dimension Annotation - -The goal is to help developers easily read, understand, and debug code in pytorch and JAX code where tensor computation plays a major role. - -- Import the typing and jaxtyping libraries and use them throughout according to their best practices (i.e., in a very pythonic way) -- Explicitly include the type of each function argument wherever it is possible to determine, e.g. `image: np.ndarray` -- Explicitly include the return type of each function wherever it is possible to determine, e.g. `def get_x(): -> int:` -- Include jaxtyping annotations of tensor dimensions for all tensor arguments to functions, wherever the dimensions are possible to determine. If the numeric values are unclear, use symbolic notation like "batch", "channel", "height", or "width". Create and use these symbolic dimensions in such a way that they are consistent, semantically meaningful, short, and human-readable. If einops is used, ensure that the symbolic values used there are the same as for the dimension annotations. -- Ensure that the dimension annotations are just strict enough to hold up to all edge cases. -- In the docstring of every function where tensor dimensions play a major role in the computation, incorporate a very short but detailed rationale for the input tensor dimensions. There is no need to do this for very simple functions. -- If it is possible to determine and would assist with readability, include annotations for the tensor dimensions of function outputs as well.