Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
05f84d9
fix
tastelikefeet Jun 14, 2026
28ab28f
wip
tastelikefeet Jun 15, 2026
30e8412
wip
tastelikefeet Jun 15, 2026
6909de3
wip
tastelikefeet Jun 15, 2026
c7a8b88
wip
tastelikefeet Jun 15, 2026
47a8320
wip
tastelikefeet Jun 15, 2026
18526e5
wip
tastelikefeet Jun 15, 2026
34a3e9a
wip
tastelikefeet Jun 15, 2026
420d0da
wip
tastelikefeet Jun 15, 2026
5f093e5
wip
tastelikefeet Jun 15, 2026
520f797
wip
tastelikefeet Jun 15, 2026
a79fb3b
fix
tastelikefeet Jun 15, 2026
df88556
wip
tastelikefeet Jun 15, 2026
28ee773
wip
tastelikefeet Jun 16, 2026
ffeba0b
wip
tastelikefeet Jun 16, 2026
a762f0f
wip
tastelikefeet Jun 16, 2026
3f4b9ca
wip
tastelikefeet Jun 16, 2026
5a765ba
fix
tastelikefeet Jun 16, 2026
d409fc3
fix
tastelikefeet Jun 16, 2026
d3eb7c4
wip
tastelikefeet Jun 16, 2026
24df8d1
wip
tastelikefeet Jun 16, 2026
ee6ba73
wip
tastelikefeet Jun 16, 2026
12471dc
fix
tastelikefeet Jun 16, 2026
e23c212
fix
tastelikefeet Jun 16, 2026
d6d4896
fix
tastelikefeet Jun 17, 2026
eafb978
Merge commit 'd6d4896cd15669902bec654bdbdb7c8100ad1a82' into feat/ref…
tastelikefeet Jun 17, 2026
5253fbd
add unittests
tastelikefeet Jun 17, 2026
cc7f339
fix
tastelikefeet Jun 18, 2026
2604e77
tui
tastelikefeet Jun 20, 2026
2cb0076
wip
tastelikefeet Jun 20, 2026
e8d3e68
wip
tastelikefeet Jun 20, 2026
484b16c
fix
tastelikefeet Jun 20, 2026
9391d06
fix
tastelikefeet Jun 20, 2026
c55ca45
fix
tastelikefeet Jun 20, 2026
1008082
fix
tastelikefeet Jun 20, 2026
eb34a60
fix
tastelikefeet Jun 20, 2026
12d67bf
fix
tastelikefeet Jun 20, 2026
ab39615
fix
tastelikefeet Jun 21, 2026
084b79b
fix
tastelikefeet Jun 21, 2026
f93bf95
fix
tastelikefeet Jun 21, 2026
dbe4cb7
fix
tastelikefeet Jun 21, 2026
f75f20e
fix
tastelikefeet Jun 21, 2026
182bba1
fix
tastelikefeet Jun 21, 2026
e9f505b
fix
tastelikefeet Jun 21, 2026
e25c459
wip
tastelikefeet Jun 21, 2026
ea80684
fix
tastelikefeet Jun 21, 2026
1c29af2
fix
tastelikefeet Jun 22, 2026
4c93d3f
wip
tastelikefeet Jun 22, 2026
220947d
wip
tastelikefeet Jun 22, 2026
bcfb206
fix
tastelikefeet Jun 22, 2026
1c48804
wip
tastelikefeet Jun 23, 2026
1a17061
fix
tastelikefeet Jun 23, 2026
405aec0
fix
tastelikefeet Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions INSTALL_MEGATRON.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

set -e # Exit immediately on error
export SETUPTOOLS_USE_DISTUTILS=local
export UV_INDEX_URL=${UV_INDEX_URL:-https://mirrors.aliyun.com/pypi/simple/}
echo "=========================================="
echo "Starting deep learning dependencies installation..."
echo "=========================================="
Expand Down Expand Up @@ -53,42 +54,46 @@ TORCH_CUDA_ARCH_LIST=$(get_cuda_arch "$GPU_NAME")
export TORCH_CUDA_ARCH_LIST
echo "Using CUDA architecture: $TORCH_CUDA_ARCH_LIST"

# Install latest base packages
# Install vllm 0.21.x (latest 0.2x uses CUDA 12 toolchain, avoids CUDA 13 CUTLASS conflicts)
echo ""
echo "Installing peft, accelerate, transformers, modelscope..."
pip install --upgrade peft accelerate transformers "modelscope[framework]" --no-cache-dir
echo "Installing vllm 0.21..."
uv pip install "vllm>=0.21,<0.22"

# Install latest vllm
# Install latest base packages
echo ""
echo "Installing latest vllm..."
pip install --upgrade vllm --no-cache-dir
echo "Installing peft, accelerate, transformers, modelscope..."
uv pip install --upgrade peft accelerate transformers "modelscope[framework]"

# Get site-packages path and install transformer_engine and megatron_core
echo ""
echo "Installing transformer_engine and megatron_core..."
SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
echo "Site-packages path: $SITE_PACKAGES"

CUDNN_PATH=$SITE_PACKAGES/nvidia/cudnn \
CPLUS_INCLUDE_PATH=$SITE_PACKAGES/nvidia/cudnn/include \
pip install --no-build-isolation "transformer_engine[pytorch]" --no-cache-dir
export CUDA_HOME=${SITE_PACKAGES}/nvidia/cu13
export PATH=$CUDA_HOME/bin:$PATH
export CPATH=$CUDA_HOME/include:$CPATH
export LIBRARY_PATH=$CUDA_HOME/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib:$LD_LIBRARY_PATH
uv pip install transformer_engine_torch --no-build-isolation

pip install megatron_core mcore_bridge --no-cache-dir
uv pip install megatron_core mcore_bridge

# Install flash-attention (force local build)
# Install flash-attention
# Prefer prebuilt wheel; fall back to source build only if needed.
echo ""
echo "Installing flash-attention (local build for $GPU_NAME)..."
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" \
MAX_JOBS=8 \
FLASH_ATTENTION_FORCE_BUILD=TRUE \
pip install flash-attn --no-build-isolation --no-cache-dir
echo "Installing flash-attention..."
export TORCH_CUDA_ARCH_LIST
export MAX_JOBS=8
pip install flash-attn --no-cache-dir || \
FLASH_ATTENTION_FORCE_BUILD=TRUE pip install flash-attn --no-build-isolation --no-cache-dir

pip install flash-linear-attention -U --no-cache-dir
uv pip install flash-linear-attention --upgrade

# Install numpy
echo ""
echo "Installing numpy==2.2 and deep_gemm..."
pip install numpy==2.2 --no-cache-dir
uv pip install numpy==2.2

# Verify installation
echo ""
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</p>

<p align="center">
<a href="https://twinkle-kit.readthedocs.io/en/latest/">English Documentation</a> &nbsp | &nbsp <a href="https://twinkle-kit.readthedocs.io/zh-cn/latest/">中文文档</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/">Twinkle Web</a> &nbsp
<a href="https://modelscope.github.io/twinkle-web/docs/">English Documentation</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/zh/docs/">中文文档</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/">Twinkle Web</a> &nbsp
</p>

## ✨ What is Twinkle?
Expand Down Expand Up @@ -100,11 +100,11 @@ sh INSTALL_MEGATRON.sh
| DPO multi-LoRA training | transformers | [Script](cookbook/rl/dpo_multi_lora.py) |
| GKD on-policy distillation | megatron | [Script](cookbook/rl/gkd_on_policy.py) |
| GKD off-policy distillation | megatron | [Script](cookbook/rl/gkd_off_policy.py) |
| Tinker client finetuning (self-host) | transformers | [Script](cookbook/client/tinker/self_host) |
| Tinker client finetuning (ModelScope) | transformers | [Script](cookbook/client/tinker/modelscope) |
| Twinkle client finetuning (self-host) | transformers | [Script](cookbook/client/twinkle/self_host) |
| Twinkle client finetuning (ModelScope) | transformers | [Script](cookbook/client/twinkle/modelscope) |
| Server startup scripts | transformers/megatron | [Script](cookbook/client/server) |
| Tinker client finetuning (self-host) | transformers | [Script](cookbook/server_mode/tinker/self_host) |
| Tinker client finetuning (ModelScope) | transformers | [Script](cookbook/server_mode/tinker/modelscope) |
| Twinkle client finetuning (self-host) | transformers | [Script](cookbook/server_mode/twinkle/self_host) |
| Twinkle client finetuning (ModelScope) | transformers | [Script](cookbook/server_mode/twinkle/modelscope) |
| Server startup scripts | transformers/megatron | [Script](cookbook/server_mode/server) |

## Changelog
- 🎉2026-05-20 Support DeepSeek-V4-Flash and DeepSeek-V4-Pro models.
Expand All @@ -122,7 +122,7 @@ sh INSTALL_MEGATRON.sh

We are rolling out training service built atop Twinkle✨ on ModelScope. You may
train via API endpoint `base_url=https://www.modelscope.cn/twinkle`. For more details, please refer to
our [documentation](docs/source_en/Usage%20Guide/Train-as-a-Service.md).
our [documentation](https://modelscope.github.io/twinkle-web/docs/usage-guide/train-as-a-service/).

## Supported Hardware

Expand Down Expand Up @@ -177,7 +177,7 @@ supported on Twinkle✨ framework.
## Sample Code

Below are some of the capabilities demonstrated in the example code. For a complete introduction to training capabilities,
please refer to [Quick Start](docs/source_en/Usage%20Guide/Quick-Start.md) and [cookbook](cookbook).
please refer to [Quick Start](https://modelscope.github.io/twinkle-web/docs/usage-guide/quick-start/) and [cookbook](cookbook).

### Train with Ray

Expand Down
18 changes: 9 additions & 9 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ by <a href="https://modelscope.cn/home">ModelScope</a> & <a href="https://www.cm
</p>

<p align="center">
<a href="https://twinkle-kit.readthedocs.io/en/latest/">英文文档</a> &nbsp | &nbsp <a href="https://twinkle-kit.readthedocs.io/zh-cn/latest/">中文文档</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/">Twinkle 站点</a> &nbsp
<a href="https://modelscope.github.io/twinkle-web/docs/">英文文档</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/zh/docs/">中文文档</a> &nbsp | &nbsp <a href="https://modelscope.github.io/twinkle-web/">Twinkle 站点</a> &nbsp
</p>

## ✨ Twinkle 是什么?
Expand Down Expand Up @@ -94,13 +94,13 @@ sh INSTALL_MEGATRON.sh
| DPO 多 LoRA 训练 | transformers | [脚本](cookbook/rl/dpo_multi_lora.py) |
| GKD 在线蒸馏 | megatron | [脚本](cookbook/rl/gkd_on_policy.py) |
| GKD 离线蒸馏 | megatron | [脚本](cookbook/rl/gkd_off_policy.py) |
| Tinker 客户端微调(自部署) | transformers | [脚本](cookbook/client/tinker/self_host) |
| Tinker 客户端微调(ModelScope) | transformers | [脚本](cookbook/client/tinker/modelscope) |
| Twinkle 客户端微调(自部署) | transformers | [脚本](cookbook/client/twinkle/self_host) |
| Twinkle 客户端微调(ModelScope) | transformers | [脚本](cookbook/client/twinkle/modelscope) |
| 服务端启动脚本 | transformers/megatron | [脚本](cookbook/client/server) |
| Tinker 客户端微调(自部署) | transformers | [脚本](cookbook/server_mode/tinker/self_host) |
| Tinker 客户端微调(ModelScope) | transformers | [脚本](cookbook/server_mode/tinker/modelscope) |
| Twinkle 客户端微调(自部署) | transformers | [脚本](cookbook/server_mode/twinkle/self_host) |
| Twinkle 客户端微调(ModelScope) | transformers | [脚本](cookbook/server_mode/twinkle/modelscope) |
| 服务端启动脚本 | transformers/megatron | [脚本](cookbook/server_mode/server) |

Twinkle✨支持相同的算法接口运行在单GPU、torchrun多机、Ray、Client等各场景下。其算法过程是外露的,非常便于修改和调试。完整的框架介绍请查看[快速开始](docs/source_zh/使用指引/快速开始.md)
Twinkle✨支持相同的算法接口运行在单GPU、torchrun多机、Ray、Client等各场景下。其算法过程是外露的,非常便于修改和调试。完整的框架介绍请查看[快速开始](https://modelscope.github.io/twinkle-web/zh/docs/usage-guide/quick-start/)

## 更新日志
- 🎉2026-05-20 支持DeepSeek-V4-Flash and DeepSeek-V4-Pro系列模型。
Expand All @@ -116,7 +116,7 @@ Twinkle✨支持相同的算法接口运行在单GPU、torchrun多机、Ray、Cl

## ModelScope 的训练服务

我们正在 ModelScope 上推出基于 Twinkle✨ 构建的训练服务。你可以通过 API 端点 `base_url=https://www.modelscope.cn/twinkle` 进行训练。更多详情请参阅我们的[文档](docs/source_zh/使用指引/训练服务.md)。
我们正在 ModelScope 上推出基于 Twinkle✨ 构建的训练服务。你可以通过 API 端点 `base_url=https://www.modelscope.cn/twinkle` 进行训练。更多详情请参阅我们的[文档](https://modelscope.github.io/twinkle-web/zh/docs/usage-guide/train-as-a-service/)。

## 支持的硬件

Expand Down Expand Up @@ -166,7 +166,7 @@ Twinkle✨支持相同的算法接口运行在单GPU、torchrun多机、Ray、Cl

## 示例代码

下面列出了示例代码的一部分能力。完整的训练能力介绍请参考[快速开始](docs/source_zh/使用指引/快速开始.md)以及[cookbook](cookbook)。
下面列出了示例代码的一部分能力。完整的训练能力介绍请参考[快速开始](https://modelscope.github.io/twinkle-web/zh/docs/usage-guide/quick-start/)以及[cookbook](cookbook)。

### 使用 Ray 训练

Expand Down
14 changes: 7 additions & 7 deletions cookbook/exp/condenser/untested/eval_condensed_compressed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Identical --dataset / --limit / --model_id as eval_condensed_native.sh for an A/B comparison.
set -euo pipefail

DATASET="${DATASET:-/mnt/data/yzhao/datasets/musique_ans_v1.0_dev.jsonl}"
MODEL_ID="${MODEL_ID:-ms://Qwen/Qwen3.5-4B}"
CONDENSER_LORA="${CONDENSER_LORA:-ms://twinkle-kit/Qwen3.5-4B-Condenser}"
LIMIT="${LIMIT:-500}"
NUM_GPUS="${NUM_GPUS:-4}"
OUT_DIR="${OUT_DIR:-eval_out}"
DATASET="/mnt/data/yzhao/datasets/musique_ans_v1.0_dev.jsonl"
MODEL_ID="ms://Qwen/Qwen3.5-4B"
CONDENSER_LORA="ms://twinkle-kit/Qwen3.5-4B-Condenser"
LIMIT="500"
NUM_GPUS="4"
OUT_DIR="eval_out"

CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1,2,3} \
CUDA_VISIBLE_DEVICES=0,1,2,3 \
python cookbook/exp/eval_condensed.py \
--mode condensed \
--dataset_format musique \
Expand Down
12 changes: 6 additions & 6 deletions cookbook/exp/condenser/untested/eval_condensed_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Compare against eval_condensed_compressed.sh on identical --dataset / --limit / --model_id.
set -euo pipefail

DATASET="${DATASET:-/mnt/data/yzhao/datasets/musique_ans_v1.0_dev.jsonl}"
MODEL_ID="${MODEL_ID:-ms://Qwen/Qwen3.5-4B}"
LIMIT="${LIMIT:-500}"
NUM_GPUS="${NUM_GPUS:-4}"
OUT_DIR="${OUT_DIR:-eval_out}"
DATASET="/mnt/data/yzhao/datasets/musique_ans_v1.0_dev.jsonl"
MODEL_ID="ms://Qwen/Qwen3.5-4B"
LIMIT="500"
NUM_GPUS="4"
OUT_DIR="eval_out"

CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1,2,3} \
CUDA_VISIBLE_DEVICES=0,1,2,3 \
python cookbook/exp/eval_condensed.py \
--mode native \
--dataset_format musique \
Expand Down
Loading