oncu commited on
Commit
6ff818a
·
verified ·
1 Parent(s): f3fe5f6

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -37,3 +37,4 @@ turkish-llama-3-8b-function-calling-q2_k.gguf filter=lfs diff=lfs merge=lfs -tex
37
  turkish-llama-3-8b-function-calling-q3_k_l.gguf filter=lfs diff=lfs merge=lfs -text
38
  turkish-llama-3-8b-function-calling-q4_k_s.gguf filter=lfs diff=lfs merge=lfs -text
39
  turkish-llama-3-8b-function-calling-q3_k_s.gguf filter=lfs diff=lfs merge=lfs -text
 
 
37
  turkish-llama-3-8b-function-calling-q3_k_l.gguf filter=lfs diff=lfs merge=lfs -text
38
  turkish-llama-3-8b-function-calling-q4_k_s.gguf filter=lfs diff=lfs merge=lfs -text
39
  turkish-llama-3-8b-function-calling-q3_k_s.gguf filter=lfs diff=lfs merge=lfs -text
40
+ turkish-llama-3-8b-function-calling.q2_k.gguf filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,12 +1,5 @@
1
  ---
2
- base_model: atasoglu/Turkish-Llama-3-8B-function-calling
3
- datasets:
4
- - atasoglu/turkish-function-calling-20k
5
- language:
6
- - en
7
- - tr
8
- license: apache-2.0
9
- pipeline_tag: text-generation
10
  tags:
11
  - text-generation-inference
12
  - transformers
@@ -14,76 +7,159 @@ tags:
14
  - llama
15
  - trl
16
  - sft
