Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into signbit
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitSgh committed Sep 13, 2023
2 parents 8c53c42 + dfcbb15 commit 5123d8e
Show file tree
Hide file tree
Showing 164 changed files with 3,898 additions and 982 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ivy/utils/backend @VedPatwardhan @CatB1t
ivy/utils/backend/ast_helpers.py @CatB1t

# Ivy Testing
ivy_tests/test_ivy/helpers/ @CatB1t
ivy_tests/test_ivy/helpers/ @sherry30 @CatB1t
ivy_tests/array_api_testing/ @aarsh2001 @hirwa-nshuti

# Docs builder
Expand All @@ -16,6 +16,7 @@ docs/prebuild.sh @KareemMAX
docs/overview/contributing/building_the_docs.rst @KareemMAX
docs/overview/deep_dive/building_the_docs_pipline.rst @KareemMAX
docs/_templates @KareemMAX
docs/demos @KareemMAX

# Docker
docker/* @ricksanchezstoic
Expand Down
74 changes: 54 additions & 20 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
name: Auto Comment
name: Check Semantic and welcome new contributors

on:
pull_request_target:
types: [opened]
types:
- opened
- edited
- synchronize
- reopened
workflow_call:

permissions:
pull-requests: write

jobs:
auto_comment:
semantics:
name: Semantics
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pr-compliance-checks:
name: PR Compliance Checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Comment
uses: actions/github-script@v6
- uses: mtfoley/[email protected]
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Thanks for contributing to Ivy! 😊👏
Here are some of the important points from our Contributing Guidelines 📝:
1. Feel free to ignore the \`run_tests (1)\`, \`run_tests (2)\`, … jobs, and only look at the \`display_test_results\` job. 👀 It contains the following two sections:
- **Combined Test Results:** This shows the results of all the ivy tests that ran on the PR. ✔️
- **New Failures Introduced:** This lists the tests that are passing on main, but fail on the PR Fork. Please try to make sure that there are no such tests. 💪
2. The \`lint / Check formatting / check-formatting\` tests check for the formatting of your code. 📜 If it fails, please check the exact error message in the logs and fix the same. ⚠️🔧
3. Finally, the \`test-docstrings / run-docstring-tests\` check for the changes made in docstrings of the functions. This may be skipped, as well. 📚
Happy coding! 🎉👨‍💻`
})
body-auto-close: false
protected-branch-auto-close: false
body-comment: >
## Issue Reference
In order to be considered for merging, the pull request description must refer to a
specific issue number. This is described in our
[contributing guide](https://unify.ai/docs/ivy/overview/contributing/the_basics.html#todo-list-issues) and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue
number that this PR is meant to address.
welcome:
name: Welcome
runs-on: ubuntu-latest
timeout-minutes: 10
needs: semantics
if: github.event.action == 'opened'
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: |-
Congrats on making your first Pull Request and thanks for supporting Ivy! 🎉
Joing the conversation in our [Discord](https://discord.com/invite/sXyFF8tDtm)
Here are some notes to understand our tests:
- We have merged all the tests in one file called \`display_test_results\` job. 👀 It contains the following two sections:
- **Combined Test Results:** This shows the results of all the ivy tests that ran on the PR. ✔️
- **New Failures Introduced:** This lists the tests that are passing on main, but fail on the PR Fork.
Please try to make sure that there are no such tests. 💪
26 changes: 26 additions & 0 deletions .github/workflows/dockerfile-multiversion-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dockerfile Mutiversion Push

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:

build:
runs-on: ubuntu-latest

steps:
- name: Checkout Ivy 🛎
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Dockerfile
run: |
docker build --progress=plain --no-cache -t unifyai/multiversion:latest -f docker/DockerfileMultiversion .
docker push unifyai/multiversion:latest
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repos:
- id: check-yaml
- id: trailing-whitespace
- id: check-toml
- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
language_version: python3
Expand Down
9 changes: 5 additions & 4 deletions automation_tools/dashboard_automation/update_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@


def make_clickable(url, name):
return '<a href="{}" rel="noopener noreferrer" '.format(
url
) + 'target="_blank"><img src={}></a>'.format(name)
return (
f'<a href="{url}" rel="noopener noreferrer" '
+ f'target="_blank"><img src={name}></a>'
)


def update_test_results():
Expand All @@ -45,7 +46,7 @@ def update_test_results():
res = make_clickable(action_url + run_id, result_config[result])
collection.update_one(
{"_id": test_configs[workflow][1]},
{"$set": {backend + "." + submodule: res}},
{"$set": {f"{backend}.{submodule}": res}},
upsert=True,
)
return
Expand Down
5 changes: 2 additions & 3 deletions determine_test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
test_names = get_all_tests()

# Create a Dictionary of Test Names to Index
tests["index_mapping"] = test_names
tests["tests_mapping"] = {}
tests = {"index_mapping": test_names, "tests_mapping": {}}
for i in range(len(test_names)):
tests["tests_mapping"][test_names[i]] = i

Expand Down Expand Up @@ -47,7 +46,7 @@
for directory in directories:
for file_name in os.listdir(directory):
if file_name.endswith("cover"):
file_name = directory + "/" + file_name
file_name = f"{directory}/{file_name}"
if file_name not in tests:
tests[file_name] = []
with open(file_name) as f:
Expand Down
11 changes: 5 additions & 6 deletions determine_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def main():
modified_files = commit._parse_diff(diff_index)
for file in modified_files:
try:
file_name = file.new_path + ",cover"
file_name = f"{file.new_path},cover"
except: # noqa
continue
if file_name not in tests.keys():
continue
tests_file = tests[file_name]
change = file.diff_parsed
added = set([x - 1 for (x, _) in change["added"]])
deleted = set([x - 1 for (x, _) in change["deleted"]])
added = {x - 1 for (x, _) in change["added"]}
deleted = {x - 1 for (x, _) in change["deleted"]}
updated = added.intersection(deleted)
added = added.difference(updated)
deleted = deleted.difference(updated)
Expand Down Expand Up @@ -121,9 +121,8 @@ def main():
relevant_added_tests.append(test)
break
added_tests = relevant_added_tests
else:
if len(added_tests) > 50:
added_tests = added_tests[:50]
elif len(added_tests) > 50:
added_tests = added_tests[:50]
# Add these new_tests in the Mapping
old_num_tests = len(old_tests)
tests["index_mapping"] += added_tests
Expand Down
2 changes: 1 addition & 1 deletion docker/DockerfileMultiversion
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM debian:buster
WORKDIR /ivy

ARG fw
ARG pycon=3.8.10
ARG pycon=3.10
# Install miniconda
ENV CONDA_DIR /opt/miniconda/

Expand Down
41 changes: 32 additions & 9 deletions docker/requirement_mappings_multiversion.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@

{
"tensorflow": [
{"tensorflow-probability":{"2.12.0":"0.20.0","2.11.0":"0.19.0"}}
],
"jax": ["dm-haiku", "flax",{"jaxlib": {"0.4.10": "0.4.10","0.4.8": "0.4.7"}}],
"numpy": ["numpy"],
"paddle": ["paddlepaddle"],
"mxnet": ["mxnet"],
"torch": ["torch-scatter"]
"tensorflow": [
{
"tensorflow-probability": {
"2.13.0": "0.21.0",
"2.12.0": "0.20.0",
"2.11.0": "0.19.0"
}
}
],
"jax": [
"dm-haiku",
"flax",
{
"jaxlib": {
"0.4.14": "0.4.14",
"0.4.10": "0.4.10",
"0.4.8": "0.4.7"
}
}
],
"numpy": [
"numpy"
],
"paddle": [
"paddlepaddle"
],
"mxnet": [
"mxnet"
],
"torch": [
"torch-scatter"
]
}
2 changes: 1 addition & 1 deletion docs/demos
Submodule demos updated from 0491d7 to 8163e5
28 changes: 16 additions & 12 deletions docs/overview/deep_dive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,43 @@ We're excited for you to get involved! 🦾
| (k) `Formatting <deep_dive/formatting.rst>`_ 📋
| How the code is automatically formatted
|
| (l) `Function Arguments <deep_dive/function_arguments.rst>`_ 📑
| (l) `Ivy Lint <deep_dive/ivy_lint.rst>`_ 🧹
| Ivy's Custom Code Formatters
|
| (m) `Function Arguments <deep_dive/function_arguments.rst>`_ 📑
| How to add the correct function arguments
|
| (m) `Docstrings <deep_dive/docstrings.rst>`_ 📄
| (n) `Docstrings <deep_dive/docstrings.rst>`_ 📄
| How to properly write docstrings
|
| (n) `Docstring Examples <deep_dive/docstring_examples.rst>`_ 💯
| (o) `Docstring Examples <deep_dive/docstring_examples.rst>`_ 💯
| How to add useful examples to the docstrings
|
| (o) `Array API Tests <deep_dive/array_api_tests.rst>`_ 🤝
| (p) `Array API Tests <deep_dive/array_api_tests.rst>`_ 🤝
| How we're borrowing the test suite from the Array API Standard
|
| (p) `Ivy Tests <deep_dive/ivy_tests.rst>`_ 🧪
| (q) `Ivy Tests <deep_dive/ivy_tests.rst>`_ 🧪
| How to add new tests for each Ivy function
|
| (q) `Ivy Frontends <deep_dive/ivy_frontends.rst>`_ ➡
| (r) `Ivy Frontends <deep_dive/ivy_frontends.rst>`_ ➡
| How to implement frontend functions
|
| (r) `Ivy Frontend Tests <deep_dive/ivy_frontends_tests.rst>`_ 🧪
| (s) `Ivy Frontend Tests <deep_dive/ivy_frontends_tests.rst>`_ 🧪
| How to add new tests for each frontend function
|
| (s) `Exception Handling <deep_dive/exception_handling.rst>`_ ⚠
| (t) `Exception Handling <deep_dive/exception_handling.rst>`_ ⚠
| How to handle exceptions and assertions in a function
|
| (t) `Continuous Integration <deep_dive/continuous_integration.rst>`_ 🔁
| (u) `Continuous Integration <deep_dive/continuous_integration.rst>`_ 🔁
| Ivy Tests running on the Repository
|
| (u) `Gradients <deep_dive/gradients.rst>`_ 🔁
| (v) `Gradients <deep_dive/gradients.rst>`_ 🔁
| Everything about our Gradients API
|
| (v) `Operating Modes <deep_dive/operating_modes.rst>`_ 🧮
| (w) `Operating Modes <deep_dive/operating_modes.rst>`_ 🧮
| Everything about modes Ivy can operate in, along with their purposes
|
| (w) `Building the Docs Pipeline <deep_dive/building_the_docs_pipeline.rst>`_ 📚
| (x) `Building the Docs Pipeline <deep_dive/building_the_docs_pipeline.rst>`_ 📚
| How are we building our docs

Expand All @@ -99,6 +102,7 @@ We're excited for you to get involved! 🦾
deep_dive/inplace_updates.rst
deep_dive/function_wrapping.rst
deep_dive/formatting.rst
deep_dive/ivy_lint.rst
deep_dive/function_arguments.rst
deep_dive/docstrings.rst
deep_dive/docstring_examples.rst
Expand Down
8 changes: 4 additions & 4 deletions docs/overview/deep_dive/backend_setting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ It's helpful to look at an example:
.. code-block:: python
x = ivy.array([[2., 3.]])
ivy.get_backend()
ivy.current_backend()
<module 'ivy.functional.backends.numpy' from '/opt/project/ivy/functional/backends/numpy/__init__.py'>
.. code-block:: python
y = ivy.multiply(torch.Tensor([3.]), torch.Tensor([4.]))
ivy.get_backend()
ivy.current_backend()
<module 'ivy.functional.backends.torch' from '/opt/project/ivy/functional/backends/torch/__init__.py'>
.. code-block:: python
ivy.set_backend('jax')
z = ivy.matmul(jax.numpy.array([[2.,3.]]), jax.numpy.array([[5.],[6.]]))
ivy.get_backend()
ivy.current_backend()
<module 'ivy.functional.backends.jax' from '/opt/project/ivy/functional/backends/jax/__init__.py'>
ivy.previous_backend()
ivy.get_backend()
ivy.current_backend()
<module 'ivy.functional.backends.torch' from '/opt/project/ivy/functional/backends/torch/__init__.py'>
In the last example above, the moment any backend is set, it will be used over the `implicit_backend`_.
Expand Down
4 changes: 3 additions & 1 deletion docs/overview/deep_dive/formatting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We use the following linters:
* `autoflake <https://github.com/PyCQA/autoflake>`_
* `docformatter <https://github.com/PyCQA/docformatter>`_
* `pydocstyle <https://github.com/pycqa/pydocstyle>`_
* `ivy-lint <https://github.com/unifyai/lint-hook>`_ (WIP 🚧)
* `ivy-lint <https://github.com/unifyai/lint-hook>`_

You can also take a look at our configuration for linting in `setup.cfg <https://github.com/unifyai/ivy/blob/main/setup.cfg>`_
file.
Expand Down Expand Up @@ -76,6 +76,7 @@ You should expect to see something similar to the following output when you run
flake8...................................................................Passed
docformatter.............................................................Passed
pydocstyle...............................................................Passed
ivy-lint.................................................................Passed
[INFO] Restored changes from ~/.cache/pre-commit/patch1687898304-8072.
[formatting-docs 3516aed563] Test commit
1 file changed, 1 insertion(+)
Expand All @@ -98,6 +99,7 @@ If something goes wrong, you will see the following output:
flake8...................................................................Passed
docformatter.............................................................Passed
pydocstyle...............................................................Passed
ivy-lint.................................................................Passed
[INFO] Restored changes from ~/.cache/pre-commit/patch1687898304-8072.
You will notice that some files have changed if you checked ``git status``, you'll need to add them and commit again.
Expand Down
Loading

0 comments on commit 5123d8e

Please sign in to comment.