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

Model: gabriellarson/jupyter-agent-qwen3-4b-thinking-GGUF
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-10-29 18:44:26 +08:00
commit 32ce48fdd9
23 changed files with 372 additions and 0 deletions

56
.gitattributes vendored Normal file
View File

@@ -0,0 +1,56 @@
*.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
jupyter-agent-qwen3-4B-thinking-F16.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ2_M.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ2_S.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ2_XXS.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ3_M.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ3_S.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ3_XXS.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ4_NL.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
jupyter-agent-qwen3-4b-thinking-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text

253
README.md Normal file
View File

@@ -0,0 +1,253 @@
---
license: apache-2.0
library_name: transformers
tags:
- code
- jupyter
- agent
- data-science
- qwen
- thinking
base_model:
- jupyter-agent/jupyter-agent-qwen3-4b-thinking
datasets:
- jupyter-agent/jupyter-agent-dataset
language:
- en
- code
pipeline_tag: text-generation
---
# Jupyter Agent Qwen3-4B Thinking
![image/png](https://cdn-uploads.huggingface.co/production/uploads/650ed7adf141bc34f91a12ae/ZyF9foqe5SLECwkq0dOpT.png)
**Jupyter Agent Qwen3-4B Thinking** is a fine-tuned version of [Qwen3-4B-Thinking-2507](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507) specifically optimized for **data science agentic tasks** in Jupyter notebook environments. This model can execute Python code, analyze datasets, and provide step-by-step reasoning with intermediate computations to solve realistic data analysis problems.
- **Model type:** Causal Language Model (Thinking)
- **Language(s):** English, Python
- **License:** Apache 2.0
- **Finetuned from:** [Qwen/Qwen3-4B-Thinking-2507](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507)
## Key Features
- **Jupyter-native agent** that lives inside notebook environments
- **Code execution** with pandas, numpy, matplotlib, and other data science libraries
- **Step-by-step reasoning** with intermediate computations and thinking traces
- **Dataset-grounded analysis** trained on real Kaggle notebook workflows
- **Tool calling** for structured code execution and final answer generation
## Performance
On the [DABStep benchmark](https://huggingface.co/spaces/adyen/DABstep) for data science tasks:
| Model | Easy Tasks | Hard Tasks |
|-------|------------|------------|
| Qwen3-4B-Thinking-2507 (Base) | 44.0% | 2.1% |
| **Jupyter Agent Qwen3-4B Thinking** | **70.8%** | **3.4%** |
**State-of-the-art performance** for small models on realistic data analysis tasks.
## Model Sources
- **Repository:** [jupyter-agent](https://github.com/huggingface/jupyter-agent)
- **Dataset:** [jupyter-agent-dataset](https://huggingface.co/datasets/jupyter-agent/jupyter-agent-dataset)
- **Blog post:** [Jupyter Agents: training LLMs to reason with notebooks](https://huggingface.co/blog/jupyter-agent-2)
- **Demo:** [Jupyter Agent 2](https://huggingface.co/spaces/lvwerra/jupyter-agent-2)
## Usage
### Basic Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "jupyter-agent/jupyter-agent-qwen3-4b-thinking"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
# Prepare input
prompt = "Analyze this sales dataset and find the top 3 performing products by revenue."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# Generate response
generated_ids = model.generate(
**model_inputs,
max_new_tokens=16384
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
```
### Decoding Thinking and Content
For thinking models, you can extract both the reasoning and final response:
```python
try:
# Find the end of thinking section (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("Thinking:", thinking_content)
print("Response:", content)
```
### Agentic Usage with Tool Calling
The model works best with proper scaffolding for tool calling:
```python
tools = [
{
"type": "function",
"function": {
"name": "execute_code",
"description": "Execute Python code in a Jupyter environment",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Python code to execute"
}
},
"required": ["code"]
}
}
},
{
"type": "function",
"function": {
"name": "final_answer",
"description": "Provide the final answer to the question",
"parameters": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"description": "The final answer"
}
},
"required": ["answer"]
}
}
}
]
# Include tools in the conversation
messages = [
{
"role": "system",
"content": "You are a data science assistant. Use the available tools to analyze data and provide insights."
},
{"role": "user", "content": prompt}
]
```
## Training Details
### Training Data
The model was fine-tuned on the [Jupyter Agent Dataset](https://huggingface.co/datasets/jupyter-agent/jupyter-agent-dataset), which contains:
- **51,389 synthetic notebooks** (~0.2B tokens, total 1B tokens)
- **Dataset-grounded QA pairs** from real Kaggle notebooks
- **Executable reasoning traces** with intermediate computations
- **High-quality educational content** filtered and scored by LLMs
### Training Procedure
- **Base Model:** Qwen3-4B-Thinking-2507
- **Training Method:** Full-parameter fine-tuning (not PEFT)
- **Optimizer:** AdamW with cosine learning rate scheduling
- **Learning Rate:** 5e-6
- **Epochs:** 5 (optimal based on ablation study)
- **Context Length:** 32,768 tokens
- **Batch Size:** Distributed across multiple GPUs
- **Loss:** Assistant-only loss (`assistant_loss_only=True`)
- **Regularization:** NEFTune noise (α=7) for full-parameter training
### Training Infrastructure
- **Framework:** [TRL](https://github.com/huggingface/trl) with [Transformers](https://github.com/huggingface/transformers)
- **Distributed Training:** DeepSpeed ZeRO-2 across multiple nodes
- **Hardware:** Multi-GPU setup with SLURM orchestration
## Evaluation
### Benchmark: DABStep
The model was evaluated on [DABStep](https://huggingface.co/spaces/adyen/DABstep), a benchmark for data science agents with realistic tasks involving:
- **Dataset analysis** with pandas and numpy
- **Visualization** with matplotlib/seaborn
- **Statistical analysis** and business insights
- **Multi-step reasoning** with intermediate computations
The model achieves **26.8% improvement** over the base model and **11.1% improvement** over scaffolding alone.
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/jupyter-agent-2/training_dabstep_easy.png" alt="DABstep Easy Score"/>
We can also see, that the hard score can increase too even though our dataset is focused on easier questions.
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/jupyter-agent-2/training_dabstep_hard.png" alt="DABstep Hard Score"/>
## Limitations and Bias
### Technical Limitations
- **Context window:** Limited to 32K tokens, may struggle with very large notebooks
- **Tool calling format:** Requires specific scaffolding for optimal performance
- **Dataset domains:** Primarily trained on Kaggle-style data science tasks
- **Code execution:** Requires proper sandboxing for safe execution
### Potential Biases
- **Domain bias:** Trained primarily on Kaggle notebooks, may not generalize to all data science workflows
- **Language bias:** Optimized for English and Python, limited multilingual support
- **Task bias:** Focused on structured data analysis, may underperform on unstructured data tasks
### Recommendations
- Use in **sandboxed environments** like [E2B](https://e2b.dev/) for safe code execution
- **Validate outputs** before using in production systems
- **Review generated code** for security and correctness
- Consider **domain adaptation** for specialized use cases
## Ethical Considerations
- **Code Safety:** Always execute generated code in secure, isolated environments
- **Data Privacy:** Be cautious when analyzing sensitive datasets
- **Verification:** Validate all analytical conclusions and insights
- **Attribution:** Acknowledge model assistance in data analysis workflows
## Citation
```bibtex
@misc{jupyteragentqwen3thinking,
title={Jupyter Agent Qwen3-4B Thinking},
author={Baptiste Colle and Hanna Yukhymenko and Leandro von Werra},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/jupyter-agent/jupyter-agent-qwen3-4b-thinking}
}
```
## Related Work
- **Dataset:** [jupyter-agent-dataset](https://huggingface.co/datasets/jupyter-agent/jupyter-agent-dataset)
- **Non-thinking version:** [jupyter-agent-qwen3-4b-instruct](https://huggingface.co/jupyter-agent/jupyter-agent-qwen3-4b-instruct)
- **Base model:** [Qwen3-4B-Thinking-2507](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507)
- **Benchmark:** [DABStep](https://huggingface.co/spaces/adyen/DABstep)
*For more details, see our [blog post](https://huggingface.co/blog/jupyter-agent-2) and [GitHub repository](https://github.com/huggingface/jupyter-agent).*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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