optimum-rbln 0.2.1a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- optimum_rbln-0.2.1a0/.github/ISSUE_TEMPLATE/bug_report.md +53 -0
- optimum_rbln-0.2.1a0/.github/ISSUE_TEMPLATE/config.yml +11 -0
- optimum_rbln-0.2.1a0/.github/ISSUE_TEMPLATE/feature_request.md +32 -0
- optimum_rbln-0.2.1a0/.github/ISSUE_TEMPLATE/model_request.md +47 -0
- optimum_rbln-0.2.1a0/.github/pull_request_template.md +59 -0
- optimum_rbln-0.2.1a0/.github/scripts/auto_code_review.py +207 -0
- optimum_rbln-0.2.1a0/.github/scripts/validate_pr_checklist.py +84 -0
- optimum_rbln-0.2.1a0/.github/workflows/auto_code_review.yml +33 -0
- optimum_rbln-0.2.1a0/.github/workflows/check_code_quality.yml +49 -0
- optimum_rbln-0.2.1a0/.github/workflows/deploy-on-tag.yaml +14 -0
- optimum_rbln-0.2.1a0/.github/workflows/deploy.yaml +48 -0
- optimum_rbln-0.2.1a0/.github/workflows/pr-title-check.yaml +59 -0
- optimum_rbln-0.2.1a0/.github/workflows/pr_checklist_validator.yml +33 -0
- optimum_rbln-0.2.1a0/.github/workflows/rbln_dispatch_pytest.yaml +22 -0
- optimum_rbln-0.2.1a0/.github/workflows/rbln_optimum_inference_test.yaml +62 -0
- optimum_rbln-0.2.1a0/.github/workflows/rbln_optimum_pytest.yaml +70 -0
- optimum_rbln-0.2.1a0/.github/workflows/rbln_trigger_on_pr.yaml +96 -0
- optimum_rbln-0.2.1a0/.gitignore +176 -0
- optimum_rbln-0.2.1a0/CODE_OF_CONDUCT.md +132 -0
- optimum_rbln-0.2.1a0/CONTRIBUTING.md +88 -0
- optimum_rbln-0.2.1a0/LICENSE +288 -0
- optimum_rbln-0.2.1a0/PKG-INFO +122 -0
- optimum_rbln-0.2.1a0/README.md +89 -0
- optimum_rbln-0.2.1a0/assets/rbln_logo.png +0 -0
- optimum_rbln-0.2.1a0/examples/audio-classification/run_ast_audio_classification.py +48 -0
- optimum_rbln-0.2.1a0/examples/depth-estimation/run_dpt.py +57 -0
- optimum_rbln-0.2.1a0/examples/image-classification/run_image_classification.py +45 -0
- optimum_rbln-0.2.1a0/examples/image-classification/run_vit_image_classification.py +42 -0
- optimum_rbln-0.2.1a0/examples/image-to-text/run_llava_next_image_to_text.py +108 -0
- optimum_rbln-0.2.1a0/examples/question-answering/run_question_answering.py +43 -0
- optimum_rbln-0.2.1a0/examples/speech-recognition/run_wav2vec2.py +47 -0
- optimum_rbln-0.2.1a0/examples/speech-recognition/run_whisper.py +139 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion.py +33 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_controlnet.py +61 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_img2img.py +52 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_img2img_controlnet.py +76 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_inpaint.py +37 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_lora.py +29 -0
- optimum_rbln-0.2.1a0/examples/stable-diffusion/run_stable_diffusion_multicontrolnet.py +86 -0
- optimum_rbln-0.2.1a0/examples/text-classification/run_bge_m3_text_classification.py +48 -0
- optimum_rbln-0.2.1a0/examples/text-classification/run_bge_reranker_v2_m3_text_classification.py +42 -0
- optimum_rbln-0.2.1a0/examples/text-classification/run_secureBERT.py +78 -0
- optimum_rbln-0.2.1a0/examples/text-classification/run_t5_classification.py +40 -0
- optimum_rbln-0.2.1a0/examples/text-classification/run_twitter_roberta_text_classification.py +92 -0
- optimum_rbln-0.2.1a0/examples/text2text-generation/run_bart_text2text_generation.py +52 -0
- optimum_rbln-0.2.1a0/examples/text2text-generation/run_llama_peft.py +68 -0
- optimum_rbln-0.2.1a0/examples/text2text-generation/run_llama_text2text_generation.py +63 -0
- optimum_rbln-0.2.1a0/pyproject.toml +124 -0
- optimum_rbln-0.2.1a0/scripts/uv-lock.sh +11 -0
- optimum_rbln-0.2.1a0/scripts/uv-sync.sh +8 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/__init__.py +192 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/__version__.py +16 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/__init__.py +94 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/modeling_diffusers.py +371 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/__init__.py +59 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/autoencoders/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/autoencoders/autoencoder_kl.py +238 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/autoencoders/vae.py +83 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/controlnet.py +284 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/transformers/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/transformers/transformer_sd3.py +203 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/unets/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/models/unets/unet_2d_condition.py +342 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/__init__.py +84 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/__init__.py +28 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/multicontrolnet.py +132 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/pipeline_controlnet.py +668 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +640 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +825 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +837 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion/__init__.py +26 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_3/__init__.py +26 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_xl/__init__.py +26 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +31 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/modeling.py +238 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/modeling_base.py +533 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/modeling_config.py +319 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/ops/__init__.py +26 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/ops/attn.py +221 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/ops/flash_attn.py +70 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/ops/kv_cache_update.py +69 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/__init__.py +133 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/modeling_alias.py +66 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/modeling_generic.py +385 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/modeling_rope_utils.py +283 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/__init__.py +104 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/auto/__init__.py +37 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/auto/auto_factory.py +178 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/auto/modeling_auto.py +119 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/bart/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/bart/bart_architecture.py +160 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/bart/modeling_bart.py +126 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/bert/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/bert/modeling_bert.py +98 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/clip/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/clip/modeling_clip.py +190 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/decoderonly/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/decoderonly/decoderonly_architecture.py +959 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/decoderonly/modeling_decoderonly.py +649 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/dpt/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/dpt/modeling_dpt.py +102 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/exaone/__init__.py +32 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/exaone/exaone_architecture.py +96 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/exaone/modeling_exaone.py +55 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gemma/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gemma/gemma_architecture.py +62 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gemma/modeling_gemma.py +43 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gpt2/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gpt2/gpt2_architecture.py +94 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/gpt2/modeling_gpt2.py +47 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/llama/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/llama/llama_architecture.py +28 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/llama/modeling_llama.py +43 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/llava_next/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/llava_next/modeling_llava_next.py +609 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/midm/__init__.py +32 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/midm/midm_architecture.py +148 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/midm/modeling_midm.py +54 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/mistral/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/mistral/mistral_architecture.py +28 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/mistral/modeling_mistral.py +43 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/phi/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/phi/modeling_phi.py +43 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/phi/phi_architecture.py +121 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/qwen2/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/qwen2/modeling_qwen2.py +43 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/qwen2/qwen2_architecture.py +28 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/seq2seq/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/seq2seq/modeling_seq2seq.py +395 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/seq2seq/seq2seq_architecture.py +498 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/t5/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/t5/modeling_t5.py +209 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/t5/t5_architecture.py +172 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/wav2vec2/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/wav2vec2/modeling_wav2vec2.py +126 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/whisper/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/whisper/generation_whisper.py +110 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/whisper/modeling_whisper.py +398 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/whisper/whisper_architecture.py +334 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/xlm_roberta/__init__.py +24 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/models/xlm_roberta/modeling_xlm_roberta.py +101 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/utils/__init__.py +0 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/transformers/utils/rbln_quantization.py +219 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/__init__.py +25 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/decorator_utils.py +95 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/hub.py +131 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/import_utils.py +148 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/logging.py +119 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/model_utils.py +52 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/runtime_utils.py +111 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/save_utils.py +109 -0
- optimum_rbln-0.2.1a0/src/optimum/rbln/utils/submodule.py +137 -0
- optimum_rbln-0.2.1a0/tests/__init__.py +1 -0
- optimum_rbln-0.2.1a0/tests/psnr.py +48 -0
- optimum_rbln-0.2.1a0/tests/requirements_sdxl.txt +2 -0
- optimum_rbln-0.2.1a0/tests/run_stable_diffusion_xl_base.py +32 -0
- optimum_rbln-0.2.1a0/tests/test_base.py +303 -0
- optimum_rbln-0.2.1a0/tests/test_diffusers.py +213 -0
- optimum_rbln-0.2.1a0/tests/test_llm.py +291 -0
- optimum_rbln-0.2.1a0/tests/test_transformers.py +209 -0
- optimum_rbln-0.2.1a0/uv.lock +2059 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
name: 🐛 Bug Report
|
3
|
+
about: Create a report to help us improve optimum-rbln
|
4
|
+
title: '[BUG] '
|
5
|
+
labels: 'bug'
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
### Environment Information
|
10
|
+
- optimum-rbln version:
|
11
|
+
- rebel-compiler version:
|
12
|
+
- Python version:
|
13
|
+
- OS :
|
14
|
+
- RBLN hardware (e.g. ATOM-CA25):
|
15
|
+
|
16
|
+
### Description
|
17
|
+
A clear and concise description of what the bug is.
|
18
|
+
|
19
|
+
### Steps To Reproduce
|
20
|
+
1. Model/code being used
|
21
|
+
```python
|
22
|
+
# Your code here
|
23
|
+
```
|
24
|
+
|
25
|
+
2. Steps to reproduce the behavior:
|
26
|
+
1.
|
27
|
+
2.
|
28
|
+
3.
|
29
|
+
|
30
|
+
### Expected Behavior
|
31
|
+
A clear and concise description of what you expected to happen.
|
32
|
+
|
33
|
+
### Actual Behavior
|
34
|
+
A clear and concise description of what actually happened.
|
35
|
+
|
36
|
+
### Error Message
|
37
|
+
If applicable, paste the full error message here:
|
38
|
+
```
|
39
|
+
Error message and stack trace
|
40
|
+
```
|
41
|
+
|
42
|
+
### Model Information
|
43
|
+
- Model name/type:
|
44
|
+
- Model source (HuggingFace/Custom):
|
45
|
+
- Task type:
|
46
|
+
|
47
|
+
### Additional Context
|
48
|
+
- Have you modified the original model?
|
49
|
+
- Are you using quantization?
|
50
|
+
- Any other relevant information about your setup or use case
|
51
|
+
|
52
|
+
### Logs
|
53
|
+
Please include relevant logs, screenshots, or other diagnostic information if available.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
blank_issues_enabled: false
|
2
|
+
contact_links:
|
3
|
+
- name: 📚 Documentation
|
4
|
+
url: https://docs.rbln.ai/software/optimum/optimum_rbln.html
|
5
|
+
about: Check our documentation before creating an issue
|
6
|
+
- name: 🛠️ Developers Community
|
7
|
+
url: https://discuss.rebellions.ai/
|
8
|
+
about: Join our developers community
|
9
|
+
- name: 📧 Email Support
|
10
|
+
url: mailto:support@rebellions.ai
|
11
|
+
about: Contact our support team
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
name: 🚀 Feature Request
|
3
|
+
about: Suggest an idea for optimum-rbln
|
4
|
+
title: '[FEATURE] '
|
5
|
+
labels: 'enhancement'
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
### Is your feature request related to a problem?
|
10
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
11
|
+
|
12
|
+
### Describe the solution you'd like
|
13
|
+
A clear and concise description of what you want to happen.
|
14
|
+
|
15
|
+
### Describe alternatives you've considered
|
16
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
17
|
+
|
18
|
+
### Use Case
|
19
|
+
Please describe the use case for this feature in detail:
|
20
|
+
- Who would use this feature?
|
21
|
+
- What is the expected workflow?
|
22
|
+
- What are the benefits?
|
23
|
+
|
24
|
+
### Technical Details
|
25
|
+
If applicable, provide technical details about:
|
26
|
+
- Required model architectures
|
27
|
+
- Hardware requirements
|
28
|
+
- Performance expectations
|
29
|
+
- API design suggestions
|
30
|
+
|
31
|
+
### Additional context
|
32
|
+
Add any other context, code examples, or references about the feature request here.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
name: 🎯 New Model Support Request
|
3
|
+
about: Request support for a new model in optimum-rbln
|
4
|
+
title: '[MODEL] '
|
5
|
+
labels: 'model-request'
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
### Model Information
|
10
|
+
- Model name:
|
11
|
+
- Model link (Hugging Face/Paper/GitHub):
|
12
|
+
- Task type (e.g., Text Generation, Image Classification):
|
13
|
+
|
14
|
+
### Model Details
|
15
|
+
- Input modality (Text/Image/Audio/Other):
|
16
|
+
- Output modality (Text/Image/Audio/Other):
|
17
|
+
- Model size (parameters):
|
18
|
+
- Required memory (if known):
|
19
|
+
|
20
|
+
### Input/Output Tensor Information
|
21
|
+
- Can input/output shapes be inferred from model config? Yes/No
|
22
|
+
- If yes, please explain the relationship:
|
23
|
+
```
|
24
|
+
Example:
|
25
|
+
- Input shape: (batch_size, sequence_length, hidden_size)
|
26
|
+
- sequence_length from config.max_position_embeddings
|
27
|
+
- hidden_size from config.hidden_size
|
28
|
+
- Output shape: (batch_size, sequence_length, vocab_size)
|
29
|
+
- vocab_size from config.vocab_size
|
30
|
+
```
|
31
|
+
- If no, please specify:
|
32
|
+
- Input tensor shapes:
|
33
|
+
- Output tensor shapes:
|
34
|
+
- Dynamic dimensions (if any):
|
35
|
+
|
36
|
+
### Usage Example
|
37
|
+
Please provide a minimal example of how the model is typically used:
|
38
|
+
```python
|
39
|
+
# Example code showing basic model usage
|
40
|
+
```
|
41
|
+
|
42
|
+
### Popularity & Impact
|
43
|
+
Please help us understand the importance and potential impact of this model. You can include metrics such as:
|
44
|
+
- Number of downloads/usage statistics (if available)
|
45
|
+
- Industry adoption examples
|
46
|
+
- Community interest indicators
|
47
|
+
- Any other relevant information demonstrating the model's significance
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Pull Request Description
|
2
|
+
|
3
|
+
## Type of Change
|
4
|
+
<!-- Mark the appropriate option with an [x] -->
|
5
|
+
- [ ] New Model Support
|
6
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
7
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
8
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
9
|
+
- [ ] Documentation update
|
10
|
+
- [ ] Performance improvement
|
11
|
+
- [ ] Code refactoring
|
12
|
+
- [ ] Other (please describe):
|
13
|
+
|
14
|
+
|
15
|
+
## Changes Overview
|
16
|
+
<!-- Provide a brief summary of the changes in this PR -->
|
17
|
+
|
18
|
+
## Motivation and Context
|
19
|
+
<!-- Explain why this change is necessary and what problem it solves -->
|
20
|
+
|
21
|
+
## Checklist
|
22
|
+
<!-- Mark completed items with an [x] -->
|
23
|
+
- [ ] I have performed a self-review of my own code
|
24
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works (If needed)
|
25
|
+
|
26
|
+
## Additional Information
|
27
|
+
<!-- Any additional information, configuration, or data that might be necessary to reproduce the issue or use the new feature -->
|
28
|
+
|
29
|
+
## Related Issues
|
30
|
+
<!-- Link any related issues here using the syntax: Closes #123, Fixes #456 -->
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
----
|
35
|
+
# Conventional commit
|
36
|
+
```
|
37
|
+
type(optional scope): description
|
38
|
+
```
|
39
|
+
----
|
40
|
+
# Type candidate
|
41
|
+
- Model Updates
|
42
|
+
- `model`: Adding New models or Bugfix for existing models
|
43
|
+
- ex) Add LlavaNext
|
44
|
+
- ex) Bugfix Whisper
|
45
|
+
- Enhancements
|
46
|
+
- `performance`: Optimizing some models or this library itself
|
47
|
+
- ex) Loading RBLNModel faster
|
48
|
+
- ex) Optimizing Memory Usage of DecoderOnlyModel
|
49
|
+
- Code Refactor
|
50
|
+
- `refactor`: Re-arrange class architecture, or more.
|
51
|
+
- ex) Refactor Seq2Seq
|
52
|
+
- Documentation
|
53
|
+
- `doc`: Update docstring only
|
54
|
+
- Library Dependencies
|
55
|
+
- `dependency`: Update requirements, something like that.
|
56
|
+
- Other
|
57
|
+
- `other`: None of above.
|
58
|
+
- ex) ci update
|
59
|
+
- ex) pdm update
|
@@ -0,0 +1,207 @@
|
|
1
|
+
# Copyright 2024 Rebellions Inc.
|
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
|
+
|
15
|
+
# Portions of this software are licensed under the Apache License,
|
16
|
+
# Version 2.0. See the NOTICE file distributed with this work for
|
17
|
+
# additional information regarding copyright ownership.
|
18
|
+
|
19
|
+
# All other portions of this software, including proprietary code,
|
20
|
+
# are the intellectual property of Rebellions Inc. and may not be
|
21
|
+
# copied, modified, or distributed without prior written permission
|
22
|
+
# from Rebellions Inc.
|
23
|
+
|
24
|
+
import os
|
25
|
+
import sys
|
26
|
+
|
27
|
+
import google.generativeai as genai
|
28
|
+
import requests
|
29
|
+
from github import Github
|
30
|
+
|
31
|
+
|
32
|
+
model_name = os.environ["GOOGLE_MODEL_ID"]
|
33
|
+
genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
|
34
|
+
max_context_token = 100000
|
35
|
+
force_review = False
|
36
|
+
|
37
|
+
|
38
|
+
def get_pr_diff():
|
39
|
+
api_url = f"https://api.github.com/repos/{os.getenv('GITHUB_REPOSITORY')}/pulls/{os.getenv('PR_NUMBER')}"
|
40
|
+
headers = {
|
41
|
+
"Authorization": f"token {os.getenv('GITHUB_TOKEN')}",
|
42
|
+
"Accept": "application/vnd.github.v3.diff",
|
43
|
+
}
|
44
|
+
response = requests.get(api_url, headers=headers)
|
45
|
+
return response.text if response.status_code == 200 else ""
|
46
|
+
|
47
|
+
|
48
|
+
def get_prompt(diff, pr):
|
49
|
+
system_prompt = """You are an experienced software engineer specializing in code reviews for deep learning libraries. Your task is to review code changes and related pull request (PR) information for `optimum-rbln`, a Python library that optimizes Hugging Face models for execution on RBLN NPUs.
|
50
|
+
|
51
|
+
Focus on providing actionable and constructive feedback. Don't make generalized suggestions."""
|
52
|
+
|
53
|
+
prompt = f"""
|
54
|
+
Review the following code changes(GIT DIFF) along with the pull request (PR) details and provide feedback:
|
55
|
+
|
56
|
+
<PR_DESCRIPTION>
|
57
|
+
title : {pr.title}
|
58
|
+
body :
|
59
|
+
{pr.body[: pr.body.find("## Related Issues")] if pr.body is not None else ""}
|
60
|
+
</PR_DESCRIPTION>
|
61
|
+
|
62
|
+
|
63
|
+
<GIT_DIFF>
|
64
|
+
{diff}
|
65
|
+
</GIT_DIFF>
|
66
|
+
"""
|
67
|
+
return system_prompt, prompt
|
68
|
+
|
69
|
+
|
70
|
+
def translate_review(review):
|
71
|
+
model = genai.GenerativeModel(
|
72
|
+
model_name,
|
73
|
+
system_instruction="You are a professional translator specializing in technical and software-related content. Keep the technical words in English, but understand the whole sentence and rephrase it in Korean.",
|
74
|
+
)
|
75
|
+
prompt = f"""Translate the following English text into Korean, maintaining technical accuracy and clarity. Include ONLY the translation, NO OTHER EXPLANATIONS or RESPONSES as a chatbot. :
|
76
|
+
|
77
|
+
{review}"""
|
78
|
+
response = model.generate_content(prompt)
|
79
|
+
|
80
|
+
return response.text
|
81
|
+
|
82
|
+
|
83
|
+
def review_code(system_prompt, prompt):
|
84
|
+
model = genai.GenerativeModel(model_name, system_instruction=system_prompt)
|
85
|
+
response = model.generate_content(prompt)
|
86
|
+
print(prompt)
|
87
|
+
return response.text
|
88
|
+
|
89
|
+
|
90
|
+
def remove_file_from_diff(diff_content, file_to_remove):
|
91
|
+
lines = diff_content.splitlines()
|
92
|
+
result = []
|
93
|
+
skip = False
|
94
|
+
file_header = f"diff --git a/{file_to_remove} b/{file_to_remove}"
|
95
|
+
|
96
|
+
for line in lines:
|
97
|
+
if line.startswith("diff --git"):
|
98
|
+
if line == file_header:
|
99
|
+
skip = True
|
100
|
+
else:
|
101
|
+
skip = False
|
102
|
+
|
103
|
+
if not skip:
|
104
|
+
result.append(line)
|
105
|
+
|
106
|
+
return "\n".join(result)
|
107
|
+
|
108
|
+
|
109
|
+
def skip_bot(pr):
|
110
|
+
global force_review
|
111
|
+
"""
|
112
|
+
Review if
|
113
|
+
1. last commit messages starts with "[autoreview]"
|
114
|
+
2. last comment contains "/autoreview"
|
115
|
+
"""
|
116
|
+
|
117
|
+
# Check commit message
|
118
|
+
commits = list(pr.get_commits())
|
119
|
+
if len(commits) == 0:
|
120
|
+
return True
|
121
|
+
|
122
|
+
last_commit = commits[-1]
|
123
|
+
try:
|
124
|
+
commit_message = last_commit.raw_data["commit"]["message"]
|
125
|
+
except KeyError:
|
126
|
+
commit_message = ""
|
127
|
+
|
128
|
+
if commit_message.startswith("[autoreview]"):
|
129
|
+
return False
|
130
|
+
|
131
|
+
# Check the last comment
|
132
|
+
comments = list(pr.get_issue_comments())
|
133
|
+
if len(comments) == 0:
|
134
|
+
return True
|
135
|
+
|
136
|
+
last = comments[-1]
|
137
|
+
if last.user.login.find("github-actions") != -1:
|
138
|
+
return True
|
139
|
+
|
140
|
+
if last.body.find("/autoreview") == -1:
|
141
|
+
return True
|
142
|
+
|
143
|
+
if last.reactions["heart"] > 0:
|
144
|
+
return True
|
145
|
+
|
146
|
+
if last.body.find("force") != -1:
|
147
|
+
force_review = True
|
148
|
+
|
149
|
+
last.create_reaction("heart")
|
150
|
+
return False
|
151
|
+
|
152
|
+
|
153
|
+
def main():
|
154
|
+
github_token = os.getenv("GITHUB_TOKEN")
|
155
|
+
pr_number = os.getenv("PR_NUMBER")
|
156
|
+
if not pr_number:
|
157
|
+
pr_number = os.getenv("INPUT_PR_NUMBER")
|
158
|
+
|
159
|
+
if not all([github_token, pr_number]):
|
160
|
+
print("Missing required environment variables")
|
161
|
+
sys.exit(1)
|
162
|
+
|
163
|
+
g = Github(github_token)
|
164
|
+
repo = g.get_repo(os.getenv("GITHUB_REPOSITORY"))
|
165
|
+
pr = repo.get_pull(int(pr_number))
|
166
|
+
|
167
|
+
if skip_bot(pr):
|
168
|
+
print(
|
169
|
+
"To invoke review, Write '/autoreview' and re-run github actions,"
|
170
|
+
" or start the commit message with '[autoreview]'. "
|
171
|
+
)
|
172
|
+
sys.exit(0)
|
173
|
+
|
174
|
+
# Get PR diff
|
175
|
+
diff = get_pr_diff()
|
176
|
+
diff = remove_file_from_diff(diff, "uv.lock")
|
177
|
+
|
178
|
+
# Check diff is available
|
179
|
+
if len(diff) == 0:
|
180
|
+
print("Failed to get the contents of PR Diff. Skipping review.")
|
181
|
+
pr.create_issue_comment("Auto Code Review skipped: Failed to get the diff.")
|
182
|
+
sys.exit(0)
|
183
|
+
|
184
|
+
# check token count
|
185
|
+
system_prompt, prompt = get_prompt(diff, pr)
|
186
|
+
model = genai.GenerativeModel(model_name=model_name, system_instruction=system_prompt)
|
187
|
+
num_tokens = model.count_tokens(prompt).total_tokens
|
188
|
+
if num_tokens > max_context_token and not force_review:
|
189
|
+
msg = f"Diff ({len(diff)}) exceeds maximum allowed tokens ({max_context_token}) > ({num_tokens}). Skipping review."
|
190
|
+
print(msg)
|
191
|
+
pr.create_issue_comment(msg)
|
192
|
+
sys.exit(0)
|
193
|
+
|
194
|
+
# Get Auto review
|
195
|
+
review = review_code(system_prompt, prompt)
|
196
|
+
translation = translate_review(review)
|
197
|
+
|
198
|
+
# Post comment on PR
|
199
|
+
pr.create_issue_comment(f"""# Auto Code Review
|
200
|
+
|
201
|
+
- [참고] Auto Code Review를 invoke하려면, commit message의 시작을 [autoreview]로 시작하거나, "/autoreview" 를 comment로 작성한 후,
|
202
|
+
해당 commit의 github action에서 code review를 re-run 하시면 됩니다.
|
203
|
+
\n\n{review}\n\n{translation}""")
|
204
|
+
|
205
|
+
|
206
|
+
if __name__ == "__main__":
|
207
|
+
main()
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright 2024 Rebellions Inc.
|
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
|
+
|
15
|
+
# Portions of this software are licensed under the Apache License,
|
16
|
+
# Version 2.0. See the NOTICE file distributed with this work for
|
17
|
+
# additional information regarding copyright ownership.
|
18
|
+
|
19
|
+
# All other portions of this software, including proprietary code,
|
20
|
+
# are the intellectual property of Rebellions Inc. and may not be
|
21
|
+
# copied, modified, or distributed without prior written permission
|
22
|
+
# from Rebellions Inc.
|
23
|
+
|
24
|
+
import os
|
25
|
+
import re
|
26
|
+
import sys
|
27
|
+
|
28
|
+
from github import Github
|
29
|
+
|
30
|
+
|
31
|
+
def read_checklist_from_template():
|
32
|
+
template_path = ".github/pull_request_template.md"
|
33
|
+
checklist_items = []
|
34
|
+
|
35
|
+
with open(template_path, "r") as file:
|
36
|
+
content = file.read()
|
37
|
+
# Find the checklist section
|
38
|
+
checklist_section = re.search(r"## Checklist\n(.*?)\n\n", content, re.DOTALL)
|
39
|
+
if checklist_section:
|
40
|
+
checklist = checklist_section.group(1)
|
41
|
+
# Extract individual checklist items
|
42
|
+
checklist_items = re.findall(r"- \[ \] (.*)", checklist)
|
43
|
+
|
44
|
+
return checklist_items
|
45
|
+
|
46
|
+
|
47
|
+
def validate_checklist(body, expected_items):
|
48
|
+
for item in expected_items:
|
49
|
+
if f"- [x] {item}" not in body:
|
50
|
+
print(f"item : {item}")
|
51
|
+
return False
|
52
|
+
return True
|
53
|
+
|
54
|
+
|
55
|
+
def main():
|
56
|
+
github_token = os.getenv("GITHUB_TOKEN")
|
57
|
+
pr_number = os.getenv("PR_NUMBER")
|
58
|
+
repo_name = os.getenv("GITHUB_REPOSITORY")
|
59
|
+
|
60
|
+
if not all([github_token, pr_number, repo_name]):
|
61
|
+
print("Missing required environment variables")
|
62
|
+
sys.exit(1)
|
63
|
+
|
64
|
+
g = Github(github_token)
|
65
|
+
repo = g.get_repo(repo_name)
|
66
|
+
pr = repo.get_pull(int(pr_number))
|
67
|
+
|
68
|
+
expected_items = read_checklist_from_template()
|
69
|
+
|
70
|
+
if not expected_items:
|
71
|
+
print("No checklist items found in the PR template.")
|
72
|
+
sys.exit(1)
|
73
|
+
|
74
|
+
if validate_checklist(pr.body, expected_items):
|
75
|
+
print("All checklist items are marked. PR is valid.")
|
76
|
+
sys.exit(0)
|
77
|
+
else:
|
78
|
+
print(f"expected items : {expected_items}")
|
79
|
+
print("Not all checklist items are marked. PR is invalid.")
|
80
|
+
sys.exit(1)
|
81
|
+
|
82
|
+
|
83
|
+
if __name__ == "__main__":
|
84
|
+
main()
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Auto Code Review
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
env:
|
7
|
+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
8
|
+
GOOGLE_MODEL_ID: ${{ vars.GOOGLE_MODEL_ID }}
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
code-review:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- name: Checkout repository
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
with:
|
17
|
+
fetch-depth: 0
|
18
|
+
|
19
|
+
- name: Set up Python
|
20
|
+
uses: actions/setup-python@v4
|
21
|
+
with:
|
22
|
+
python-version: '3.x'
|
23
|
+
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
python -m pip install --upgrade pip
|
27
|
+
pip install google-generativeai PyGithub
|
28
|
+
|
29
|
+
- name: Run Auto Code Review
|
30
|
+
env:
|
31
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
32
|
+
PR_NUMBER: ${{ github.event.pull_request.number }}
|
33
|
+
run: python .github/scripts/auto_code_review.py
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: check_code_quality
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [main]
|
6
|
+
paths:
|
7
|
+
- "src/**/*.py"
|
8
|
+
- "tests/**/*.py"
|
9
|
+
- "examples/**/*.py"
|
10
|
+
|
11
|
+
pull_request:
|
12
|
+
branches: [main]
|
13
|
+
paths:
|
14
|
+
- "src/**/*.py"
|
15
|
+
- "tests/**/*.py"
|
16
|
+
- "examples/**/*.py"
|
17
|
+
|
18
|
+
concurrency:
|
19
|
+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
20
|
+
cancel-in-progress: true
|
21
|
+
|
22
|
+
jobs:
|
23
|
+
build:
|
24
|
+
strategy:
|
25
|
+
fail-fast: false
|
26
|
+
matrix:
|
27
|
+
python-version: [3.9]
|
28
|
+
os: [ubuntu-latest]
|
29
|
+
|
30
|
+
runs-on: ${{ matrix.os }}
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v4
|
33
|
+
|
34
|
+
- name: Setup uv
|
35
|
+
uses: astral-sh/setup-uv@v3
|
36
|
+
with:
|
37
|
+
enable-cache: true
|
38
|
+
cache-dependency-glob: "uv.lock"
|
39
|
+
|
40
|
+
- name: Setup Python ${{ matrix.python-version }}
|
41
|
+
run: uv python install ${{ matrix.python-version }}
|
42
|
+
|
43
|
+
- name: Install dependencies
|
44
|
+
run: uv sync --frozen --only-group quality
|
45
|
+
|
46
|
+
- name: Check style with ruff
|
47
|
+
run: |
|
48
|
+
uv run --no-sync ruff format --check .
|
49
|
+
uv run --no-sync ruff check .
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: Deploy package to official PyPI
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_call:
|
5
|
+
inputs:
|
6
|
+
version:
|
7
|
+
required: true
|
8
|
+
type: string
|
9
|
+
|
10
|
+
env:
|
11
|
+
PYTHON_VERSION: "3.10"
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
deploy:
|
15
|
+
runs-on: rebel-k8s-runner
|
16
|
+
steps:
|
17
|
+
- name: Checkout the repository
|
18
|
+
uses: actions/checkout@v4
|
19
|
+
with:
|
20
|
+
repository: rebellions-sw/optimum-rbln
|
21
|
+
fetch-depth: 0
|
22
|
+
ref: ${{ inputs.version }}
|
23
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
24
|
+
|
25
|
+
- name: Setup uv
|
26
|
+
uses: astral-sh/setup-uv@v3
|
27
|
+
with:
|
28
|
+
enable-cache: true
|
29
|
+
cache-dependency-glob: "uv.lock"
|
30
|
+
|
31
|
+
- name: Setup Python${{ env.PYTHON_VERSION }}
|
32
|
+
run: uv python install ${{ env.PYTHON_VERSION }}
|
33
|
+
|
34
|
+
- name: Install dependencies
|
35
|
+
run: uv sync --frozen --only-group deploy
|
36
|
+
|
37
|
+
- name: Build package
|
38
|
+
run: uv build
|
39
|
+
|
40
|
+
# "uv publish" seems having problem, so use twine until it's fixed
|
41
|
+
- name: Publish package
|
42
|
+
run: |
|
43
|
+
uv run --no-sync \
|
44
|
+
twine upload \
|
45
|
+
--verbose \
|
46
|
+
-u __token__ \
|
47
|
+
-p ${{ secrets.PYPI_ORG_PASSWORD }} \
|
48
|
+
dist/*
|