Text Generation
Transformers
Safetensors
PEFT
English
gemma4_text
cybersecurity
cti
cwe-classification
vulnerability-analysis
security
lora
conversational
Eval Results (legacy)
Instructions to use athena129/Gemma4Defense-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use athena129/Gemma4Defense-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="athena129/Gemma4Defense-2B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("athena129/Gemma4Defense-2B") model = AutoModelForCausalLM.from_pretrained("athena129/Gemma4Defense-2B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use athena129/Gemma4Defense-2B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use athena129/Gemma4Defense-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "athena129/Gemma4Defense-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "athena129/Gemma4Defense-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/athena129/Gemma4Defense-2B
- SGLang
How to use athena129/Gemma4Defense-2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "athena129/Gemma4Defense-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "athena129/Gemma4Defense-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "athena129/Gemma4Defense-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "athena129/Gemma4Defense-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use athena129/Gemma4Defense-2B with Docker Model Runner:
docker model run hf.co/athena129/Gemma4Defense-2B
model card: correct license to Apache 2.0 (Gemma 4 upstream is Apache 2.0, not Gemma TOU)
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
-
license_link: https://ai.google.dev/gemma/
|
| 4 |
library_name: transformers
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
base_model: google/gemma-4-E2B-it
|
|
@@ -61,7 +61,7 @@ Under the evaluation protocol of [Foundation-Sec-8B (arXiv:2504.21039)](https://
|
|
| 61 |
| Adapter | LoRA r=64, alpha=64, dropout=0.05 |
|
| 62 |
| Precision | bfloat16 |
|
| 63 |
| Languages | English |
|
| 64 |
-
| License |
|
| 65 |
|
| 66 |
## Intended Use
|
| 67 |
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
license_link: https://ai.google.dev/gemma/docs/gemma_4_license
|
| 4 |
library_name: transformers
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
base_model: google/gemma-4-E2B-it
|
|
|
|
| 61 |
| Adapter | LoRA r=64, alpha=64, dropout=0.05 |
|
| 62 |
| Precision | bfloat16 |
|
| 63 |
| Languages | English |
|
| 64 |
+
| License | Apache 2.0 |
|
| 65 |
|
| 66 |
## Intended Use
|
| 67 |
|