初始化项目,由ModelHub XC社区提供模型

Model: chanifrusydi/gemma-3-270m-lora-finetuned
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-10-08 20:09:28 +08:00
commit 093557082a
13 changed files with 51687 additions and 0 deletions

38
.gitattributes vendored Normal file
View File

@@ -0,0 +1,38 @@
*.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
tokenizer.json filter=lfs diff=lfs merge=lfs -text
gguf/gemma-3-270m-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
gguf/gemma-3-270m-BF16.gguf filter=lfs diff=lfs merge=lfs -text

136
README.md Normal file
View File

@@ -0,0 +1,136 @@
---
base_model: unsloth/gemma-3-270m-it
library_name: transformers
pipeline_tag: text-generation
license: gemma
tags:
- gemma3
- lora
- sft
- unsloth
- gguf
---
# gemma-3-270m-lora-finetuned
A fine-tuned Gemma 3 270M model with LoRA adapters, trained on instruction-following data.
## Model Details
- **Base Model:** unsloth/gemma-3-270m-it
- **Model Type:** LoRA fine-tuned (merged)
- **Language:** English (instruction-tuned)
- **License:** Gemma License
## Available Formats
| Format | File | Use Case |
|--------|------|----------|
| Safetensors | `model.safetensors` | Transformers, vLLM |
| GGUF Q8_0 | `gguf/gemma-3-270m-Q8_0.gguf` | llama.cpp, Ollama |
| GGUF BF16 | `gguf/gemma-3-270m-auto.gguf` | llama.cpp (full precision) |
## Uses
### Direct Use
- Instruction following
- Conversational AI
- Question answering
- Text generation
### Out-of-Scope Use
- Medical or legal advice
- Generating harmful content
- Production use without evaluation
## Training Details
### Training Data
- **Dataset:** mlabonne/FineTome-100k (full dataset)
- **Samples:** ~100,000
- **Data Processing:** Standardized format with Gemma 3 chat template
### Training Hyperparameters
| Parameter | Value |
|-----------|-------|
| Precision | bfloat16 |
| Max Sequence Length | 1024 |
| Per Device Batch Size | 2 |
| Gradient Accumulation Steps | 4 |
| Effective Batch Size | 8 |
| Max Steps | 12,500 |
| Learning Rate | 2e-4 |
| Warmup Steps | 2 |
| Optimizer | adamw_8bit |
| Weight Decay | 0.001 |
| LR Scheduler | linear |
| Seed | 3407 |
### LoRA Configuration
| Parameter | Value |
|-----------|-------|
| LoRA Rank (r) | 128 |
| LoRA Alpha | 128 |
| LoRA Dropout | 0 |
| Bias | none |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
### Training Stats
- **Training Time:** ~98 minutes (1h 38m)
- **Peak VRAM Usage:** 12.4 GB (77.9% of 16 GB)
### Compute Infrastructure
- **Hardware:** NVIDIA RTX 5070 Ti (16 GB VRAM)
- **Framework:** Unsloth, Transformers, TRL
## How to Get Started
### Using Transformers (Safetensors)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("chanifrusydi/gemma-3-270m-lora-finetuned")
tokenizer = AutoTokenizer.from_pretrained("chanifrusydi/gemma-3-270m-lora-finetuned")
messages = [{"role": "user", "content": "Hello, how are you?"}]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
)
output = model.generate(inputs, max_new_tokens=64, temperature=0.7)
print(tokenizer.decode(output[0], skip_special_tokens=True))
```
### Using GGUF (llama.cpp / Ollama)
```bash
# Download GGUF
wget https://huggingface.co/chanifrusydi/gemma-3-270m-lora-finetuned/resolve/main/gguf/gemma-3-270m-Q8_0.gguf
# Run with llama.cpp
./llama-cli -m gemma-3-270m-Q8_0.gguf -p "Hello, how are you?"
# Or import to Ollama
ollama create gemma3-finetuned -f Modelfile
```
## Citation
```bibtex
@misc{gemma-3-270m-lora-finetuned,
author = {chanifrusydi},
title = {gemma-3-270m-lora-finetuned},
publisher = {HuggingFace},
year = {2025}
}
```
## Acknowledgments
- [Unsloth](https://github.com/unslothai/unsloth) for the fast fine-tuning framework
- [Google](https://huggingface.co/google) for the Gemma 3 base model
- [mlabonne](https://huggingface.co/mlabonne) for the FineTome-100k dataset

3
added_tokens.json Normal file
View File

@@ -0,0 +1,3 @@
{
"<image_soft_token>": 262144
}

47
chat_template.jinja Normal file
View File

@@ -0,0 +1,47 @@
{{ bos_token }}
{%- if messages[0]['role'] == 'system' -%}
{%- if messages[0]['content'] is string -%}
{%- set first_user_prefix = messages[0]['content'] + '
' -%}
{%- else -%}
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
' -%}
{%- endif -%}
{%- set loop_messages = messages[1:] -%}
{%- else -%}
{%- set first_user_prefix = "" -%}
{%- set loop_messages = messages -%}
{%- endif -%}
{%- for message in loop_messages -%}
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
{%- endif -%}
{%- if (message['role'] == 'assistant') -%}
{%- set role = "model" -%}
{%- else -%}
{%- set role = message['role'] -%}
{%- endif -%}
{{ '<start_of_turn>' + role + '
' + (first_user_prefix if loop.first else "") }}
{%- if message['content'] is string -%}
{{ message['content'] | trim }}
{%- elif message['content'] is iterable -%}
{%- for item in message['content'] -%}
{%- if item['type'] == 'image' -%}
{{ '<start_of_image>' }}
{%- elif item['type'] == 'text' -%}
{{ item['text'] | trim }}
{%- endif -%}
{%- endfor -%}
{%- else -%}
{{ raise_exception("Invalid content type") }}
{%- endif -%}
{{ '<end_of_turn>
' }}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{ '<start_of_turn>model
' }}
{%- endif -%}

56
config.json Normal file
View File

@@ -0,0 +1,56 @@
{
"_sliding_window_pattern": 6,
"architectures": [
"Gemma3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"attn_logit_softcapping": null,
"bos_token_id": 2,
"dtype": "bfloat16",
"eos_token_id": 106,
"final_logit_softcapping": null,
"head_dim": 256,
"hidden_activation": "gelu_pytorch_tanh",
"hidden_size": 640,
"initializer_range": 0.02,
"intermediate_size": 2048,
"layer_types": [
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention"
],
"max_position_embeddings": 32768,
"model_type": "gemma3_text",
"num_attention_heads": 4,
"num_hidden_layers": 18,
"num_key_value_heads": 1,
"pad_token_id": 0,
"query_pre_attn_scalar": 256,
"rms_norm_eps": 1e-06,
"rope_local_base_freq": 10000.0,
"rope_scaling": null,
"rope_theta": 1000000.0,
"sliding_window": 512,
"transformers_version": "4.57.5",
"unsloth_fixed": true,
"unsloth_version": "2026.1.2",
"use_bidirectional_attention": false,
"use_cache": true,
"vocab_size": 262144
}

14
generation_config.json Normal file
View File

@@ -0,0 +1,14 @@
{
"bos_token_id": 2,
"cache_implementation": "hybrid",
"do_sample": true,
"eos_token_id": [
1,
106
],
"max_length": 32768,
"pad_token_id": 0,
"top_k": 64,
"top_p": 0.95,
"transformers_version": "4.57.5"
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ec455cc490ea190172c40ca835a3c7c68df565f3e32b5766da7fdfd003fc6bb1
size 542834976

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b2f66cf0972a1fd649dfee94cb5461ff718e22f6af8d267337f53bbe3ae9d64
size 291545376

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2083e83246411dae552f918118034a054763301636a3b3841d2d88fde9e5ab85
size 536223056

33
special_tokens_map.json Normal file
View File

@@ -0,0 +1,33 @@
{
"boi_token": "<start_of_image>",
"bos_token": {
"content": "<bos>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eoi_token": "<end_of_image>",
"eos_token": {
"content": "<end_of_turn>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"image_token": "<image_soft_token>",
"pad_token": {
"content": "<pad>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"unk_token": {
"content": "<unk>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a872e3bb510a751b26bd65f61aad05f948c9cf78fe4f787aebd197b393cc4081
size 33384667

3
tokenizer.model Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
size 4689074

51345
tokenizer_config.json Normal file

File diff suppressed because it is too large Load Diff