Skip to content

Commit abc1272

Browse files
committed
Merge branch 'main' into webgpu-fixes
2 parents 5752f19 + ce3c266 commit abc1272

File tree

8 files changed

+38
-11
lines changed

8 files changed

+38
-11
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
- synchronize
1414
- ready_for_review
1515

16+
env:
17+
TESTING_REMOTELY: true
18+
1619
jobs:
1720
build:
1821
if: github.event.pull_request.draft == false

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ You can refine your search by selecting the task you're interested in (e.g., [te
401401
1. **PyAnnote** released in the repository [pyannote/pyannote-audio](https://github.com/pyannote/pyannote-audio) by Hervé Bredin.
402402
1. **[Qwen2](https://huggingface.co/docs/transformers/model_doc/qwen2)** (from the Qwen team, Alibaba Group) released with the paper [Qwen Technical Report](https://arxiv.org/abs/2309.16609) by Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, Binyuan Hui, Luo Ji, Mei Li, Junyang Lin, Runji Lin, Dayiheng Liu, Gao Liu, Chengqiang Lu, Keming Lu, Jianxin Ma, Rui Men, Xingzhang Ren, Xuancheng Ren, Chuanqi Tan, Sinan Tan, Jianhong Tu, Peng Wang, Shijie Wang, Wei Wang, Shengguang Wu, Benfeng Xu, Jin Xu, An Yang, Hao Yang, Jian Yang, Shusheng Yang, Yang Yao, Bowen Yu, Hongyi Yuan, Zheng Yuan, Jianwei Zhang, Xingxuan Zhang, Yichang Zhang, Zhenru Zhang, Chang Zhou, Jingren Zhou, Xiaohuan Zhou and Tianhang Zhu.
403403
1. **[Qwen2-VL](https://huggingface.co/docs/transformers/model_doc/qwen2_vl)** (from the Qwen team, Alibaba Group) released with the paper [Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond](https://arxiv.org/abs/2308.12966) by Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, Jingren Zhou.
404+
1. **[Qwen3](https://huggingface.co/docs/transformers/en/model_doc/qwen3)** (from the Qwen team, Alibaba Group) released with the blog post [Qwen3: Think Deeper, Act Faster](https://qwenlm.github.io/blog/qwen3/) by the Qwen team.
404405
1. **[ResNet](https://huggingface.co/docs/transformers/model_doc/resnet)** (from Microsoft Research) released with the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
405406
1. **[RF-DETR](https://huggingface.co/docs/transformers/model_doc/rf_detr)** (from Roboflow) released with the blog post [RF-DETR: A SOTA Real-Time Object Detection Model](https://blog.roboflow.com/rf-detr/) by Peter Robicheaux, James Gallagher, Joseph Nelson, Isaac Robinson.
406407
1. **[RoBERTa](https://huggingface.co/docs/transformers/model_doc/roberta)** (from Facebook), released together with the paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.

docs/snippets/6_supported-models.snippet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
1. **PyAnnote** released in the repository [pyannote/pyannote-audio](https://github.com/pyannote/pyannote-audio) by Hervé Bredin.
116116
1. **[Qwen2](https://huggingface.co/docs/transformers/model_doc/qwen2)** (from the Qwen team, Alibaba Group) released with the paper [Qwen Technical Report](https://arxiv.org/abs/2309.16609) by Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, Binyuan Hui, Luo Ji, Mei Li, Junyang Lin, Runji Lin, Dayiheng Liu, Gao Liu, Chengqiang Lu, Keming Lu, Jianxin Ma, Rui Men, Xingzhang Ren, Xuancheng Ren, Chuanqi Tan, Sinan Tan, Jianhong Tu, Peng Wang, Shijie Wang, Wei Wang, Shengguang Wu, Benfeng Xu, Jin Xu, An Yang, Hao Yang, Jian Yang, Shusheng Yang, Yang Yao, Bowen Yu, Hongyi Yuan, Zheng Yuan, Jianwei Zhang, Xingxuan Zhang, Yichang Zhang, Zhenru Zhang, Chang Zhou, Jingren Zhou, Xiaohuan Zhou and Tianhang Zhu.
117117
1. **[Qwen2-VL](https://huggingface.co/docs/transformers/model_doc/qwen2_vl)** (from the Qwen team, Alibaba Group) released with the paper [Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond](https://arxiv.org/abs/2308.12966) by Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, Jingren Zhou.
118+
1. **[Qwen3](https://huggingface.co/docs/transformers/en/model_doc/qwen3)** (from the Qwen team, Alibaba Group) released with the blog post [Qwen3: Think Deeper, Act Faster](https://qwenlm.github.io/blog/qwen3/) by the Qwen team.
118119
1. **[ResNet](https://huggingface.co/docs/transformers/model_doc/resnet)** (from Microsoft Research) released with the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
119120
1. **[RF-DETR](https://huggingface.co/docs/transformers/model_doc/rf_detr)** (from Roboflow) released with the blog post [RF-DETR: A SOTA Real-Time Object Detection Model](https://blog.roboflow.com/rf-detr/) by Peter Robicheaux, James Gallagher, Joseph Nelson, Isaac Robinson.
120121
1. **[RoBERTa](https://huggingface.co/docs/transformers/model_doc/roberta)** (from Facebook), released together with the paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"homepage": "https://github.com/huggingface/transformers.js#readme",
5757
"dependencies": {
58-
"@huggingface/jinja": "^0.3.4",
58+
"@huggingface/jinja": "^0.4.0",
5959
"onnxruntime-node": "1.21.0",
6060
"onnxruntime-web": "1.22.0-dev.20250409-89f8206ba4",
6161
"sharp": "^0.34.1"

src/base/image_processors_utils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,10 @@ export class ImageProcessor extends Callable {
619619
this.pad_size = config.pad_size;
620620
// @ts-expect-error TS2339
621621
this.do_pad = config.do_pad;
622+
// @ts-expect-error TS2339
623+
this.min_pixels = config.min_pixels;
624+
// @ts-expect-error TS2339
625+
this.max_pixels = config.max_pixels;
622626

623627
if (this.do_pad && !this.pad_size && this.size && this.size.width !== undefined && this.size.height !== undefined) {
624628
// Should pad, but no pad size specified
@@ -892,12 +896,11 @@ export class ImageProcessor extends Callable {
892896

893897
} else if (this.size_divisibility !== undefined) {
894898
return enforce_size_divisibility([srcWidth, srcHeight], this.size_divisibility);
895-
} else if (size.min_pixels !== undefined && size.max_pixels !== undefined) {
899+
} else if (this.min_pixels !== undefined && this.max_pixels !== undefined) {
896900
// Custom resize logic for Qwen2-VL models
897-
const { min_pixels, max_pixels } = size;
898901
// @ts-expect-error TS2339
899902
const factor = this.config.patch_size * this.config.merge_size;
900-
return smart_resize(srcHeight, srcWidth, factor, min_pixels, max_pixels);
903+
return smart_resize(srcHeight, srcWidth, factor, this.min_pixels, this.max_pixels);
901904
} else {
902905
throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(size)}`);
903906
}

src/configs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ function getNormalizedConfig(config) {
125125
mapping['hidden_size'] = 'hidden_size';
126126
mapping['num_attention_heads'] = 'num_attention_heads';
127127
break;
128+
case 'qwen3':
128129
case 'gemma':
129130
case 'gemma2':
130131
case 'gemma3_text':

src/models.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4588,6 +4588,22 @@ export class Qwen2Model extends Qwen2PreTrainedModel { }
45884588
export class Qwen2ForCausalLM extends Qwen2PreTrainedModel { }
45894589
//////////////////////////////////////////////////
45904590

4591+
4592+
//////////////////////////////////////////////////
4593+
// Qwen3 models
4594+
4595+
/**
4596+
* The bare Qwen3 Model outputting raw hidden-states without any specific head on top.
4597+
*/
4598+
export class Qwen3PreTrainedModel extends PreTrainedModel { }
4599+
/**
4600+
* The bare Qwen3 Model outputting raw hidden-states without any specific head on top.
4601+
*/
4602+
export class Qwen3Model extends Qwen3PreTrainedModel { }
4603+
4604+
export class Qwen3ForCausalLM extends Qwen3PreTrainedModel { }
4605+
//////////////////////////////////////////////////
4606+
45914607
export class Qwen2VLPreTrainedModel extends PreTrainedModel {
45924608
forward_params = [
45934609
// Text inputs
@@ -7637,6 +7653,7 @@ const MODEL_MAPPING_NAMES_DECODER_ONLY = new Map([
76377653
['glm', ['GlmModel', GlmModel]],
76387654
['openelm', ['OpenELMModel', OpenELMModel]],
76397655
['qwen2', ['Qwen2Model', Qwen2Model]],
7656+
['qwen3', ['Qwen3Model', Qwen3Model]],
76407657
['phi', ['PhiModel', PhiModel]],
76417658
['phi3', ['Phi3Model', Phi3Model]],
76427659
['mpt', ['MptModel', MptModel]],
@@ -7737,6 +7754,7 @@ const MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = new Map([
77377754
['glm', ['GlmForCausalLM', GlmForCausalLM]],
77387755
['openelm', ['OpenELMForCausalLM', OpenELMForCausalLM]],
77397756
['qwen2', ['Qwen2ForCausalLM', Qwen2ForCausalLM]],
7757+
['qwen3', ['Qwen3ForCausalLM', Qwen3ForCausalLM]],
77407758
['phi', ['PhiForCausalLM', PhiForCausalLM]],
77417759
['phi3', ['Phi3ForCausalLM', Phi3ForCausalLM]],
77427760
['mpt', ['MptForCausalLM', MptForCausalLM]],

0 commit comments

Comments
 (0)