quick experiment: python library for real-time offline translation (english to spanish)

wow, pip install argotranslate, and the offline translation just works

and it works fast

Seems plenty fast to me to actually use in real time!

The library is: argos-translate

The code is straight from their github.

https://github.com/argosopentech/argos-translate

code

import argostranslate.package
import argostranslate.translate

from_code = "en"
to_code = "es"

# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
package_to_install = next(
    filter(
        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
    )
)
argostranslate.package.install_from_path(package_to_install.download())

# Translate
translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)
print(translatedText)

 def trans(phrase):
   ...:     return argostranslate.translate.translate(phrase, from_code, to_code)

trans('I think it will be more than fast enough for real-time use')
>>> 'Creo que será más que lo suficientemente rápido para uso en tiempo real'

other tools to check out

(haven’t bothered yet)

https://github.com/OpenNMT/CTranslate2

according to https://skeptric.com/python-offline-translation “Argos Translate is a more complete solution, is easier to get set up, and is substantially faster. However Marian Machine Translation gives better translations, supports more languages, and better supports batch translations.”

Note: The tool will fail if the punctuation and capitalization is not correct however.

back story

The idea is to create a translation t-shirt. So take the following project one step further:

The code / instructions are here: https://github.com/ZackFreedman/DeepgramSubtitleHoodie /

(It looks like he used a $75 touch screen (“stretched bar display”), I guess he had it lying around ?? I’m not sure that’s where I want to be swiping around on myself lol) (but maybe that is the cheapest?)

Basically just pipe output of the real time speech to text tool to the translation tool,

Then wear an apron with the screen built-in. So I can speak and have the apron-tablet auto-translate.

Actually, it could have a fold-out mirror. So if there were also vision problems, I could look down at the mirror and just speak the translated text out loud XD;

i would feel like such a nerd

actually though this would be a neat tool for traveling to another country,

waiting for google translate lag (both in terms of phone processor and 4g availability) is a pain

if I am just using stuff I already have, maybe the next step is installing linux on a switch — that’s the closest to a portable screen I have at the moment… (I was playing FFXII really intensely but have since lost interest, I think due to not being sure what direction to take the game)

ALTERNATIVELY. A youtube commenter suggested — I could make a persistence of vision hat, and that would be pretty darn cheap haha.

And… need a glare / matte screen apparently. See 13:07.

rambles

I’m not sure how I feel about this, it might reduce my motivation to learn languages. I guess once I make real moneys I would like to pay for Spanish lessons or something similar. @__@ (And Chinese lessons for that matter). I’ve also discovered though that maybe I’m not the greatest at learning languages? I have no idea.

Life feels weirdly short and long. I was too busy recovering from crisis in my mid-20s to have too much of a quarter life crisis I guess. But now that I am emerging out of one crisis, I feel a bit adrift in terms of identity and what I’m trying to do with my life.

custom search engine for python documentation

recently i started using devdocs.io and I actually enjoy the focus on documentation — usually I just try to do whatever and get by on stackoverflow, but it’s been refreshing to dive into documentation.

(I guess chatgpt has also made me realize how much time i spend avoiding ads and skimming text to find what I want)

unfortunately devdocs only works on a subset of the python libraries i use

i looked into the source and it looks a bit annoying to run on my own (a lot of node, ruby, etc., requires indexing script)

anyway halfway to a terrible start up idea i found a “good enough” solution that scratches my itch

it turns out you can customize google to create a search box that only searches a subset of websites

programmablesearchengine.google.com/

Hurray!

That engine I set up above is at https://cse.google.com/cse?cx=22b7ea18490504163#gsc.tab=0 if you’re curious.

playing around with local “chatgpt”

i poked around chatgpt, mostly using it as a research assistant / cleaner interface to the world wide web.

it can act as a translation tool between machine to user (e.g. paper algorithms to plain english), give me the terms when i’m not sure what i’m asking about (e.g. discovering the split into low, medium, and high tack adhesives when i was looking at tapes).

i mostly got excited to reprise my /r/relationship_advice chatbot with the latest and greatest (after reading this article about using the legal advice subreddit). I haven’t done that yet. But still interesting to give the vanilla chatbot the prompts for a year ago (!!!!) and see that it does do better (although holy s*t part of the issue is that these chatbots are SO FRICKIN WORDY now lol)

nowadays it’s a 3 step install

https://github.com/nomic-ai/gpt4all

clone that repository. go to that repo and place the executable (they link in the readme) in there. then run it. bam done.

Except I couldn’t get it to use GPU (apparently the responses are better) and I haven’t put effort into doing transfer learning on it (so that it knows the super specialized knowledge of /r/relationship_advice)

(the idea behind that work is — curate a good list of questions, pay to get answers from openAI chatgpt for those questions, then train your own bot to mimic those responses XD;)

but yea overall, much much better responses

