Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add issue and PR templates & build optimum env cli for Neuron #463

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -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."
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -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?
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

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?
100 changes: 100 additions & 0 deletions optimum/commands/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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
JingyaHuang marked this conversation as resolved.
Show resolved Hide resolved
return info

@staticmethod
def print_apt_pkgs():
apt = subprocess.Popen(["apt", "list", "--installed"], stdout=subprocess.PIPE)
grep = subprocess.Popen(["grep", "aws-neuron"], stdin=apt.stdout, stdout=subprocess.PIPE)
pkgs_list = list(grep.stdout)
for pkg in pkgs_list:
print(pkg.decode("utf-8").split("\n")[0])

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

info = 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()
Loading