Skip to content

Commit fdd496e

Browse files
authored
Add support for q1, q1f16, q2, q2f16 data types (#1647)
1 parent ed84c15 commit fdd496e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/transformers/src/utils/dtypes.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ export const DATA_TYPES = Object.freeze({
4141
uint8: 'uint8',
4242
q4: 'q4',
4343
bnb4: 'bnb4',
44-
q4f16: 'q4f16', // fp16 model with int4 block weight quantization
44+
q4f16: 'q4f16', // fp16 model with 4-bit block weight quantization
45+
q2: 'q2',
46+
q2f16: 'q2f16', // fp16 model with 2-bit block weight quantization
47+
q1: 'q1',
48+
q1f16: 'q1f16', // fp16 model with 1-bit block weight quantization
4549
});
4650
/** @typedef {keyof typeof DATA_TYPES} DataType */
4751

@@ -59,7 +63,11 @@ export const DEFAULT_DTYPE_SUFFIX_MAPPING = Object.freeze({
5963
[DATA_TYPES.uint8]: '_uint8',
6064
[DATA_TYPES.q8]: '_quantized',
6165
[DATA_TYPES.q4]: '_q4',
66+
[DATA_TYPES.q2]: '_q2',
67+
[DATA_TYPES.q1]: '_q1',
6268
[DATA_TYPES.q4f16]: '_q4f16',
69+
[DATA_TYPES.q2f16]: '_q2f16',
70+
[DATA_TYPES.q1f16]: '_q1f16',
6371
[DATA_TYPES.bnb4]: '_bnb4',
6472
});
6573

0 commit comments

Comments
 (0)