@huggingface/transformers 3.0.0-alpha.12 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/transformers.cjs +35 -1
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +37 -2
- package/dist/transformers.js.map +1 -1
- package/dist/transformers.min.cjs +4 -4
- package/dist/transformers.min.cjs.map +1 -1
- package/dist/transformers.min.js +4 -4
- package/dist/transformers.min.js.map +1 -1
- package/dist/transformers.min.mjs +4 -4
- package/dist/transformers.min.mjs.map +1 -1
- package/dist/transformers.mjs +37 -2
- package/dist/transformers.mjs.map +1 -1
- package/package.json +1 -1
- package/src/env.js +1 -1
- package/src/models.js +9 -0
- package/src/utils/tensor.js +23 -0
- package/types/models.d.ts +3 -0
- package/types/models.d.ts.map +1 -1
- package/types/utils/tensor.d.ts +12 -0
- package/types/utils/tensor.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ npm i @huggingface/transformers
|
|
|
101
101
|
Alternatively, you can use it in vanilla JS, without any bundler, by using a CDN or static hosting. For example, using [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), you can import the library with:
|
|
102
102
|
```html
|
|
103
103
|
<script type="module">
|
|
104
|
-
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.
|
|
104
|
+
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.13';
|
|
105
105
|
</script>
|
|
106
106
|
```
|
|
107
107
|
|
|
@@ -134,7 +134,7 @@ Check out the Transformers.js [template](https://huggingface.co/new-space?templa
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.
|
|
137
|
+
By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.13/dist/), which should work out-of-the-box. You can customize this as follows:
|
|
138
138
|
|
|
139
139
|
### Settings
|
|
140
140
|
|
package/dist/transformers.cjs
CHANGED
|
@@ -4437,7 +4437,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4437
4437
|
|
|
4438
4438
|
|
|
4439
4439
|
|
|
4440
|
-
const VERSION = '3.0.0-alpha.
|
|
4440
|
+
const VERSION = '3.0.0-alpha.13';
|
|
4441
4441
|
|
|
4442
4442
|
// Check if various APIs are available (depends on environment)
|
|
4443
4443
|
const IS_BROWSER_ENV = typeof self !== 'undefined';
|
|
@@ -6372,6 +6372,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6372
6372
|
/* harmony export */ AutoModelForImageToImage: () => (/* binding */ AutoModelForImageToImage),
|
|
6373
6373
|
/* harmony export */ AutoModelForMaskGeneration: () => (/* binding */ AutoModelForMaskGeneration),
|
|
6374
6374
|
/* harmony export */ AutoModelForMaskedLM: () => (/* binding */ AutoModelForMaskedLM),
|
|
6375
|
+
/* harmony export */ AutoModelForNormalEstimation: () => (/* binding */ AutoModelForNormalEstimation),
|
|
6375
6376
|
/* harmony export */ AutoModelForObjectDetection: () => (/* binding */ AutoModelForObjectDetection),
|
|
6376
6377
|
/* harmony export */ AutoModelForQuestionAnswering: () => (/* binding */ AutoModelForQuestionAnswering),
|
|
6377
6378
|
/* harmony export */ AutoModelForSemanticSegmentation: () => (/* binding */ AutoModelForSemanticSegmentation),
|
|
@@ -13348,6 +13349,10 @@ const MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES = new Map([
|
|
|
13348
13349
|
['sapiens', ['SapiensForDepthEstimation', SapiensForDepthEstimation]],
|
|
13349
13350
|
])
|
|
13350
13351
|
|
|
13352
|
+
const MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES = new Map([
|
|
13353
|
+
['sapiens', ['SapiensForNormalEstimation', SapiensForNormalEstimation]],
|
|
13354
|
+
])
|
|
13355
|
+
|
|
13351
13356
|
// NOTE: This is custom to Transformers.js, and is necessary because certain models
|
|
13352
13357
|
// (e.g., CLIP) are split into vision and text components
|
|
13353
13358
|
const MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES = new Map([
|
|
@@ -13374,6 +13379,7 @@ const MODEL_CLASS_TYPE_MAPPING = [
|
|
|
13374
13379
|
[MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13375
13380
|
[MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13376
13381
|
[MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13382
|
+
[MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13377
13383
|
[MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13378
13384
|
[MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
|
|
13379
13385
|
[MODEL_FOR_MASK_GENERATION_MAPPING_NAMES, MODEL_TYPES.MaskGeneration],
|
|
@@ -13630,6 +13636,10 @@ class AutoModelForDepthEstimation extends PretrainedMixin {
|
|
|
13630
13636
|
static MODEL_CLASS_MAPPINGS = [MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES];
|
|
13631
13637
|
}
|
|
13632
13638
|
|
|
13639
|
+
class AutoModelForNormalEstimation extends PretrainedMixin {
|
|
13640
|
+
static MODEL_CLASS_MAPPINGS = [MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES];
|
|
13641
|
+
}
|
|
13642
|
+
|
|
13633
13643
|
class AutoModelForImageFeatureExtraction extends PretrainedMixin {
|
|
13634
13644
|
static MODEL_CLASS_MAPPINGS = [MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES];
|
|
13635
13645
|
}
|
|
@@ -29027,6 +29037,7 @@ class Tensor {
|
|
|
29027
29037
|
}
|
|
29028
29038
|
return this;
|
|
29029
29039
|
}
|
|
29040
|
+
|
|
29030
29041
|
/**
|
|
29031
29042
|
* Return a new Tensor with every element added by a constant.
|
|
29032
29043
|
* @param {number} val The value to add by.
|
|
@@ -29049,6 +29060,28 @@ class Tensor {
|
|
|
29049
29060
|
return this;
|
|
29050
29061
|
}
|
|
29051
29062
|
|
|
29063
|
+
/**
|
|
29064
|
+
* Return a new Tensor with every element subtracted by a constant.
|
|
29065
|
+
* @param {number} val The value to subtract by.
|
|
29066
|
+
* @returns {Tensor} The new tensor.
|
|
29067
|
+
*/
|
|
29068
|
+
sub(val) {
|
|
29069
|
+
return this.clone().sub_(val);
|
|
29070
|
+
}
|
|
29071
|
+
|
|
29072
|
+
/**
|
|
29073
|
+
* Subtract the tensor by a constant in place.
|
|
29074
|
+
* @param {number} val The value to subtract by.
|
|
29075
|
+
* @returns {Tensor} Returns `this`.
|
|
29076
|
+
*/
|
|
29077
|
+
sub_(val) {
|
|
29078
|
+
const this_data = this.data;
|
|
29079
|
+
for (let i = 0; i < this_data.length; ++i) {
|
|
29080
|
+
this_data[i] -= val;
|
|
29081
|
+
}
|
|
29082
|
+
return this;
|
|
29083
|
+
}
|
|
29084
|
+
|
|
29052
29085
|
clone() {
|
|
29053
29086
|
return new Tensor(this.type, this.data.slice(), this.dims.slice());
|
|
29054
29087
|
}
|
|
@@ -30257,6 +30290,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30257
30290
|
/* harmony export */ AutoModelForImageToImage: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForImageToImage),
|
|
30258
30291
|
/* harmony export */ AutoModelForMaskGeneration: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForMaskGeneration),
|
|
30259
30292
|
/* harmony export */ AutoModelForMaskedLM: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForMaskedLM),
|
|
30293
|
+
/* harmony export */ AutoModelForNormalEstimation: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForNormalEstimation),
|
|
30260
30294
|
/* harmony export */ AutoModelForObjectDetection: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForObjectDetection),
|
|
30261
30295
|
/* harmony export */ AutoModelForQuestionAnswering: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForQuestionAnswering),
|
|
30262
30296
|
/* harmony export */ AutoModelForSemanticSegmentation: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForSemanticSegmentation),
|