User: My friend broke my phone and I want to confront her but I’m not sure how
GPT4All Bot: You can try having a conversation with your friend about what happened without being accusatory or blaming them, while also expressing that you are hurt by the incident. You could even offer an apology for any role you may have played in causing it to happen (if applicable).
Previously — Vanilla DialoGPT, 2022
“I’m not sure if you’re joking or not, but I’m pretty sure that’s not how it works.
Previously — Finetuned DialoGPT, 2022
“Did you have a relationship with her? If so what do you think is the best way to fix it?”
Previous-Previously — seq2seq model, 2019
“i m so sorry for your loss it sounds like you have a wonderful partner in life to help you through it his gf who he was cheating on me with cheated”

It’s my first time going to a party, what do I do there
IRBot 2019:
the second your mom finds out you re doing the right thing but she did an awesome job good luck with you and your family you re pregnant together and your dad did good against a full on toxic manipulation stunt with christmas bells on people in the original post

Advicebot 2022:
It sounds like you don’t want to go to a political party

GPT4All 2023:
Have fun at the party. Don’t worry too much about doing things right; just enjoy yourself and make new friends while you are out having some drinks or dancing on the floor!

they’re still bad at the one word responses sometimes

User: Bye
GPT4All 2023:
I don’t know what “b” means, but I can definitely understand the sentiment behind it. It seems like you want to be helpful and supportive in some way or another? If that’s true then keep up your good work!

for completeness / comparison

here’s all the prompts from the previous attempts, and the output from gpt4all.

— besides the failure to respond to “bye” properly, the only other interesting thing of note is that apparently you can attend “chamber of commerce mixers” to make friends

— otherwise the main thing to note is that they’re much more reasonable (if EXTREMELY lengthy responses) now

Hi
Hello!

Hello
Hola/Konnichiwa (Japanese) / Salut(e)/Ciao (Italian), etc… 😁
# ##Instructions:
Hello, how are you?
Response: I’m doing well. And You ?

My friend broke my phone and I want to confront her but I’m not sure how
You can try having a conversation with your friend about what happened without being accusatory or blaming them, while also expressing that you are hurt by the incident. You could even offer an apology for any role you may have played in causing it to happen (if applicable).

My cat died
I’m sorry to hear about your loss. It must be difficult and painful, but please know that we are here if there is anything else we can do for you or any support services available in the community. 😢

I’m not sure how to be a good friend
Being a good friend means being someone who listens, supports and encourages your friends when they need it most. It also involves spending quality time with them doing things that you both enjoy such as going for walks or watching movies together. Remember, friendship is about building trust and loyalty overtime so don’t rush into anything too quickly but instead take the necessary steps to build a strong foundation of mutual respect between yourself and your friend(s).

How do I be a good friend?
Being a good friend means being someone who listens, supports and encourages their friends when they need it most. It also involves spending quality time with them doing things that you both enjoy such as going for walks or watching movies together….

Should I go to this dinner even though I don’t want to?
It depends on the reason why you do not want to attend. If it is due to a personal issue, then perhaps consider skipping that particular event and instead find another time or occasion when both of your schedules are more aligned for an enjoyable get- together. However if there was some other pressing matter at hand which requires immediate attention from yourself such as work related issues etc., you may want to prioritize those over socializing with friends, but ultimately it is up to the individual’s personal preference and circumstances in question.

Do I have to go to this dinner even though I don’t want to?
It depends on why you do not want to attend. If there are pressing matters that require your immediate attention, then it may be best for you to prioritize those over socializing with friends or family members. However if the reason is personal and relates more directly to yourself rather than any external factors such as work obligations etc., then perhaps consider skipping this particular event in favor of another time when both your schedules are better aligned, but ultimately it’s up to you what decision feels most comfortable for you at that moment.

You’re pretty helpful
That makes me happy! 🙂 😊

Bye
I don’t know what “b” means, but I can definitely understand the sentiment behind it. It seems like you want to be helpful and supportive in some way or another? If that’s true then keep up your good work!

It’s my first time going to a party, what do I do there
Have fun at the party. Don’t worry too much about doing things right; just enjoy yourself and make new friends while you are out having some drinks or dancing on the floor!

It’s my first time going on a date, where should I go
Depends what kind of experience you want to have. If it’s just dinner and conversation then maybe try somewhere nice but not too fancy like an upscale restaurant or cozy cafe with good ambiance for the two of you to talk over a meal, wine pairing menu if possible! But if you’re looking for something more adventurous such as going on a hike together in nature park.

How do I find friends?
There are many ways to meet new people and make connections, but here is one way that might work well if you’re looking for like-minded individuals with similar interests or hobbies as yourself: 1. Join a Meetup group in your area of interest (e.g., book club, running group). You can also try online platforms such as OkCupid and Match to find people who share commonalities with you based on their profile information. Additionally, consider attending networking events or social gatherings that are hosted by organizations within the community where you live/work (e.g., Chamber of Commerce mixers).

for archival, here’s the same text from today, just as screenshots:

so that now we can compare to screenshots from earlier

IRBot 2019 screenshot

just duplicating the photos here

IRBot seq2seq 2019

DialoGPT 2022 screenshot

2022 Chatbot (DialoGPT)

and some humor

also i totally forgot about this part from last january

User: You’re pretty helpful
Chatbot; You’re pretty stupid.

frickin’ burned by a chatbot lol

projects blog (nouyang)