google-research-datasets/tydiqa
Viewer • Updated • 241k • 11.1k • 39
How to use mt628754/qwen3.5-0.8b-ja-rag-answer with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="mt628754/qwen3.5-0.8b-ja-rag-answer")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
pipe(text=messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("mt628754/qwen3.5-0.8b-ja-rag-answer")
model = AutoModelForMultimodalLM.from_pretrained("mt628754/qwen3.5-0.8b-ja-rag-answer", device_map="auto")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = processor.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=256)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use mt628754/qwen3.5-0.8b-ja-rag-answer with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "mt628754/qwen3.5-0.8b-ja-rag-answer"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mt628754/qwen3.5-0.8b-ja-rag-answer",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/mt628754/qwen3.5-0.8b-ja-rag-answer
How to use mt628754/qwen3.5-0.8b-ja-rag-answer with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "mt628754/qwen3.5-0.8b-ja-rag-answer" \
--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": "mt628754/qwen3.5-0.8b-ja-rag-answer",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "mt628754/qwen3.5-0.8b-ja-rag-answer" \
--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": "mt628754/qwen3.5-0.8b-ja-rag-answer",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use mt628754/qwen3.5-0.8b-ja-rag-answer with Docker Model Runner:
docker model run hf.co/mt628754/qwen3.5-0.8b-ja-rag-answer
Qwen/Qwen3.5-0.8B を LoRA で学習した複数の成分を、重みの平均で1つに統合したモデルです。
このリポジトリには 統合済みのモデル全体 が入っています。元のモデルを別に読み込む必要はありません。
RAG の 回答の生成 のためのモデルです。
質問と、検索で得た資料を読み、短い回答と、根拠にした資料の番号を JSON で出力します。
統合のしかた: 重みの種類ごとに、別の成分の組を等分で平均しました。
成分はどれも、元のモデルから「質問+検索で得た資料 → 回答と根拠の番号」の形のデータで学習したものです。学習データは次の5種類です。
| 使う場所 | 学習データ | r | エポック数 | 本数 |
|---|---|---|---|---|
| Attention | B | 16 | 1 | 2(seed 違い) |
| Attention | C | 16 | 1 | 2(seed 違い) |
| MLP | A | 64 | 1 | 1 |
| MLP | A | 16 | 3 | 1 |
| MLP | B | 64 | 1 | 1 |
| MLP | B | 16 | 3 | 1 |
| MLP | B | 64 | 3 | 1 |
| MLP | C | 64 | 1 | 1 |
| MLP | C | 16 | 3 | 1 |
| MLP | D | 64 | 1 | 1 |
| MLP | E | 64 | 1 | 1 |
from transformers import AutoModelForImageTextToText, AutoTokenizer
repo = "mt628754/qwen3.5-0.8b-ja-rag-answer"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForImageTextToText.from_pretrained(
repo,
dtype="auto",
device_map="auto",
)
元のモデル:
学習データ:
このほか、Qwen/Qwen3.5-0.8B で作った合成データを使っています。
利用にあたっては、上記のデータセットと元のモデルのライセンス・利用条件に従ってください。データセット本体は再配布していません。