diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 000000000..b93b03135 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,73 @@ +name: "\U0001F41B Bug Report" +description: Submit a bug report to help us improve Optimum Neuron +labels: [ "bug" ] +body: + - type: textarea + id: system-info + attributes: + label: System Info + description: Please share your system info with us. You can run the command optimum-cli env and copy-paste its output below. + render: shell + placeholder: optimum-neuron version, optimum version, platform, python version, ... + validations: + required: true + + - type: textarea + id: who-can-help + attributes: + label: Who can help? + description: | + Your issue will be replied to more quickly if you can figure out the right person to tag with @ + If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**. + Please tag fewer than 3 people. + + - Neuron Training: `@michaelbenayoun` + - Export models to Neuron format: `@JingyaHuang` + - Inference: `@dacorvo`, `@JingyaHuang` + - TGI: `@dacorvo` + - Pipelines: `@philschmid`, `@JingyaHuang` + + placeholder: "@Username ..." + + - type: checkboxes + id: information-scripts-examples + attributes: + label: Information + description: 'The problem arises when using:' + options: + - label: "The official example scripts" + - label: "My own modified scripts" + + - type: checkboxes + id: information-tasks + attributes: + label: Tasks + description: "The tasks I am working on are:" + options: + - label: "An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)" + - label: "My own task or dataset (give details below)" + + - type: textarea + id: reproduction + validations: + required: true + attributes: + label: Reproduction (minimal, reproducible, runnable) + description: | + Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet. + If you have code snippets, error messages, stack traces please provide them here as well. + Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting + Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code. + Providing a **minimal**, **reproducible** reproduction using a **publicly available model** significantly increase the chances of a fix in a timely manner. + + placeholder: | + Providing a minimal, reproducible reproduction using a publicly available model significantly increase the chances of a fix in a timely manner. + + + - type: textarea + id: expected-behavior + validations: + required: true + attributes: + label: Expected behavior + description: "A clear and concise description of what you would expect to happen." \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..c5ffe928a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,12 @@ +blank_issues_enabled: true +version: 2.1 +contact_links: + - name: Model checkpoints on the Hugging Face Hub + url: https://huggingface.co/models + about: Open a Pull request / Discussion related to a specific model checkpoint directly on the Hugging Face Hub + - name: Website Related + url: https://github.com/huggingface/hub-docs/issues + about: Feature requests and bug reports related to the website + - name: Forum + url: https://discuss.huggingface.co/ + about: General usage questions and community discussions \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 000000000..1e17554c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,31 @@ +name: "\U0001F680 Feature request" +description: Submit a proposal/request a new feature on Optimum Neuron +labels: [ "feature" ] +body: + - type: textarea + id: feature-request + validations: + required: true + attributes: + label: Feature request + description: | + A clear and concise description of the feature proposal. Please provide a link to the paper and code in case they exist. + + - type: textarea + id: motivation + validations: + required: true + attributes: + label: Motivation + description: | + Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too. + + + - type: textarea + id: contribution + validations: + required: true + attributes: + label: Your contribution + description: | + Is there any way that you could help, e.g. by submitting a PR? \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..0fe201944 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +# What does this PR do? + + + + + +Fixes # (issue) + + +## Before submitting +- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). +- [ ] Did you make sure to update the documentation with your changes? +- [ ] Did you write any new necessary tests? diff --git a/optimum/commands/env.py b/optimum/commands/env.py new file mode 100644 index 000000000..58ecf8fe3 --- /dev/null +++ b/optimum/commands/env.py @@ -0,0 +1,98 @@ +# Copyright 2024 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import platform +import subprocess +from typing import Dict, List, Optional + +import huggingface_hub +from pkg_resources import get_distribution +from transformers import __version__ as transformers_version +from transformers.utils import is_torch_available + +from ..neuron.utils import is_neuron_available, is_neuronx_available +from ..neuron.version import __sdk_version__ as neuron_sdk_version +from ..neuron.version import __version__ as optimum_neuron_version +from ..version import __version__ as optimum_version +from . import BaseOptimumCLICommand, CommandInfo + + +class EnvironmentCommand(BaseOptimumCLICommand): + COMMAND = CommandInfo(name="env", help="Get information about the environment used.") + + @staticmethod + def format_dict(d): + return "\n".join([f"- {prop}: {val}" for prop, val in d.items()]) + "\n" + + @staticmethod + def get_pip_pkgs_version(pkg_list: Optional[List], info: Dict): + if pkg_list is not None: + for pkg in pkg_list: + try: + num_version = get_distribution(pkg).version + except Exception: + num_version = "NA" + info[f"`{pkg}` version"] = num_version + + @staticmethod + def print_apt_pkgs(): + info = subprocess.run("apt list --installed | grep aws-neuron", capture_output=True, shell=True) + pkgs_list = info.stdout.decode().split("\n") + for pkg in pkgs_list: + print(pkg) + + def run(self): + pt_version = "not installed" + if is_torch_available(): + import torch + + pt_version = torch.__version__ + + platform_info = { + "Platform": platform.platform(), + "Python version": platform.python_version(), + } + info = { + "`optimum-neuron` version": optimum_neuron_version, + "`neuron-sdk` version": neuron_sdk_version, + "`optimum` version": optimum_version, + "`transformers` version": transformers_version, + "`huggingface_hub` version": huggingface_hub.__version__, + "`torch` version": f"{pt_version}", + } + + if is_neuron_available(): + neuron_python_pkgs = ["dmlc-tvm", "neuron-cc", "torch-neuron"] + elif is_neuronx_available(): + neuron_python_pkgs = [ + "aws-neuronx-runtime-discovery", + "libneuronxla", + "neuronx-cc", + "neuronx-distributed", + "neuronx-hwm", + "torch-neuronx", + "torch-xla", + "transformers-neuronx", + ] + else: + neuron_python_pkgs = None + + self.get_pip_pkgs_version(neuron_python_pkgs, info) + + print("\nCopy-and-paste the text below in your GitHub issue:\n") + print("\nPlatform:\n") + print(self.format_dict(platform_info)) + print("\nPython packages:\n") + print(self.format_dict(info)) + print("\nNeuron Driver:\n") + self.print_apt_pkgs()