/ Модель

Характеристики

Контекст
512 токенов
Параметры
385 млн
Лицензия
Apache 2.0
Архитектура
t5 · dense
Опубликована
20 дек 2022

instructor-large

ЭмбеддингиТекст → embedding11 профессий

Instructor-large — англоязычная T5-модель для создания инструкционно-настраиваемых текстовых эмбеддингов в задачах поиска, классификации и кластеризации.

258 тыс.скачиваний за 30 дней525лайковвеса обновлены21 апр 2023

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Instructor-large — модель текстовых эмбеддингов, разработанная исследовательской группой HKUNLP и дообученная следовать инструкциям для получения векторов, настроенных под задачу и предметную область. Задачу задают текстовой инструкцией при кодировании, без отдельного дообучения под каждый сценарий. Модель основана на T5 Encoder и содержит 385,2 млн параметров; максимальная длина контекста — 512 токенов.

Модель предназначена для семантического поиска и извлечения информации, классификации, кластеризации, оценки текста и сравнения сходства предложений. Инструкции могут задавать область, например науку, финансы или медицину, и цель представления текста. В README заявлены высокие результаты на разнообразных задачах бенчмарка MTEB. Модель принимает текст и выдаёт эмбеддинги; для работы с ней авторы рекомендуют библиотеку InstructorEmbedding на базе Sentence Transformers.

Модель поддерживает английский язык. Лицензия — Apache-2.0. Контекст ограничен 512 токенами, а заявленные результаты бенчмарка не гарантируют качество для каждой пользовательской задачи; инструкцию и применение следует подбирать и оценивать отдельно.

Сценарии применения

  • семантический поиск по коллекции документов
  • извлечение релевантных документов по запросу
  • классификация предложений по смыслу
  • кластеризация текстов по тематике
  • оценка семантического сходства предложений
  • сравнение текстов с инструкцией для предметной области

Ограничения

Контекст ограничен 512 токенами. Заявленные результаты на MTEB не гарантируют качество на конкретных данных и инструкциях; применимость следует проверять на целевой задаче.

Для каких профессий подходит11

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

hkunlp/instructor-large

We introduce Instructor👨‍🏫, an instruction-finetuned text embedding model that can generate text embeddings tailored to any task (e.g., classification, retrieval, clustering, text evaluation, etc.) and domains (e.g., science, finance, etc.) by simply providing the task instruction, without any finetuning. Instructor👨‍ achieves sota on 70 diverse embedding tasks (MTEB leaderboard)! The model is easy to use with our customized sentence-transformer library. For more details, check out our paper and project page!

**************************** Updates ****************************

Quick start

Installation

pip install InstructorEmbedding

Compute your customized embeddings

Then you can use the model like this to calculate domain-specific and task-aware embeddings:

from InstructorEmbedding import INSTRUCTOR
model = INSTRUCTOR('hkunlp/instructor-large')
sentence = "3D ActionSLAM: wearable person tracking in multi-floor environments"
instruction = "Represent the Science title:"
embeddings = model.encode([[instruction,sentence]])
print(embeddings)

Use cases

Calculate embeddings for your customized texts

If you want to calculate customized embeddings for specific sentences, you may follow the unified template to write instructions:

                          Represent the domain text_type for task_objective:

  • domain is optional, and it specifies the domain of the text, e.g., science, finance, medicine, etc.
  • text_type is required, and it specifies the encoding unit, e.g., sentence, document, paragraph, etc.
  • task_objective is optional, and it specifies the objective of embedding, e.g., retrieve a document, classify the sentence, etc.

Calculate Sentence similarities

You can further use the model to compute similarities between two groups of sentences, with customized embeddings.

from sklearn.metrics.pairwise import cosine_similarity
sentences_a = [['Represent the Science sentence: ','Parton energy loss in QCD matter'], 
               ['Represent the Financial statement: ','The Federal Reserve on Wednesday raised its benchmark interest rate.']]
sentences_b = [['Represent the Science sentence: ','The Chiral Phase Transition in Dissipative Dynamics'],
               ['Represent the Financial statement: ','The funds rose less than 0.5 per cent on Friday']]
embeddings_a = model.encode(sentences_a)
embeddings_b = model.encode(sentences_b)
similarities = cosine_similarity(embeddings_a,embeddings_b)
print(similarities)

Information Retrieval

You can also use customized embeddings for information retrieval.

import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
query  = [['Represent the Wikipedia question for retrieving supporting documents: ','where is the food stored in a yam plant']]
corpus = [['Represent the Wikipedia document for retrieval: ','Capitalism has been dominant in the Western world since the end of feudalism, but most feel[who?] that the term "mixed economies" more precisely describes most contemporary economies, due to their containing both private-owned and state-owned enterprises. In capitalism, prices determine the demand-supply scale. For example, higher demand for certain goods and services lead to higher prices and lower demand for certain goods lead to lower prices.'],
          ['Represent the Wikipedia document for retrieval: ',"The disparate impact theory is especially controversial under the Fair Housing Act because the Act regulates many activities relating to housing, insurance, and mortgage loans—and some scholars have argued that the theory's use under the Fair Housing Act, combined with extensions of the Community Reinvestment Act, contributed to rise of sub-prime lending and the crash of the U.S. housing market and ensuing global economic recession"],
          ['Represent the Wikipedia document for retrieval: ','Disparate impact in United States labor law refers to practices in employment, housing, and other areas that adversely affect one group of people of a protected characteristic more than another, even though rules applied by employers or landlords are formally neutral. Although the protected classes vary by statute, most federal civil rights laws protect based on race, color, religion, national origin, and sex as protected traits, and some laws include disability status and other traits as well.']]
query_embeddings = model.encode(query)
corpus_embeddings = model.encode(corpus)
similarities = cosine_similarity(query_embeddings,corpus_embeddings)
retrieved_doc_id = np.argmax(similarities)
print(retrieved_doc_id)

Clustering

Use customized embeddings for clustering texts in groups.

import sklearn.cluster
sentences = [['Represent the Medicine sentence for clustering: ','Dynamical Scalar Degree of Freedom in Horava-Lifshitz Gravity'],
             ['Represent the Medicine sentence for clustering: ','Comparison of Atmospheric Neutrino Flux Calculations at Low Energies'],
             ['Represent the Medicine sentence for clustering: ','Fermion Bags in the Massive Gross-Neveu Model'],
             ['Represent the Medicine sentence for clustering: ',"QCD corrections to Associated t-tbar-H production at the Tevatron"],
             ['Represent the Medicine sentence for clustering: ','A New Analysis of the R Measurements: Resonance Parameters of the Higher,  Vector States of Charmonium']]
embeddings = model.encode(sentences)
clustering_model = sklearn.cluster.MiniBatchKMeans(n_clusters=2)
clustering_model.fit(embeddings)
cluster_assignment = clustering_model.labels_
print(cluster_assignment)

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
T5EncoderModel
Ревизия весов
54e5ffb

0 моделей