Instructions to use hideax/gemma-2-27b-it-5-q5_k_m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use hideax/gemma-2-27b-it-5-q5_k_m with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="hideax/gemma-2-27b-it-5-q5_k_m", filename="unsloth.Q5_K_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use hideax/gemma-2-27b-it-5-q5_k_m with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M # Run inference directly in the terminal: llama-cli -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M # Run inference directly in the terminal: llama-cli -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M # Run inference directly in the terminal: ./llama-cli -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
Use Docker
docker model run hf.co/hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
- LM Studio
- Jan
- Ollama
How to use hideax/gemma-2-27b-it-5-q5_k_m with Ollama:
ollama run hf.co/hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
- Unsloth Studio
How to use hideax/gemma-2-27b-it-5-q5_k_m with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for hideax/gemma-2-27b-it-5-q5_k_m to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for hideax/gemma-2-27b-it-5-q5_k_m to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for hideax/gemma-2-27b-it-5-q5_k_m to start chatting
- Docker Model Runner
How to use hideax/gemma-2-27b-it-5-q5_k_m with Docker Model Runner:
docker model run hf.co/hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
- Lemonade
How to use hideax/gemma-2-27b-it-5-q5_k_m with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull hideax/gemma-2-27b-it-5-q5_k_m:Q5_K_M
Run and chat with the model
lemonade run user.gemma-2-27b-it-5-q5_k_m-Q5_K_M
List all available models
lemonade list
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Elyza-TV 100を解かせる手順 (松尾研LLM講座最終課題のコンペ評価用)
llama.cpp を使って、google/gemma-2-27bをLoRAファインチューニング後にGGUF量子化したモデルで回答を生成します。
- こちらに推論用のGoogle Colab Noteを共有しましたので、評価時の参考にしてください。
まず、GPUを利用できる形でllama.cppをビルドし直します。
!CMAKE_ARGS="-DLLAMA_CUDA=on" pip install llama-cpp-python[server]
必要なパッケージのインストール
!pip install huggingface_hub
必要なライブラリのインポート
import os
from llama_cpp import Llama
from huggingface_hub import hf_hub_download
モデルをダウンロード
from google.colab import userdata
os.environ['HUGGINGFACE_TOKEN'] = userdata.get('HF_TOKEN')
# Download the model
hf_hub_download(
repo_id="hideax/gemma-2-27b-it-5-q5_k_m",
filename="unsloth.Q5_K_M.gguf",
local_dir="./models"
)
モデルをロード
llm = Llama(
model_path="models/unsloth.Q5_K_M.gguf",
flash_attn=True,
n_gpu_layers=81,
n_batch=1024,
n_ctx=8192,
)
ELYZA-tasks-100-TVの読み込み
import json
datasets = []
with open("/content//elyza-tasks-100-TV_0.jsonl", "r") as f:
item = ""
for line in f:
line = line.strip()
item += line
if item.endswith("}"):
datasets.append(json.loads(item))
item = ""
タスクの実行
from tqdm import tqdm
results = []
for dt in tqdm(datasets):
input = dt["input"]
prompt = f"""### 指示\n{input}\n### 回答\n"""
output = llm(
prompt,
max_tokens=max_tokens,
temperature=temperature,
top_p=top_p,
stop=stop or [],
echo=False
)
prediction = output["choices"][0]["text"].strip()
result = {"task_id": dt["task_id"], "input": input, "output": prediction}
print(result)
results.append(result)
結果をjsonlで保存
model_id = "gemma-2-27b-it-5-Q5_K_M"
with open(f"{model_id}_output.jsonl", 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
利用したモデル
- google/gemma-2-27b
ファインチューニングに利用したデータ
- llm-jp/magpie-sft-v1.0 (apache-2.0 license)
- Downloads last month
- 3
Hardware compatibility
Log In to add your hardware
5-bit
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support