Find answers from the community

Home
Members
jackson hole
j
jackson hole
Offline, last seen 3 months ago
Joined September 25, 2024
πŸ™‹πŸ»β€β™‚οΈ
Hello, I have a small question regarding how do the "Bing Chat" and "Bard" work behind the scenes.

When we ask something in their "chatbox" they typically search on the internet and I think they will "fetch" the webpages. Now, there are multiple pages, say 3 which may contain the information that I am looking for to be answered.

Does it summarize all information? Because then there will be the context length issue...

πŸ€”
Will anyone please elgihten me on how do they work? Combining all information and generate the response? (with citation)?
2 comments
j
L

Hello Folks πŸ€—

I have truly off topic and random question... πŸ˜“
I know it's a basic inference question but I am willing to know which is the best way to inference in batch.

The overall goal

-> I am using t5-small model for summarization task.
-> And I have around 10 to 15 different paragraphs to be summarized in a single call.

πŸ‘¨β€πŸ’» The code I am using right now

It is generic loop code but I expect some optimization here:
Plain Text
points = [
"summarize: ABC...",
"summarize: CBA...",
"summarize: ERG...",
"summarize: RAG...",
]

summaries = []
for point in points:
    input_ids = tokenizer.encode(point, return_tensors="pt", max_length=512, truncation=True)
    output_ids = model.generate(input_ids, max_length=256, temperature=0.35, do_sample=True)
    summaries.append(tokenizer.decode(output_ids[0], skip_special_tokens=True))

This one takes time as expected.

😯 I have tried this...

Plain Text
# Passsing input ids in batch
ids = tokenizer(points, return_tensors="pt", max_length=512, padding="longest")
response = model.generate(**ids, max_length=256, temperature=0.35, do_sample=True)
tokenizer.batch_decode(response, skip_special_tokens=True)

But I am worried if the model will connect the paragraphs internally and will leak information between each. I am not sure but this way is significantly fast than the loop way.

πŸ€” My Ask

Am I doing it right? How to perform the batch inference which is so fast and all inputs are NOT talking to each other?

Is there any other way to increase the speed? (Or would I just need to use threading?)

Thanks!
4 comments
j
L
j
jackson hole
Β·

Summarize

GPT-2 sized model might work, but from my testing it doesn't properly understand the instructions (even on instruction tuned dataset) and is maybe small. But still, I am open for this idea if you suggest πŸ€—
2 comments
j
L
Hello folks πŸ‘‹
I would like to kindly ask for a small guidance.

πŸ‘‰ What is it about?
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
β†’ Building a pipeline which allows the user to upload their PDFs (say medical report)
β†’ Generally, reports from different labs have a different structure of writing the test name, result, normal range etc.
β†’ I would like to extract the table and create a structured table that can later be used.
β†’ So the task is to convert the unstructured content into the structured.

Here I am going with an asusmption that I won't require the OCR,
because the PDF will only contain the text.

πŸ‘‰ I have tried...
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
Python libraries such as:
β†’ camelot
β†’ read_pdf
β†’ tabula-py
etc.

But they either don't give just the table which is required (gives other information as well) or don't recognize that there is any table at all!

πŸ‘‰ I am asking for an advice for...
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
Can we:
  1. Extract all text data from the PDF (including the table)
  2. Give the GPT-3 or any other LLM to create the structured table where it can see the medical tests?

Or is there any other approach that I should be using, which is more robust and accurate?


Please help, thanks πŸ™
4 comments
L
j
s