-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5c2176
commit 163777e
Showing
3 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
from py_txi.text_embedding_inference import TEI, TEIConfig | ||
from py_txi.text_generation_inference import TGI, TGIConfig | ||
|
||
llm = TGI(config=TGIConfig(model_id="bigscience/bloom-560m", gpus="0")) | ||
output = llm.generate(["Hi, I'm a language model", "I'm fine, how are you?"]) | ||
print(len(output)) | ||
print("LLM:", output) | ||
llm.close() | ||
for gpus in [None, "1", "1,2"]: | ||
llm = TGI(config=TGIConfig(model_id="bigscience/bloom-560m", gpus=gpus)) | ||
output = llm.generate(["Hi, I'm a language model", "I'm fine, how are you?"]) | ||
print(len(output)) | ||
print("LLM:", output) | ||
llm.close() | ||
|
||
embed = TEI(config=TEIConfig(model_id="BAAI/bge-base-en-v1.5")) | ||
output = embed.encode(["Hi, I'm an embedding model", "I'm fine, how are you?"]) | ||
print(len(output)) | ||
print("Embed:", output) | ||
embed.close() | ||
embed = TEI(config=TEIConfig(model_id="BAAI/bge-base-en-v1.5", gpus=gpus)) | ||
output = embed.encode(["Hi, I'm an embedding model", "I'm fine, how are you?"]) | ||
print(len(output)) | ||
print("Embed:", output) | ||
embed.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters