Coder Social home page Coder Social logo

Embeddings with StableLM? about stablelm HOT 5 OPEN

stability-ai avatar stability-ai commented on June 19, 2024 4
Embeddings with StableLM?

from stablelm.

Comments (5)

sirwalt avatar sirwalt commented on June 19, 2024 6

I would recommend taking a look at https://www.sbert.net/ . To my best knowledge the OpenAI models are not outstanding at all for embeddings (https://huggingface.co/spaces/mteb/leaderboard) but it is convenience to use the API of them - at least for us.

from stablelm.

lingster avatar lingster commented on June 19, 2024 5

If it helps, I have successfully used: sentence-transformers/all-mpnet-base-v2 as an alternative to the OpenAI text-embedding-ada-002

from stablelm.

sandyflute avatar sandyflute commented on June 19, 2024

Hello, i am able to extract the embeddings from the model.
from transformers import AutoModelForCausalLM, AutoConfig,AutoTokenizer

checkpoint = "path/to/the/model"

config = AutoConfig.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_config(config)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

inputs = tokenizer.encode('Stability AI democratised AI by open sourcing large models', return_tensors="pt")
outputs = model(inputs)
hidden_states = output[1]

now hidden states has output of all the layers. You can use the output of last layer.

Since i am a newbie to huggingface, there might be better ways to do this. Please share if you find something better.

from stablelm.

wajihullahbaig avatar wajihullahbaig commented on June 19, 2024

These models are multi-lingual?

from stablelm.

juliuslipp avatar juliuslipp commented on June 19, 2024

If you are looking for another convenient API might consider embaas. They offer a similiar structure to openai and you can use the MTEB leaderboard top members. They have some mutlilingual models as well and integrate wiht langchain or have an easy to use python client

from stablelm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.