17
- - llama-cpp
18
- - matrixportal
19
- ---
20
-
21
- # oncu/Turkish-Llama-3-8B-function-calling-GGUF
22
- This model was converted to GGUF format from [`atasoglu/Turkish-Llama-3-8B-function-calling`](https://huggingface.co/atasoglu/Turkish-Llama-3-8B-function-calling) using llama.cpp via the ggml.ai's [all-gguf-same-where](https://huggingface.co/spaces/matrixportal/all-gguf-same-where) space.
23
- Refer to the [original model card](https://huggingface.co/atasoglu/Turkish-Llama-3-8B-function-calling) for more details on the model.
24
-
25
- ## ✅ Quantized Models Download List
26
-
27
- ### 🔍 Recommended Quantizations
28
- - **✨ General CPU Use:** [`Q4_K_M`](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q4_k_m.gguf) (Best balance of speed/quality)
29
- - **📱 ARM Devices:** [`Q4_0`](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q4_0.gguf) (Optimized for ARM CPUs)
30
- - **🏆 Maximum Quality:** [`Q8_0`](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q8_0.gguf) (Near-original quality)
31
-
32
- ### 📦 Full Quantization Options
33
- | 🚀 Download | 🔢 Type | 📝 Notes |
34
- |:---------|:-----|:------|
35
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q2_k.gguf) | ![Q2_K](https://img.shields.io/badge/Q2_K-1A73E8) | Basic quantization |
36
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q3_k_s.gguf) | ![Q3_K_S](https://img.shields.io/badge/Q3_K_S-34A853) | Small size |
37
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q3_k_m.gguf) | ![Q3_K_M](https://img.shields.io/badge/Q3_K_M-FBBC05) | Balanced quality |
38
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q3_k_l.gguf) | ![Q3_K_L](https://img.shields.io/badge/Q3_K_L-4285F4) | Better quality |
39
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q4_0.gguf) | ![Q4_0](https://img.shields.io/badge/Q4_0-EA4335) | Fast on ARM |
40
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q4_k_s.gguf) | ![Q4_K_S](https://img.shields.io/badge/Q4_K_S-673AB7) | Fast, recommended |
41
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q4_k_m.gguf) | ![Q4_K_M](https://img.shields.io/badge/Q4_K_M-673AB7) ⭐ | Best balance |
42
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q5_0.gguf) | ![Q5_0](https://img.shields.io/badge/Q5_0-FF6D01) | Good quality |
43
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q5_k_s.gguf) | ![Q5_K_S](https://img.shields.io/badge/Q5_K_S-0F9D58) | Balanced |
44
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q5_k_m.gguf) | ![Q5_K_M](https://img.shields.io/badge/Q5_K_M-0F9D58) | High quality |
45
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q6_k.gguf) | ![Q6_K](https://img.shields.io/badge/Q6_K-4285F4) 🏆 | Very good quality |
46
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-q8_0.gguf) | ![Q8_0](https://img.shields.io/badge/Q8_0-EA4335) ⚡ | Fast, best quality |
47
- | [Download](https://huggingface.co/oncu/Turkish-Llama-3-8B-function-calling-GGUF/resolve/main/turkish-llama-3-8b-function-calling-f16.gguf) | ![F16](https://img.shields.io/badge/F16-000000) | Maximum accuracy |
48
-
49
- 💡 **Tip:** Use `F16` for maximum precision when quality is critical
50
-
51
-
52
- ---
53
- # 🚀 Applications and Tools for Locally Quantized LLMs
54
- ## 🖥️ Desktop Applications
55
-
56
- | Application | Description | Download Link |
57
- |-----------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
58
- | **Llama.cpp** | A fast and efficient inference engine for GGUF models. | [GitHub Repository](https://github.com/ggml-org/llama.cpp) |
59
- | **Ollama** | A streamlined solution for running LLMs locally. | [Website](https://ollama.com/) |
60
- | **AnythingLLM** | An AI-powered knowledge management tool. | [GitHub Repository](https://github.com/Mintplex-Labs/anything-llm) |
61
- | **Open WebUI** | A user-friendly web interface for running local LLMs. | [GitHub Repository](https://github.com/open-webui/open-webui) |
62
- | **GPT4All** | A user-friendly desktop application supporting various LLMs, compatible with GGUF models. | [GitHub Repository](https://github.com/nomic-ai/gpt4all) |
63
- | **LM Studio** | A desktop application designed to run and manage local LLMs, supporting GGUF format. | [Website](https://lmstudio.ai/) |
64
- | **GPT4All Chat**| A chat application compatible with GGUF models for local, offline interactions. | [GitHub Repository](https://github.com/nomic-ai/gpt4all) |
65
-
66
- ---
67
-
68
- ## 📱 Mobile Applications
69
-
70
- | Application | Description | Download Link |
71
- |-------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
72
- | **ChatterUI** | A simple and lightweight LLM app for mobile devices. | [GitHub Repository](https://github.com/Vali-98/ChatterUI) |
73
- | **Maid** | Mobile Artificial Intelligence Distribution for running AI models on mobile devices. | [GitHub Repository](https://github.com/Mobile-Artificial-Intelligence/maid) |
74
- | **PocketPal AI** | A mobile AI assistant powered by local models. | [GitHub Repository](https://github.com/a-ghorbani/pocketpal-ai) |
75
- | **Layla** | A flexible platform for running various AI models on mobile devices. | [Website](https://www.layla-network.ai/) |
76
-
77
- ---
78
-
79
- ## 🎨 Image Generation Applications
80
-
81
- | Application | Description | Download Link |
82
- |-------------------------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
83
- | **Stable Diffusion** | An open-source AI model for generating images from text. | [GitHub Repository](https://github.com/CompVis/stable-diffusion) |
84
- | **Stable Diffusion WebUI** | A web application providing access to Stable Diffusion models via a browser interface. | [GitHub Repository](https://github.com/AUTOMATIC1111/stable-diffusion-webui) |
85
- | **Local Dream** | Android Stable Diffusion with Snapdragon NPU acceleration. Also supports CPU inference. | [GitHub Repository](https://github.com/xororz/local-dream) |
86
- | **Stable-Diffusion-Android (SDAI)** | An open-source AI art application for Android devices, enabling digital art creation. | [GitHub Repository](https://github.com/ShiftHackZ/Stable-Diffusion-Android) |
87
-
88
  ---
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model: ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1
 
 
 
 
 
 
 
3
  tags:
4
  - text-generation-inference
5
  - transformers
 
7
  - llama
8
  - trl
9
  - sft
10
+ license: apache-2.0
11
+ language:
12
+ - en
13
+ - tr
14
+ datasets:
15
+ - atasoglu/turkish-function-calling-20k
16
+ pipeline_tag: text-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ---
18
 
19
+ # Uploaded model
20
+
21
+ **This model was adapted from [ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1](https://huggingface.co/ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1) and fine-tuned on the [atasoglu/turkish-function-calling-20k](https://huggingface.co/datasets/atasoglu/turkish-function-calling-20k) dataset to perform function calling tasks in Turkish.**
22
+
23
+ - **Developed by:** atasoglu
24
+ - **License:** apache-2.0
25
+ - **Finetuned from model :** ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1
26
+
27
+ This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
28
+
29
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
30
+
31
+ # Usage
32
+
33
+ First, load the model:
34
+
35
+ ```python
36
+ import json
37
+ from unsloth import FastLanguageModel
38
+
39
+ # loading the model and tokenizer
40
+ model, tokenizer = FastLanguageModel.from_pretrained(
41
+ model_name="atasoglu/Turkish-Llama-3-8B-function-calling",
42
+ load_in_4bit=True,
43
+ )
44
+ FastLanguageModel.for_inference(model)
45
+ ```
46
+
47
+ Setup the tools and messages:
48
+
49
+ ```python
50
+ # define the prompt templates
51
+ system_prompt = """Sen yardımsever, akıllı ve fonksiyon çağrısı yapabilen bir asistansın.
52
+ Aşağıda JSON parçası içinde verilen fonksiyonları kullanarak kullanıcının sorusunu uygun şekilde cevaplamanı istiyorum.
53
+
54
+ Fonksiyon çağrısı yaparken uyman gereken talimatlar:
55
+
56
+ * Fonksiyonlar, JSON şeması olarak ifade edilmiştir.
57
+ * Eğer kullanıcının sorusu, bu fonksiyonlardan en az biri kullanılarak cevaplanabiliyorsa; uygun bir fonksiyon çağrısını JSON parçası içinde oluştur.
58
+ * Fonksiyonların parametreleri için asla uydurmalar yapma ve sadece kullanıcının verdiği bilgileri kullan.
59
+ * Eğer kullanıcının sorusu herhangi bir fonksiyon ile cevaplanamıyorsa, sadece "Verilen fonksiyonlarla cevaplanamaz" metnini döndür ve başka bir açıklama yapma.
60
+
61
+ Bu talimatlara uyarak soruları cevaplandır."""
62
+
63
+ user_prompt = """### Fonksiyonlar
64
+
65
+ '''json
66
+ {tools}
67
+ '''
68
+
69
+ ### Soru
70
+
71
+ {query}"""
72
+
73
+ # define the tools and messages
74
+ tools = [
75
+ {
76
+ "type": "function",
77
+ "function": {
78
+ "name": "get_weather",
79
+ "description": "Get current temperature for a given location.",
80
+ "parameters": {
81
+ "type": "object",
82
+ "properties": {
83
+ "location": {
84
+ "type": "string",
85
+ "description": "City and country e.g. Bogotá, Colombia",
86
+ }
87
+ },
88
+ "required": ["location"],
89
+ "additionalProperties": False,
90
+ },
91
+ "strict": True,
92
+ },
93
+ }
94
+ ]
95
+ query = "Paris'te hava şu anda nasıl?"
96
+ messages = [
97
+ {
98
+ "role": "system",
99
+ "content": system_prompt,
100
+ },
101
+ {
102
+ "role": "user",
103
+ "content": user_prompt.format(
104
+ tools=json.dumps(tools, ensure_ascii=False),
105
+ query=query,
106
+ ),
107
+ },
108
+ ]
109
+ ```
110
+
111
+ **NOTE:** Change the *single quote* character to a *backtick* in the user prompt before running to specify the JSON snippet.
112
+
113
+ Then, generate and evaluate the output:
114
+
115
+ ```python
116
+ import re
117
+
118
+
119
+ # define an evaluation function
120
+ def eval_function_calling(text):
121
+ match_ = re.search(r"```json(.*)```", text, re.DOTALL)
122
+ if match_ is None:
123
+ return False, text
124
+ return True, json.loads(match_.group(1).strip())
125
+
126
+
127
+ # tokenize the inputs
128
+ inputs = tokenizer.apply_chat_template(
129
+ messages,
130
+ add_generation_prompt=True,
131
+ return_dict=True,
132
+ return_tensors="pt",
133
+ ).to("cuda")
134
+
135
+ # define generation arguments
136
+ generation_kwargs = dict(
137
+ do_sample=True,
138
+ use_cache=True,
139
+ max_new_tokens=500,
140
+ temperature=0.3,
141
+ top_p=0.9,
142
+ top_k=40,
143
+ )
144
+
145
+ # finally, generate the output
146
+ outputs = model.generate(**inputs, **generation_kwargs)
147
+ output_ids = outputs[:, inputs["input_ids"].shape[1] :]
148
+ generated_texts = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
149
+ has_function_calling, results = eval_function_calling(generated_texts[0])
150
+
151
+ # print the model response
152
+ if has_function_calling:
153
+ for result in results:
154
+ fn = result["function"]
155
+ name, args = fn["name"], fn["arguments"]
156
+ print(f"Calling {name!r} function with these arguments: {args}")
157
+ else:
158
+ print(f"No function call: {results!r}")
159
+ ```
160
+
161
+ Output:
162
+
163
+ ```console
164
+ Calling 'get_weather' function with these arguments: {"location":"Paris, France"}
165
+ ```
turkish-llama-3-8b-function-calling.q2_k.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bb8b5f18ec03d3ca183a3a55ae8a5ae5599c6eed2a549315f4d8dcaf8f9a0c3
3
+ size 3179132352