初始化项目,由ModelHub XC社区提供模型
Model: kmaurinjones/grammar-llama-3.2-1B Source: Original Platform
This commit is contained in:
47
.gitattributes
vendored
Normal file
47
.gitattributes
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
grammar-llama-3.2-1B.F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
grammar-llama-3.2-1B.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
grammar-llama-3.2-1B.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
grammar-llama-3.2-1B.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
57
Modelfile
Normal file
57
Modelfile
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
FROM /content/kmaurinjones/grammar-llama-3.2-1B/grammar-llama-3.2-1B.F16.gguf
|
||||||
|
TEMPLATE """{{ if .Messages }}
|
||||||
|
{{- if or .System .Tools }}<|start_header_id|>system<|end_header_id|>
|
||||||
|
{{- if .System }}
|
||||||
|
|
||||||
|
{{ .System }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Tools }}
|
||||||
|
|
||||||
|
You are a helpful assistant with tool calling capabilities. When you receive a tool call response, use the output to format an answer to the original use question.
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}<|eot_id|>
|
||||||
|
{{- range $i, $_ := .Messages }}
|
||||||
|
{{- $last := eq (len (slice $.Messages $i)) 1 }}
|
||||||
|
{{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|>
|
||||||
|
{{- if and $.Tools $last }}
|
||||||
|
|
||||||
|
Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
|
||||||
|
|
||||||
|
Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
|
||||||
|
|
||||||
|
{{ $.Tools }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{ .Content }}<|eot_id|>{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
{{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|>
|
||||||
|
{{- if .ToolCalls }}
|
||||||
|
|
||||||
|
{{- range .ToolCalls }}{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}{{ end }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
{{ .Content }}{{ if not $last }}<|eot_id|>{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if eq .Role "tool" }}<|start_header_id|>ipython<|end_header_id|>
|
||||||
|
|
||||||
|
{{ .Content }}<|eot_id|>{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if .System }}<|start_header_id|>system<|end_header_id|>
|
||||||
|
|
||||||
|
{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
|
||||||
|
|
||||||
|
{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
|
||||||
|
|
||||||
|
{{ end }}{{ .Response }}{{ if .Response }}<|eot_id|>{{ end }}"""
|
||||||
|
PARAMETER stop "<|start_header_id|>"
|
||||||
|
PARAMETER stop "<|end_header_id|>"
|
||||||
|
PARAMETER stop "<|eot_id|>"
|
||||||
|
PARAMETER stop "<|eom_id|>"
|
||||||
|
PARAMETER temperature 1.5
|
||||||
|
PARAMETER min_p 0.1
|
||||||
118
README.md
Normal file
118
README.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
---
|
||||||
|
base_model:
|
||||||
|
- unsloth/Llama-3.2-1B-Instruct-bnb-4bit
|
||||||
|
- meta-llama/Llama-3.2-1B
|
||||||
|
tags:
|
||||||
|
- text-generation-inference
|
||||||
|
- transformers
|
||||||
|
- llama
|
||||||
|
- gguf
|
||||||
|
license: apache-2.0
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Uploaded model
|
||||||
|
|
||||||
|
- **Developed by:** kmaurinjones
|
||||||
|
- **License:** apache-2.0
|
||||||
|
- **Finetuned from model :** unsloth/Llama-3.2-1B-Instruct-bnb-4bit
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||||
|
import torch
|
||||||
|
|
||||||
|
model_id = "kmaurinjones/grammar-llama-3.2-1B"
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
model_id,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
device_map="auto"
|
||||||
|
)
|
||||||
|
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "system",
|
||||||
|
"content": "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": """
|
||||||
|
# Instructions
|
||||||
|
- Revise the following transcript in the ways outlined below
|
||||||
|
- Return exactly the revised text and nothing else
|
||||||
|
- Use the custom vocabulary of terms to inform your revision
|
||||||
|
|
||||||
|
# Revisions
|
||||||
|
- Correct grammar
|
||||||
|
- Correct punctuation
|
||||||
|
- Correct spelling
|
||||||
|
- Correct word choice
|
||||||
|
|
||||||
|
# Vocabulary
|
||||||
|
{custom vocabulary terms, separated by newline}
|
||||||
|
|
||||||
|
# Transcript
|
||||||
|
{transcript}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
input_ids = tokenizer.apply_chat_template(
|
||||||
|
messages,
|
||||||
|
add_generation_prompt=True,
|
||||||
|
return_tensors="pt"
|
||||||
|
).to(model.device)
|
||||||
|
|
||||||
|
terminators = [
|
||||||
|
tokenizer.eos_token_id,
|
||||||
|
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
||||||
|
]
|
||||||
|
|
||||||
|
outputs = model.generate(
|
||||||
|
input_ids,
|
||||||
|
# max_new_tokens=256,
|
||||||
|
eos_token_id=terminators,
|
||||||
|
do_sample=True,
|
||||||
|
temperature=0.1,
|
||||||
|
)
|
||||||
|
response = outputs[0]
|
||||||
|
print(tokenizer.decode(response))
|
||||||
|
|
||||||
|
# Example of Model Input
|
||||||
|
"""
|
||||||
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
||||||
|
|
||||||
|
Cutting Knowledge Date: December 2023
|
||||||
|
Today Date: 26 July 2024
|
||||||
|
|
||||||
|
<|eot_id|><|start_header_id|>user<|end_header_id|>
|
||||||
|
|
||||||
|
# Instructions
|
||||||
|
- Revise the following transcript in the ways outlined below
|
||||||
|
- Return exactly the revised text and nothing else
|
||||||
|
- Use the custom vocabulary of terms to inform your revision
|
||||||
|
|
||||||
|
# Revisions
|
||||||
|
- Correct grammar
|
||||||
|
- Correct punctuation
|
||||||
|
- Correct spelling
|
||||||
|
- Correct word choice
|
||||||
|
|
||||||
|
# Vocabulary
|
||||||
|
Seljukid
|
||||||
|
Turbessel
|
||||||
|
Gaziantep
|
||||||
|
Ahlat
|
||||||
|
|
||||||
|
# Transcript
|
||||||
|
in 1111, he was invited to participate in a seljookid campaign. with his troops he joined the main seljookid army. but during the siege of turbessle he died in august 1111. his coffin was sent to ahlat.<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Example of Model Output
|
||||||
|
"""
|
||||||
|
In 1111, he was invited to participate in a Seljukid campaign. With his troops he joined the main Seljukid army. But during the siege of Turbessel he died in August 1111. His coffin was sent to Ahlat.<|eot_id|>
|
||||||
|
"""
|
||||||
|
```
|
||||||
3
config.json
Normal file
3
config.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"model_type": "llama"
|
||||||
|
}
|
||||||
3
grammar-llama-3.2-1B.F16.gguf
Normal file
3
grammar-llama-3.2-1B.F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:87aee7e9843c4f38f0eb4c1ced056f801e39abb1eabf9c5c320b0b8633497221
|
||||||
|
size 2479595904
|
||||||
3
grammar-llama-3.2-1B.Q4_K_M.gguf
Normal file
3
grammar-llama-3.2-1B.Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:12371ba321df05a8c9617ff01941b334853bf782f85fa0436b1d50097d5fee57
|
||||||
|
size 807694720
|
||||||
3
grammar-llama-3.2-1B.Q5_K_M.gguf
Normal file
3
grammar-llama-3.2-1B.Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:80512819e162dd6feddbbf15bd5a931cfd3feaeedcaae86cd98747df7cb1fa15
|
||||||
|
size 911503744
|
||||||
3
grammar-llama-3.2-1B.Q8_0.gguf
Normal file
3
grammar-llama-3.2-1B.Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:7465f2d12ca3957b82e5443747eb83e624acea34460aeb154973a0b60f0ef42a
|
||||||
|
size 1321083264
|
||||||
BIN
grammar-llama.webp
Normal file
BIN
grammar-llama.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
Reference in New Issue
Block a user