Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

chore(deps): Update dependency @huggingface/transformers to v3.1.2 #404

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 8, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@huggingface/transformers 3.1.1 -> 3.1.2 age adoption passing confidence

Release Notes

huggingface/transformers.js (@​huggingface/transformers)

v3.1.2

Compare Source

🤖 New models

  • Add support for PaliGemma (& PaliGemma2) in https://github.com/huggingface/transformers.js/pull/1074

    Example: Image captioning with onnx-community/paligemma2-3b-ft-docci-448.

    import { AutoProcessor, PaliGemmaForConditionalGeneration, load_image } from '@​huggingface/transformers';
    
    // Load processor and model
    const model_id = 'onnx-community/paligemma2-3b-ft-docci-448';
    const processor = await AutoProcessor.from_pretrained(model_id);
    const model = await PaliGemmaForConditionalGeneration.from_pretrained(model_id, {
        dtype: {
            embed_tokens: 'fp16', // or 'q8'
            vision_encoder: 'fp16', // or 'q4', 'q8'
            decoder_model_merged: 'q4', // or 'q4f16'
        },
    });
    
    // Prepare inputs
    const url = 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg'
    const raw_image = await load_image(url);
    const prompt = '<image>caption en'; // Caption the image in English
    const inputs = await processor(raw_image, prompt);
    
    // Generate a response
    const output = await model.generate({
        ...inputs,
        max_new_tokens: 100,
    })
    
    const generated_ids = output.slice(null, [inputs.input_ids.dims[1], null]);
    const answer = processor.batch_decode(
        generated_ids,
        { skip_special_tokens: true },
    );
    console.log(answer[0]);
    // A side view of a light blue 1970s Volkswagen Beetle parked on a gray cement road. It is facing to the right. It has a reflection on the side of it. Behind it is a yellow building with a brown double door on the right. It has a white frame around it. Part of a gray cement wall is visible on the far left.

    List of supported models: https://huggingface.co/models?library=transformers.js\&other=paligemma

  • Add support for I-JEPA in https://github.com/huggingface/transformers.js/pull/1073

    Example: Image feature extraction with onnx-community/ijepa_vith14_1k.

    import { pipeline, cos_sim } from "@&#8203;huggingface/transformers";
    
    // Create an image feature extraction pipeline
    const extractor = await pipeline(
      "image-feature-extraction",
      "onnx-community/ijepa_vith14_1k",
      { dtype: "q8" },
    );
    
    // Compute image embeddings
    const url_1 = "http://images.cocodataset.org/val2017/000000039769.jpg"
    const url_2 = "http://images.cocodataset.org/val2017/000000219578.jpg"
    const output = await extractor([url_1, url_2]);
    const pooled_output = output.mean(1); // Apply mean pooling
    
    // Compute cosine similarity
    const similarity = cos_sim(pooled_output[0].data, pooled_output[1].data);
    console.log(similarity); // 0.5168613045518973

    List of supported models: https://huggingface.co/models?library=transformers.js\&other=ijepa

  • Add support for OLMo2 in https://github.com/huggingface/transformers.js/pull/1076. List of supported models: https://huggingface.co/models?library=transformers.js\&other=olmo2

🐛 Bug fixes

🛠️ Other improvements

🤗 New contributors

Full Changelog: huggingface/transformers.js@3.1.1...3.1.2


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Dependency updates label Dec 8, 2024
@renovate renovate bot force-pushed the renovate/huggingface-transformers-3.x branch from ad12641 to 0006eb7 Compare December 9, 2024 08:17
@renovate renovate bot force-pushed the renovate/huggingface-transformers-3.x branch from 0006eb7 to 8419708 Compare December 9, 2024 17:46
@renovate renovate bot force-pushed the renovate/huggingface-transformers-3.x branch from 8419708 to c63b077 Compare December 9, 2024 19:14
@renovate renovate bot force-pushed the renovate/huggingface-transformers-3.x branch from c63b077 to 2ca06e3 Compare December 9, 2024 23:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Dependency updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants