HNHacker News
TopNewBestAskShowJobs

alexcg1

96 karma · joined June 19, 2020

Dev Experience Lead at Jina AI - building neural search and generative AI.

I also train AIs to write crappy Star Trek scripts and I build animatronic butterflies

submissionscomments
alexcg1··on How to install Windows 11 without a Microsoft account
Chocolatey [1] is a command line package manager for Windows that has a boatload of FOSS and freeware

[1] https://community.chocolatey.org/

alexcg1··on Newsboat: an RSS/Atom feed reader for the text console
Nice! Just downloaded and playing with it now. But there's nothing in readme about enabling nice image display in kitty. Any advice?
alexcg1··on SEO is dead long live LLMO
There's been a lot of news today about Microsoft integrating ChatGPT into Bing: https://www.theverge.com/2023/1/4/23538552/microsoft-bing-ch...
alexcg1··on Ask HN: I want to dive into how to make search engines
To be clear, Jina AI stuff helps with the search engine itself. Getting the data is another matter entirely, and pretty much outside of our scope (although we do provide some example datasets with Jina NOW, like artworks, music, etc)
alexcg1··on Ask HN: I want to dive into how to make search engines
What kinda thing do you want to search? Text I guess? But there are search engines for images, gifs, video, all kinds of stuff.

I'm working at an open-source project that builds an AI-powered search framework [0], and I've built some examples in very few lines of code (for searching fashion products via image or text [1], PDF text/images/tables search [2]) and one of our community members built a protein search engine [3].

A good place to start might be with a no-code solution like (shameless self-plug time) Jina NOW [4], which lets you build a search engine and GUI with just one CLI command.

[0] https://github.com/jina-ai/jina/

[1] https://examples.jina.ai/fashion/

[2] https://colab.research.google.com/github/jina-ai/workshops/b...

[3] https://github.com/georgeamccarthy/protein_search

[4] https://now.jina.ai

alexcg1··on Ask HN: How do you celebrate your birthday?
For me, I'll invite as many close friends as possible to a restaurant with cuisine we've never tried before (last time was Ethiopian). It starts off a new year (relative to my birth) with novelty, good food, and warm feelings
alexcg1··on [dead]
And I'd say Disco creates a more ethereal-feeling art. It's cool to watch noise just de-noise over time and see strange creations coming forth
alexcg1··on Genshin Impact Fine-tuning CLIP for anime search
This is more related to search tasks, where we encode text and image pairs to use text to search image. ResNet can also be served a backbone for search tasks: content-based image search/reverse image search/search image with image. You need to remove the ResNet50 classification head.

On the other hand, Tensorflow or MLNet are machine learning frameworks, to achieve the task you can choose whatever you want to build the model components.

alexcg1··on Making podcasts from Project Gutenberg e-books (2021)
What text-to-speech model is being used? I've seen big improvements in the past few years that could make me actually want to listen to these (since the voices sound more natural now)
alexcg1··on Search PDFs with Transformers and Python Notebook
I think you and I should start a support group!
alexcg1··on Search PDFs with Transformers and Python Notebook
Cholera has survived for thousands of years. Doesn't mean I want to deal with it :)

Seriously though, I agree. The fact that a file format can stick around that long is impressive.

alexcg1··on Search PDFs with Transformers and Python Notebook
I know folks with thousands to millions of PDFs using the Jina framework and it works fine. I hear what you're saying about frontends and lightweight though. Jina doesn't come with any cross-platform frontends, though Jina NOW has a Streamlit interface that's responsive (so works across devices)
alexcg1··on Search PDFs with Transformers and Python Notebook
In terms of matching embeddings and performing similarity search on text/images - folks are already using the framework (Jina) for that and getting decent results.

In terms of processing the PDFs and extracting that data. idk. That depends on a lot of factors - e.g. do you need to OCR the PDFs or can just extract text directly? Either way, should be possible to write a module and then easily scale it up (Jina supports shards/replicas). Anyway, lemme know. I'm in talks with folks about this kind of shitshow...uh...use case now.

Jina supports multiple vector database backends, like Weaviate, Qdrant and others. For others (like Milvus), suggest you ask on the Slack [0] - responses tend to be fast.

[0] https://slack.jina.ai

alexcg1··on Search PDFs with Transformers and Python Notebook
I may have misworded it (if I wrote those words - PDF rots the brain and my memory likewise).

Agreed on the rest. PDFs don't store machine-readable data. Often just pixelated scanned hot garbage dumpster fire text.

I hate PDFs but have to work with the satanforesaken things. Hence the notebook. It's my little way of trying to give my little PDF-bespoked-hellscape a tiny little glow-up.

alexcg1··on Search PDFs with Transformers and Python Notebook
Nice to meet another person in the super-obvious-username club
alexcg1··on Search PDFs with Transformers and Python Notebook
Thanks man!
alexcg1··on Search PDFs with Transformers and Python Notebook
I feel your pain my brother(?) [0] in suffering. That's why I started simple in the notebook. Even trying to go a little more complex just leads to exponential rabbit holes and footguns.

[0] based on typical HN demographics, no assumptions here

alexcg1··on Search PDFs with Transformers and Python Notebook
Getting the URI of original PDF would be straightforward enough - I could whack that into the code tomorrow with a few lines.

Opening up the correct page? I don't know of any standardized PDF reader that supports that kind of thing. And the format has such a history that even if it were supported (technically by Adobe - don't even get me started on what PDF readers support what formats), there's no guarantee the file itself would even have that cooked in.

