Skip to content

Commit 66c3ff0

Browse files
Merge pull request #7 from thewebscraping/feat/mk-docs
chore: mkdocs
2 parents 72134d5 + 5756655 commit 66c3ff0

File tree

9 files changed

+957
-22
lines changed

9 files changed

+957
-22
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
branches: ['master', 'main', 'dev', 'develop']
99

1010
jobs:
11-
build-on-ubuntu:
11+
build:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
max-parallel: 3
@@ -28,3 +28,26 @@ jobs:
2828
python -m black gemma_template
2929
python -m isort gemma_template
3030
python -m flake8 gemma_template
31+
32+
docs:
33+
needs: build
34+
runs-on: ubuntu-latest
35+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Configure Git Credentials
39+
run: |
40+
git config user.name github-actions[bot]
41+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
42+
- uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.10'
45+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
46+
- uses: actions/cache@v4
47+
with:
48+
key: mkdocs-material-${{ env.cache_id }}
49+
path: .cache
50+
restore-keys: |
51+
mkdocs-material-
52+
- run: pip install -r requirements.txt
53+
- run: mkdocs gh-deploy --force
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Custom Templates to Vietnamese Language
2+
Gemma Template uses Jinja2 template.
3+
4+
See also: [`models.Attr`](../../models/#attributes_5)
5+
6+
* * *
7+
8+
# Gemma Fine Tuning Template
9+
```text
10+
<start_of_turn>user
11+
{{ input }}<end_of_turn>
12+
<start_of_turn>model
13+
{{ output }}<end_of_turn>
14+
15+
```
16+
17+
* * *
18+
19+
# Gemma Prompt Template
20+
```text
21+
<start_of_turn>user
22+
{{ input }}<end_of_turn>
23+
<start_of_turn>model
24+
25+
```
26+
27+
* * *
28+
29+
# Input Template
30+
```text
31+
{{ system_prompt }}
32+
{% if instruction %}\n{{ instruction }}\n{% endif %}
33+
{% if prompt_structure %}{{ prompt_structure }}\n{% else %}{{ prompt }}\n{% endif %}
34+
# Văn Bản:
35+
{{ input }}
36+
{% if topic_value %}\nDanh Mục: {{ topic_value }}\n{% endif %}{% if keyword_value %}Từ Khoá: {{ keyword_value }}\n{% endif %}
37+
```
38+
39+
* * *
40+
41+
# Output Template
42+
```text
43+
{% if structure_fields %}{% for field in structure_fields %}## **{{ field.label.custom or field.label.default }}:**\n{% if field.key == 'title' %}### {% endif%}{{ field.value }}\n\n{% endfor %}{% else %}{{ output }}{% endif %}
44+
```
45+
46+
* * *
47+
48+
# Instruction Template
49+
```text
50+
# Vai trò:
51+
Bạn là một biên tập viên nội dung chuyên nghiệp, nhà phân tích ngôn ngữ và chuyên gia đa ngôn ngữ, chuyên về viết có cấu trúc và xử lý văn bản nâng cao.
52+
53+
# Nhiệm Vụ:
54+
Mục tiêu chính của bạn là:
55+
1. Nhiệm vụ chính của bạn là viết lại nội dung được cung cấp theo định dạng có cấu trúc, chuyên nghiệp hơn, đồng thời vẫn giữ nguyên ý định và ý nghĩa ban đầu.
56+
2. Nâng cao khả năng hiểu từ vựng bằng cách phân tích văn bản với unigrams (từ đơn), bigrams (hai từ) và trigrams (ba từ).
57+
3. Đảm bảo phản hồi của bạn tuân thủ nghiêm ngặt định dạng cấu trúc được quy định.
58+
4. Phản hồi bằng ngôn ngữ chính của văn bản đầu vào trừ khi có hướng dẫn thay thế rõ ràng.
59+
60+
# Kỳ Vọng Bổ Sung:
61+
1. Cung cấp phiên bản văn bản đầu vào được viết lại, nâng cao, đảm bảo tính chuyên nghiệp, rõ ràng và cấu trúc được cải thiện.
62+
2. Tập trung vào khả năng đa ngôn ngữ, sử dụng vốn từ vựng phức tạp, ngữ pháp để cải thiện phản hồi của bạn.
63+
3. Giữ nguyên ngữ cảnh và sắc thái văn hóa của văn bản gốc khi viết lại.
64+
{% if topic_value %}\nTopics: {{ topic_value }}\n{% endif %}{% if keyword_value %}Keywords: {{ keyword_value }}\n{% endif %}
65+
66+
# Phân Tích Văn Bản:
67+
Ví Dụ 1: Unigrams (nhóm 1 chữ cái){% for word in unigrams %}\n{{ word }} => Tiếng Việt ({{ language }}){% endfor %}
68+
69+
Phân Tích Văn Bản 1: đây là những từ thông dụng trong tiếng Việt ({{ language }}), cho biết văn bản được viết bằng tiếng Việt ({{ language }}).
70+
71+
Ví Dụ 2: Bigrams (nhóm 2 chữ cái){% for word in bigrams %}\n{{ word }} => Tiếng Việt ({{ language }}){% endfor %}
72+
Phân Tích Văn Bản 2: các từ ghép thường gặp trong Tiếng Việt ({{ language }}) xác nhận bối cảnh ngôn ngữ.
73+
74+
Ví Dụ 3: Trigrams (nhóm 3 chữ cái)\n{% for word in trigrams %}{{ word }} => Tiếng Việt ({{ language }}){% endfor %}
75+
Phân Tích Văn Bản 3: các từ ghép 3 chữ liên tiếp là những từ tiếng Việt sử dụng thường xuyên, xác nhận sự cần thiết phải phản hồi bằng Tiếng Việt ({{ language }}).
76+
77+
# Kết Luận Phân Tích Văn Bản:
78+
Phân tích ngôn ngữ xác nhận văn bản chủ yếu bằng Tiếng Việt ({{ language }}). Do đó, phản hồi phải được cấu trúc và viết bằng Tiếng Việt ({{ language }}). để phù hợp với văn bản và ngữ cảnh gốc.
79+
```
80+
81+
* * *
82+
83+
# Prompt Template
84+
```text
85+
{% if prompt %}\n\n# Đầu Vào Văn Bản:\n{{ prompt }}\n\n{% endif %}{% if structure_fields %}# Định Dạng Cấu Trúc Phản Hồi:
86+
Bạn phải tuân theo cấu trúc phản hồi:
87+
88+
{% for field in structure_fields %}{{ field.label }}\n{% endfor %}
89+
90+
Bằng cách tuân thủ định dạng này, phản hồi sẽ duy trì tính toàn vẹn về mặt ngôn ngữ đồng thời tăng cường tính chuyên nghiệp, cấu trúc và sự phù hợp với mong đợi của người dùng.
91+
{% endif %}
92+
```
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Default Templates
2+
Gemma Template uses Jinja2 template.
3+
4+
See also: [`models.Attr`](../../models/#attributes_5)
5+
6+
* * *
7+
8+
# Gemma Fine Tuning Template
9+
```text
10+
<start_of_turn>user
11+
{{ input }}<end_of_turn>
12+
<start_of_turn>model
13+
{{ output }}<end_of_turn>
14+
15+
```
16+
17+
* * *
18+
19+
# Gemma Prompt Template
20+
```text
21+
<start_of_turn>user
22+
{{ input }}<end_of_turn>
23+
<start_of_turn>model
24+
25+
```
26+
27+
* * *
28+
29+
# Input Template
30+
```text
31+
{{ system_prompt }}
32+
{% if instruction %}\n{{ instruction }}\n{% endif %}
33+
{% if prompt_structure %}{{ prompt_structure }}\n{% else %}{{ prompt }}\n{% endif %}
34+
# Text:
35+
{{ input }}
36+
{% if topic_value %}\nTopics: {{ topic_value }}\n{% endif %}{% if keyword_value %}Keywords: {{ keyword_value }}\n{% endif %}
37+
```
38+
39+
* * *
40+
41+
# Output Template
42+
```text
43+
{% if structure_fields %}{% for field in structure_fields %}## **{{ field.label.custom or field.label.default }}:**\n{% if field.key == 'title' %}### {% endif%}{{ field.value }}\n\n{% endfor %}{% else %}{{ output }}{% endif %}
44+
```
45+
46+
* * *
47+
48+
# Instruction Template
49+
```text
50+
# Role:
51+
You are a highly skilled professional content writer, linguistic analyst, and multilingual expert specializing in structured writing and advanced text processing.
52+
53+
# Task:
54+
Your primary objectives are:
55+
1. Simplification: Rewrite the input text or document to ensure it is accessible and easy to understand for a general audience while preserving the original meaning and essential details.
56+
2. Lexical and Grammatical Analysis: Analyze and refine vocabulary and grammar using unigrams (single words), bigrams (two words), and trigrams (three words) to enhance readability and depth.
57+
3. Structure and Organization: Ensure your response adheres strictly to the prescribed structure format.
58+
4. Language Consistency: Respond in the same language as the input text unless explicitly directed otherwise.
59+
60+
# Additional Guidelines:
61+
1. Provide a rewritten, enhanced version of the input text, ensuring professionalism, clarity, and improved structure.
62+
2. Focus on multilingual proficiency, using complex vocabulary, grammar to improve your responses.
63+
3. Preserve the context and cultural nuances of the original text when rewriting.
64+
65+
# Text Analysis:
66+
Example 1: Unigrams (single words){% for word in unigrams %}\n{{ word }} => {{ language }}{% endfor %}
67+
Text Analysis 3: These are common {{ language }} words, indicating the text is in {{ language }}.
68+
69+
Example 2: Bigrams (two words){% for word in bigrams %}\n{{ word }} => {{ language }}{% endfor %}
70+
Text Analysis 2: Frequent bigrams in {{ language }} confirm the language context.
71+
72+
Example 3: Trigrams (three words){% for word in trigrams %}\n{{ word }} => {{ language }}{% endfor %}
73+
Text Analysis 3: Trigrams further validate the linguistic analysis and the necessity to respond in {{ language }}.
74+
75+
# Conclusion of Text Analysis:
76+
The linguistic analysis confirms the text is predominantly in {{ language }}. Consequently, the response should be structured and written in {{ language }} to align with the original text and context.
77+
```
78+
79+
* * *
80+
81+
# Prompt Template
82+
```text
83+
{% if prompt %}\n\n# Input Text:\n{{ prompt }}\n\n{% endif %}{% if structure_fields %}# Response Structure Format:
84+
You must follow the response structure:
85+
86+
{% for field in structure_fields %}{{ field.label }}\n{% endfor %}
87+
By adhering to this format, the response will maintain linguistic integrity while enhancing professionalism, structure and alignment with user expectations.\n
88+
{% endif %}
89+
```

0 commit comments

Comments
 (0)