talhakk/agriculture-qa-tokenized
收藏Hugging Face2026-04-19 更新2026-04-26 收录
下载链接:
https://hf-mirror.com/datasets/talhakk/agriculture-qa-tokenized
下载链接
链接失效反馈官方服务:
资源简介:
---
license: apache-2.0
task_categories:
- text-generation
- question-answering
language:
- en
tags:
- agriculture
- crops
- farming
- soil-science
- llm
- gemma
- tokenized
- instruction-tuning
- rag
size_categories:
- 10K<n<100K
---
# 🌾 Agriculture-QA Tokenized Dataset (Gemma Ready)
## 🔍 Overview
The **Agriculture-QA Tokenized Dataset** is a high-performance, ready-to-train version of the original `agriculture-qa` dataset. It has been specifically optimized for Large Language Models (LLMs) like **Gemma, LLaMA, and Mistral**.
It contains **25,410** high-quality question-answer pairs transformed into instruction-style sequences and pre-tokenized for causal language modeling ($CLM$). This removes the preprocessing bottleneck, allowing you to jump straight into fine-tuning.
---
## 🚀 Key Features
* ✅ **25K+ Agriculture QA Pairs:** Comprehensive domain coverage.
* ✅ **Gemma-Compatible:** Pre-tokenized using the Gemma tokenizer.
* ✅ **Instruction-Tuned Format:** Structured specifically for `Question: [text] \n Answer: [text]`.
* ✅ **Efficiency:** No padding applied (enabling dynamic padding during training for 2x faster throughput).
* ✅ **Optimized for LoRA/QLoRA:** Plug-and-play for PEFT libraries.
---
## 🧠 Data Structure
Each entry is a dictionary containing the necessary tensors for training:
| Field | Description |
| :--- | :--- |
| `input_ids` | Tokenized sequence of Question + Answer |
| `attention_mask` | Mask to avoid performing attention on padding |
| `labels` | The target sequence (identical to `input_ids` for Causal LM) |
**Format Example:**
> **Question:** *How to improve wheat yield?* > **Answer:** *Improve soil fertility through balanced NPK application...*
---
## ⚙️ Preprocessing Pipeline
* **Tokenizer:** `google/gemma-2b` (Transformers)
* **Max Length:** 512 tokens
* **Truncation:** Enabled
* **Padding:** None (Recommended: apply dynamic padding at runtime)
* **Parallelization:** Multi-core processed for integrity
---
## 📊 Dataset Statistics
| Feature | Value |
| :--- | :--- |
| **Total Samples** | 25,410 |
| **Format** | Tokenized / Instruction-Style |
| **Max Sequence Length** | 512 |
| **Language** | English |
| **Base Model** | Gemma |
---
## 🧪 Quick Start (Usage)
### Load the dataset
```python
from datasets import load_dataset
dataset = load_dataset("talhakk/agriculture-qa-tokenized")
print(dataset["train"][0])
---
许可证:Apache-2.0
任务类别:
- 文本生成
- 问答
语言:
- 英语
标签:
- 农业
- 作物
- 耕作
- 土壤科学
- 大语言模型(Large Language Model, LLM)
- Gemma
- token化(Tokenized)
- 指令微调(Instruction-tuning)
- 检索增强生成(Retrieval-Augmented Generation, RAG)
样本量级:
- 10K < n < 100K
---
# 🌾 农业问答Token化数据集(适配Gemma)
## 🔍 概览
**农业问答Token化数据集**是原始`agriculture-qa`数据集的高性能可直接训练版本,专为Gemma、LLaMA、Mistral等大语言模型(Large Language Model, LLM)优化设计。
本数据集包含25410条高质量问答对,已转换为指令式序列并针对因果语言建模(Causal Language Modeling, CLM)完成预token化,可直接启动微调流程,省去预处理步骤,消除预处理瓶颈。
## 🚀 核心特性
* ✅ **25000+ 农业问答对**:覆盖全面的农业领域知识
* ✅ **适配Gemma**:使用Gemma分词器完成token化
* ✅ **指令微调格式**:严格遵循`Question: [文本]
Answer: [文本]`的结构化格式
* ✅ **高效性**:未添加填充标记(支持训练时动态填充,可提升2倍吞吐量)
* ✅ **适配LoRA/QLoRA**:可直接与参数高效微调(Parameter-Efficient Fine-Tuning, PEFT)库即插即用
## 🧠 数据结构
每条数据为一个字典,包含训练所需的全部张量:
| 字段 | 描述 |
| :--- | :--- |
| `input_ids` | 问题与答案拼接后的token化序列 |
| `attention_mask` | 用于避免对填充标记执行注意力计算的掩码 |
| `labels` | 目标序列(对于因果语言建模,与`input_ids`完全一致) |
**格式示例:**
> **问题:** *如何提升小麦产量?* → **答案:** *通过平衡施用氮磷钾肥料改善土壤肥力……*
## ⚙️ 预处理流程
* **分词器**:`google/gemma-2b`(基于Hugging Face Transformers库)
* **最大序列长度**:512个Token
* **截断策略**:已启用截断
* **填充策略**:无填充(推荐:在运行时使用动态填充)
* **并行处理**:采用多核并行处理以保证数据完整性
## 📊 数据集统计信息
| 特征 | 数值 |
| :--- | :--- |
| **总样本数** | 25,410 |
| **数据格式** | Token化 / 指令式 |
| **最大序列长度** | 512 |
| **语言** | 英语 |
| **基准模型** | Gemma |
## 🧪 快速上手(使用方法)
### 加载数据集
python
from datasets import load_dataset
dataset = load_dataset("talhakk/agriculture-qa-tokenized")
print(dataset["train"][0])
提供机构:
talhakk


