-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update sentence-transformers.R #21
base: main
Are you sure you want to change the base?
Conversation
Previous example didn't work.
We can definitely change course, but the original example worked and seemed clear to me. Compute sentence embeddingssentences <- c("Baby turtles are so cute!", "He walks as slowly as a turtle.","The lake is cold today.", "I enjoy swimming in the lake.") Get distances between sentencesembeddings %>% dist() %>% as.matrix() %>% as.data.frame() %>% setNames(sentences) %>% mutate( Cluster sentencesembeddings %>% t() %>% prcomp() %>% pluck('rotation') %>% as.data.frame() %>% mutate(sentence = sentences) %>% |
I ran @samterfa code above and was successful after adding back ticks to "sentence 1". This matches what we have in the example so it should be good to go. `library(tidyverse) sentences <- c( model <- hf_load_sentence_model('paraphrase-MiniLM-L6-v2') embeddings <- model$encode(sentences) embeddings %>% embeddings %>% @tomazweiss example is really close to this to. @tomazweiss could you point us to the error you are getting? |
It looks like @jpcompartir changed the example here. Maybe he was seeing an error? |
@farach, I was correcting example in this file: There is a typo (embddings) and you are updating the embeddings object and then using the previous version in plot. |
This just looks like me being careless - by the by - the examples (across the package) were temporarily removed to speed up running check() (also didn't feel like adding to buildignore) - they're likely to be put back in as usage, or to figure in vignettes. So I may do the same here, until we're ready to go with release and tests etc. have been added appropriately. |
Previous example didn't work.