alexcg1··on Search PDFs with Transformers and Python Notebook
Don't remind me of desktop Java. What was that toolkit, swing(?) that was used in all the apps back in the day. PDFs have a special place in Hell, but Java desktop UXen deserve a whole special circle
alexcg1··on Search PDFs with Transformers and Python Notebook
- Modern PDFs - if you wanna extract text and images, then the PDFSegmenter used in my example will work. If tables too, might need some additional jiggery-pokery, but definitely doable. I know other ppl using the same framework (Jina) who've accomplished it.

- Exact word search - pretty simple. I've focused on more advanced stuff because color vs colour is same same but different. Also just because it's pretty easy since I'm just using pre-defined building blocks, not manually integrating stuff

- Cross platform frontend - I've seen a lyrics search frontend [0] and I've built stuff in Streamlit before. Jina offers RESTful/gRPC/WebSockets gateways so it can't be too tough

- Lightweight? I mean how lightweight do you want it? C? Bash? Assembly? I've found Python good for text parsing

- Long-term: The notebook I wrote has a few (each of which have their own), but compared to others they're relatively lightweight.

- Gluing code: I've been using pre-existing building blocks, and writing new Executors (i.e. building blocks) is relatively straightforward, and then scaling them up with shards, replicas, etc is just a parameter away.

I'm more into the search side then the PDF stuff. The PDF side I've had experience with through bitter suffering and torment. Not a fun format to work with (unless you're into sado-masochism)

[0] https://github.com/jina-ai/examples/tree/master/multires-lyr...

alexcg1··on Search PDFs with Transformers and Python Notebook
Oh, nifty! This is more a demo of a PDF search engine that you could (in parts 1 thru x of the series) deploy to an intranet (for internal knowledge search) or internet (for general search), rather than a collaborative tool.

For handwritten/math symbols, I'm sure it wouldn't be too hard to integrate something. The Jina Flow [0] concept makes integrating new Executors [1] pretty easy.

I LOVE the testimonials on the site btw!

[0] https://docs.jina.ai/fundamentals/flow/

[1] https://docs.jina.ai/fundamentals/executor/

alexcg1··on Search PDFs with Transformers and Python Notebook
Wow, this post really took off! If anyone wants to read some of my blog posts on building PDF search engines (and the pain, torment and anguish that it causes) read:

- https://medium.com/jina-ai/building-an-ai-powered-pdf-search...

- https://medium.com/jina-ai/search-pdfs-with-ai-and-python-pa...

- https://medium.com/jina-ai/search-pdfs-with-ai-and-python-pa...

alexcg1··on Search PDFs with Transformers and Python Notebook
In that case I'd use:

1. PDFSegmenter (in the notebook) - extract the images of the text (yup, it does images too) 2. An OCR Executor [0][1] from Jina Hub [2] to extract the text from the images 3. Actually splice the text chunks together to be what you'd expect - that's the tricky part. Even text splitting over pages can be tricky to reassemble properly. PDFs are a pain the butt frankly.

[0] https://hub.jina.ai/executor/78yp7etm

[1] https://hub.jina.ai/executor/w4p7905v

[2] https://hub.jina.ai

alexcg1··on Search PDFs with Transformers and Python Notebook
Incidentally Jina Hub [0] has a few OCR Executors [1][2] you could integrate into my notebook (though you'd have to do some rewiring to take images into account since it's a text-based notebook)

[0] https://hub.jina.ai/

[1] https://hub.jina.ai/executor/w4p7905v

[2] https://hub.jina.ai/executor/78yp7etm

alexcg1··on Search PDFs with Transformers and Python Notebook
And +1 to spaCy. I typically use it over Transformers because it's SO much faster. I just used Transformers in this example for a change. My Stack Overflow search notebook [0] uses spaCy.

[0] https://colab.research.google.com/github/jina-ai/workshops/b...

alexcg1··on Search PDFs with Transformers and Python Notebook
If new and different phenomena means new kinds of corruption and downright weird behavior I'll end up having no hair left!

Even printing the same page to PDF with Chrome and Firefox delivers quite different results. Firefox was often combining "f" and "i" into fi ligature [0] which totally changed the meaning of "finished" for example.

Downloading a lot of random PDFs from arxiv would be great for making something battle-hardened and robust (and I'd love to get the chance to do it sometime) but I didn't have the time (or the remaining hair) to do it this time round.

[0] https://www.compart.com/en/unicode/U+FB01

alexcg1··on Search PDFs with Transformers and Python Notebook
I'll agree that there's quite a bit of junk punctuation in the extracted sentences (and sentence fragments), quite often from short footnotes in the Wiki articles. Getting "good" PDFs with open usage rights was a bit tricky, especially in a super simple PDF format. I ended up PDF-printing from Chrome.

Needless to say, working with PDFs makes me want to pull my hair out.

I also ended up writing the SpacySentencizer Executor instead of using a "vanilla" sentencizer. That led to consistent sentence splitting (so "J.R.R. Tolkien turned to pg. 3" would be one sentence, not 5)

For testing, Jina allows you to swap out encoders with just a couple of lines of code, so trying different methods out should work just fine.

alexcg1··on Search PDFs with Transformers and Python Notebook
PDFSegmenter also extracts images, which can then be OCR'ed in the next step of the pipeline
alexcg1··on Search PDFs with Transformers and Python Notebook
You mean the PDFSegmenter Executor in the notebook?
alexcg1··on Search PDFs with Transformers and Python Notebook
We've got quite a few other notebooks for other kinds of search on the blog. Would love to hear your thoughts!
Page 1 of 2Next →