infinity icon indicating copy to clipboard operation
infinity copied to clipboard

any tutorial on how to use Infinity?

Open abcnow opened this issue 2 years ago • 11 comments
trafficstars

Love the concept behind infinity! I wonder if you have a video tutorial or pdf about how to use Infinity? It will be great!

abcnow avatar Oct 25 '23 00:10 abcnow

Thanks for the creative suggestion. For now, there is no plan to create a video from it. As of the Readme.md, in what way is it not clear to you how to use infinity, what do you think should be improved?

michaelfeil avatar Oct 25 '23 15:10 michaelfeil

@michaelfeil, some examples of how to load a model would be nice. Examples in general, are nice in the readme.

Jawn78 avatar Nov 13 '23 00:11 Jawn78

@Jawn78 Knowing all components inside out doesnt make it easy to me to see which examples are missing?

Are startup commands missing? / more commands? Should I host the Swagger UI on github.io?

michaelfeil avatar Nov 13 '23 10:11 michaelfeil

Just some feedback regarding documentation/newbiews on the project. I installed it today and had three difficulties:

  • How do I add new models to the web server? When I use something other than the default model I get a 404

underlying_embeddings: Embeddings = InfinityEmbeddings(model=model, infinity_api_url="http://0.0.0.0:7997/v1")

  • What is the default port when launching via infinity_emb? The main page only at the end mentions 8080 but I figured it is indeed 7997.

  • How to launch it via python. Running what I found in the docs

from infinity_emb import create_server
fastapi_app = create_server()

exits with status 0 immediately. Maybe something is missing.

BSVogler avatar Jan 14 '24 19:01 BSVogler

Love your feedback!

Port:

Should I switch the default port to 8080? Or is 7997 fine and just make it a bit more clear in the docs?

Python

The create_server util is really just a replacement for what the CLI does. It will launch a uvicorn server.

I would recommend using the following: Install with all extras.

pip install "infinity_emb[all]==0.0.x"
from infinity_emb import AsyncEmbeddingEngine, transformer

sentences = ["Embedded this is sentence via Infinity.", "Paris is in France."]
engine = AsyncEmbeddingEngine(engine="torch")
async with engine:
    embeddings, usage = await engine.embed(sentences)
    embeddings = np.array(embeddings)

You can find possible usage here: https://github.com/michaelfeil/infinity/blob/main/libs/infinity_emb/tests/unit_test/test_engine.py

michaelfeil avatar Jan 14 '24 20:01 michaelfeil

I guess 7997 is fine when it is mentioned more prominently in the docs.

A uvicorn server should not exit immediately so I think something must be wrong in what I did.

BSVogler avatar Jan 16 '24 20:01 BSVogler

Added some chances to the docs.

michaelfeil avatar Jan 18 '24 00:01 michaelfeil

Unfortunately I also have trouble installing / running infinity on my M1 MacBook Pro.

I was assuming that I could access the Swagger documentation at http://localhost:7997, but that does not seem to be the case. Do I misunderstand something?

michaelwechner avatar Mar 10 '24 18:03 michaelwechner

@michaelwechner Sounds like youre doing the correct thing. What is the issue you’re seeing?

michaelfeil avatar Mar 10 '24 19:03 michaelfeil

The containter got created, resp. I can see it with "docker ps -a", but when I send a request to http://localhost:7997/, then it does not seem to be running at all.

michaelwechner avatar Mar 11 '24 06:03 michaelwechner

Are you forwarding port 7997 from docker, as in the readme?

docker run -it --gpus all -p 7997:7997 michaelf34/infinity:0.0.26 --model-name-or-path BAAI/bge-small-en-v1.5 --port 7997

michaelfeil avatar Mar 11 '24 07:03 michaelfeil