Skip to content

Commit f2a8aa4

Browse files
committed
add templates & override env cli
1 parent 7c7d508 commit f2a8aa4

5 files changed

Lines changed: 235 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: "\U0001F41B Bug Report"
2+
description: Submit a bug report to help us improve Optimum Neuron
3+
labels: [ "bug" ]
4+
body:
5+
- type: textarea
6+
id: system-info
7+
attributes:
8+
label: System Info
9+
description: Please share your system info with us. You can run the command optimum-cli env and copy-paste its output below.
10+
render: shell
11+
placeholder: optimum-neuron version, optimum version, platform, python version, ...
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
id: who-can-help
17+
attributes:
18+
label: Who can help?
19+
description: |
20+
Your issue will be replied to more quickly if you can figure out the right person to tag with @
21+
If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
22+
Please tag fewer than 3 people.
23+
24+
- Neuron Training: `@michaelbenayoun`
25+
- Export models to Neuron format: `@JingyaHuang`
26+
- Inference: `@dacorvo`, `@JingyaHuang`
27+
- TGI: `@dacorvo`
28+
- Pipelines: `@philschmid`, `@JingyaHuang`
29+
30+
placeholder: "@Username ..."
31+
32+
- type: checkboxes
33+
id: information-scripts-examples
34+
attributes:
35+
label: Information
36+
description: 'The problem arises when using:'
37+
options:
38+
- label: "The official example scripts"
39+
- label: "My own modified scripts"
40+
41+
- type: checkboxes
42+
id: information-tasks
43+
attributes:
44+
label: Tasks
45+
description: "The tasks I am working on are:"
46+
options:
47+
- label: "An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)"
48+
- label: "My own task or dataset (give details below)"
49+
50+
- type: textarea
51+
id: reproduction
52+
validations:
53+
required: true
54+
attributes:
55+
label: Reproduction (minimal, reproducible, runnable)
56+
description: |
57+
Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
58+
If you have code snippets, error messages, stack traces please provide them here as well.
59+
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
60+
Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.
61+
Providing a **minimal**, **reproducible** reproduction using a **publicly available model** significantly increase the chances of a fix in a timely manner.
62+
63+
placeholder: |
64+
Providing a minimal, reproducible reproduction using a publicly available model significantly increase the chances of a fix in a timely manner.
65+
66+
67+
- type: textarea
68+
id: expected-behavior
69+
validations:
70+
required: true
71+
attributes:
72+
label: Expected behavior
73+
description: "A clear and concise description of what you would expect to happen."

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
blank_issues_enabled: true
2+
version: 2.1
3+
contact_links:
4+
- name: Model checkpoints on the Hugging Face Hub
5+
url: https://huggingface.co/models
6+
about: Open a Pull request / Discussion related to a specific model checkpoint directly on the Hugging Face Hub
7+
- name: Website Related
8+
url: https://github.com/huggingface/hub-docs/issues
9+
about: Feature requests and bug reports related to the website
10+
- name: Forum
11+
url: https://discuss.huggingface.co/
12+
about: General usage questions and community discussions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "\U0001F680 Feature request"
2+
description: Submit a proposal/request a new feature on Optimum Neuron
3+
labels: [ "feature" ]
4+
body:
5+
- type: textarea
6+
id: feature-request
7+
validations:
8+
required: true
9+
attributes:
10+
label: Feature request
11+
description: |
12+
A clear and concise description of the feature proposal. Please provide a link to the paper and code in case they exist.
13+
14+
- type: textarea
15+
id: motivation
16+
validations:
17+
required: true
18+
attributes:
19+
label: Motivation
20+
description: |
21+
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.
22+
23+
24+
- type: textarea
25+
id: contribution
26+
validations:
27+
required: true
28+
attributes:
29+
label: Your contribution
30+
description: |
31+
Is there any way that you could help, e.g. by submitting a PR?

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# What does this PR do?
2+
3+
<!--
4+
Congratulations! You've made it this far! You're not quite done yet though.
5+
6+
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.
7+
8+
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.
9+
10+
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.
11+
-->
12+
13+
<!-- Remove if not applicable -->
14+
15+
Fixes # (issue)
16+
17+
18+
## Before submitting
19+
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
20+
- [ ] Did you make sure to update the documentation with your changes?
21+
- [ ] Did you write any new necessary tests?

optimum/commands/env.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright 2024 The HuggingFace Team. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import platform
15+
import subprocess
16+
from typing import Dict, List, Optional
17+
18+
import huggingface_hub
19+
from pkg_resources import get_distribution
20+
from transformers import __version__ as transformers_version
21+
from transformers.utils import is_torch_available
22+
23+
from ..neuron.utils import is_neuron_available, is_neuronx_available
24+
from ..neuron.version import __sdk_version__ as neuron_sdk_version
25+
from ..neuron.version import __version__ as optimum_neuron_version
26+
from ..version import __version__ as optimum_version
27+
from . import BaseOptimumCLICommand, CommandInfo
28+
29+
30+
class EnvironmentCommand(BaseOptimumCLICommand):
31+
COMMAND = CommandInfo(name="env", help="Get information about the environment used.")
32+
33+
@staticmethod
34+
def format_dict(d):
35+
return "\n".join([f"- {prop}: {val}" for prop, val in d.items()]) + "\n"
36+
37+
@staticmethod
38+
def get_pip_pkgs_version(pkg_list: Optional[List], info: Dict):
39+
if pkg_list is not None:
40+
for pkg in pkg_list:
41+
try:
42+
num_version = get_distribution(pkg).version
43+
except Exception:
44+
num_version = "NA"
45+
info[f"`{pkg}` version"] = num_version
46+
47+
@staticmethod
48+
def print_apt_pkgs():
49+
info = subprocess.run("apt list --installed | grep aws-neuron", capture_output=True, shell=True)
50+
pkgs_list = info.stdout.decode().split("\n")
51+
for pkg in pkgs_list:
52+
print(pkg)
53+
54+
def run(self):
55+
pt_version = "not installed"
56+
if is_torch_available():
57+
import torch
58+
59+
pt_version = torch.__version__
60+
61+
platform_info = {
62+
"Platform": platform.platform(),
63+
"Python version": platform.python_version(),
64+
}
65+
info = {
66+
"`optimum-neuron` version": optimum_neuron_version,
67+
"`neuron-sdk` version": neuron_sdk_version,
68+
"`optimum` version": optimum_version,
69+
"`transformers` version": transformers_version,
70+
"`huggingface_hub` version": huggingface_hub.__version__,
71+
"`torch` version": f"{pt_version}",
72+
}
73+
74+
if is_neuron_available():
75+
neuron_python_pkgs = ["dmlc-tvm", "neuron-cc", "torch-neuron"]
76+
elif is_neuronx_available():
77+
neuron_python_pkgs = [
78+
"aws-neuronx-runtime-discovery",
79+
"libneuronxla",
80+
"neuronx-cc",
81+
"neuronx-distributed",
82+
"neuronx-hwm",
83+
"torch-neuronx",
84+
"torch-xla",
85+
"transformers-neuronx",
86+
]
87+
else:
88+
neuron_python_pkgs = None
89+
90+
self.get_pip_pkgs_version(neuron_python_pkgs, info)
91+
92+
print("\nCopy-and-paste the text below in your GitHub issue:\n")
93+
print("\nPlatform:\n")
94+
print(self.format_dict(platform_info))
95+
print("\nPython packages:\n")
96+
print(self.format_dict(info))
97+
print("\nNeuron Driver:\n")
98+
self.print_apt_pkgs()

0 commit comments

Comments
 (0)