Skip to content

Commit 82206db

Browse files
authored
Add support for Arcee (#1377)
1 parent 0feb5b7 commit 82206db

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ You can refine your search by selecting the task you're interested in (e.g., [te
288288
### Models
289289

290290
1. **[ALBERT](https://huggingface.co/docs/transformers/model_doc/albert)** (from Google Research and the Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://huggingface.co/papers/1909.11942), by Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
291+
1. **[Arcee](https://huggingface.co/docs/transformers/model_doc/arcee)** (from Arcee AI) released with the blog post [Announcing Arcee Foundation Models](https://www.arcee.ai/blog/announcing-the-arcee-foundation-model-family) by Fernando Fernandes, Varun Singh, Charles Goddard, Lucas Atkins, Mark McQuade, Maziyar Panahi, Conner Stewart, Colin Kealty, Raghav Ravishankar, Lucas Krauss, Anneketh Vij, Pranav Veldurthi, Abhishek Thakur, Julien Simon, Scott Zembsch, Benjamin Langer, Aleksiej Cecocho, Maitri Patel.
291292
1. **[Audio Spectrogram Transformer](https://huggingface.co/docs/transformers/model_doc/audio-spectrogram-transformer)** (from MIT) released with the paper [AST: Audio Spectrogram Transformer](https://huggingface.co/papers/2104.01778) by Yuan Gong, Yu-An Chung, James Glass.
292293
1. **[BART](https://huggingface.co/docs/transformers/model_doc/bart)** (from Facebook) released with the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://huggingface.co/papers/1910.13461) by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer.
293294
1. **[BEiT](https://huggingface.co/docs/transformers/model_doc/beit)** (from Microsoft) released with the paper [BEiT: BERT Pre-Training of Image Transformers](https://huggingface.co/papers/2106.08254) by Hangbo Bao, Li Dong, Furu Wei.

docs/snippets/6_supported-models.snippet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
### Models
33

44
1. **[ALBERT](https://huggingface.co/docs/transformers/model_doc/albert)** (from Google Research and the Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://huggingface.co/papers/1909.11942), by Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
5+
1. **[Arcee](https://huggingface.co/docs/transformers/model_doc/arcee)** (from Arcee AI) released with the blog post [Announcing Arcee Foundation Models](https://www.arcee.ai/blog/announcing-the-arcee-foundation-model-family) by Fernando Fernandes, Varun Singh, Charles Goddard, Lucas Atkins, Mark McQuade, Maziyar Panahi, Conner Stewart, Colin Kealty, Raghav Ravishankar, Lucas Krauss, Anneketh Vij, Pranav Veldurthi, Abhishek Thakur, Julien Simon, Scott Zembsch, Benjamin Langer, Aleksiej Cecocho, Maitri Patel.
56
1. **[Audio Spectrogram Transformer](https://huggingface.co/docs/transformers/model_doc/audio-spectrogram-transformer)** (from MIT) released with the paper [AST: Audio Spectrogram Transformer](https://huggingface.co/papers/2104.01778) by Yuan Gong, Yu-An Chung, James Glass.
67
1. **[BART](https://huggingface.co/docs/transformers/model_doc/bart)** (from Facebook) released with the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://huggingface.co/papers/1910.13461) by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer.
78
1. **[BEiT](https://huggingface.co/docs/transformers/model_doc/beit)** (from Microsoft) released with the paper [BEiT: BERT Pre-Training of Image Transformers](https://huggingface.co/papers/2106.08254) by Hangbo Bao, Li Dong, Furu Wei.

src/configs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function getNormalizedConfig(config) {
111111
mapping['hidden_size'] = 'hidden_size';
112112
break;
113113
case 'llama':
114+
case 'arcee':
114115
case 'lfm2':
115116
case 'smollm3':
116117
case 'olmo':

src/models.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4594,6 +4594,13 @@ export class LlamaModel extends LlamaPreTrainedModel { }
45944594
export class LlamaForCausalLM extends LlamaPreTrainedModel { }
45954595
//////////////////////////////////////////////////
45964596

4597+
//////////////////////////////////////////////////
4598+
// Arcee models
4599+
export class ArceePreTrainedModel extends PreTrainedModel { }
4600+
export class ArceeModel extends ArceePreTrainedModel { }
4601+
export class ArceeForCausalLM extends ArceePreTrainedModel { }
4602+
//////////////////////////////////////////////////
4603+
45974604
//////////////////////////////////////////////////
45984605
// LFM2 models
45994606
export class Lfm2PreTrainedModel extends PreTrainedModel { }
@@ -7820,6 +7827,7 @@ const MODEL_MAPPING_NAMES_DECODER_ONLY = new Map([
78207827
['gpt_neox', ['GPTNeoXModel', GPTNeoXModel]],
78217828
['codegen', ['CodeGenModel', CodeGenModel]],
78227829
['llama', ['LlamaModel', LlamaModel]],
7830+
['arcee', ['ArceeModel', ArceeModel]],
78237831
['lfm2', ['Lfm2Model', Lfm2Model]],
78247832
['smollm3', ['SmolLM3Model', SmolLM3Model]],
78257833
['exaone', ['ExaoneModel', ExaoneModel]],
@@ -7927,6 +7935,7 @@ const MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = new Map([
79277935
['gpt_neox', ['GPTNeoXForCausalLM', GPTNeoXForCausalLM]],
79287936
['codegen', ['CodeGenForCausalLM', CodeGenForCausalLM]],
79297937
['llama', ['LlamaForCausalLM', LlamaForCausalLM]],
7938+
['arcee', ['ArceeForCausalLM', ArceeForCausalLM]],
79307939
['lfm2', ['Lfm2ForCausalLM', Lfm2ForCausalLM]],
79317940
['smollm3', ['SmolLM3ForCausalLM', SmolLM3ForCausalLM]],
79327941
['exaone', ['ExaoneForCausalLM', ExaoneForCausalLM]],
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { PreTrainedTokenizer, ArceeForCausalLM } from "../../../src/transformers.js";
2+
3+
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js";
4+
5+
export default () => {
6+
describe("ArceeForCausalLM", () => {
7+
const model_id = "onnx-internal-testing/tiny-random-ArceeForCausalLM";
8+
/** @type {ArceeForCausalLM} */
9+
let model;
10+
/** @type {PreTrainedTokenizer} */
11+
let tokenizer;
12+
beforeAll(async () => {
13+
model = await ArceeForCausalLM.from_pretrained(model_id, DEFAULT_MODEL_OPTIONS);
14+
tokenizer = await PreTrainedTokenizer.from_pretrained(model_id);
15+
tokenizer.padding_side = "left";
16+
}, MAX_MODEL_LOAD_TIME);
17+
18+
it(
19+
"batch_size=1",
20+
async () => {
21+
const inputs = tokenizer("hello");
22+
const outputs = await model.generate({
23+
...inputs,
24+
max_length: 10,
25+
});
26+
expect(outputs.tolist()).toEqual([[1n, 22172n, 1316n, 11038n, 25378n, 11619n, 7959n, 15231n, 15231n, 23659n]]);
27+
},
28+
MAX_TEST_EXECUTION_TIME,
29+
);
30+
31+
it(
32+
"batch_size>1",
33+
async () => {
34+
const inputs = tokenizer(["hello", "hello world"], { padding: true });
35+
const outputs = await model.generate({
36+
...inputs,
37+
max_length: 10,
38+
});
39+
expect(outputs.tolist()).toEqual([
40+
[2n, 1n, 22172n, 5706n, 3803n, 11619n, 28763n, 4015n, 18904n, 7959n],
41+
[1n, 22172n, 3186n, 1316n, 11038n, 22918n, 9469n, 25671n, 22918n, 2687n],
42+
]);
43+
},
44+
MAX_TEST_EXECUTION_TIME,
45+
);
46+
47+
afterAll(async () => {
48+
await model?.dispose();
49+
}, MAX_MODEL_DISPOSE_TIME);
50+
});
51+
};

0 commit comments

Comments
 (0)