Comments (5)
Could you please specify what you mean with "it doesn't understand sentences with opposite meaning." ?
The system handles very well the XNLI task. This task consists in the classification of two sentence as "related", "neutral" or "opposite"
from laser.
Could you please specify what you mean with "it doesn't understand sentences with opposite meaning." ?
Like "I love Maths instead of English" and "I love English instead of Maths".
I used sentence encoder and tried to calculate the cosine similarity, unfortunately the result was 1.0
from laser.
Something must be wrong in your experiment. It is highly unlikely that the embeddings of two different sentences have a cosine of 1.0
I tried your example and I get a value of about 0.9
from laser.
used #32
MODEL_DIR = f"{LASER}/models"
ENCODER_PATH = f"{MODEL_DIR}/bilstm.93langs.2018-12-26.pt"
encoder = SentenceEncoder(
ENCODER_PATH,
max_sentences=None,
max_tokens=12000,
sort_kind='mergesort',
cpu=True)
sentences = [
'I love Maths instead of English',
'I love English instead of Maths'
]
embeddings = encoder.encode_sentences(sentences)
print(np.inner(embeddings, embeddings))
from scipy import spatial
dataSetI = embeddings[0]
dataSetII = embeddings[1]
result = 1 - spatial.distance.cosine(dataSetI, dataSetII)
print(result) # result 1.0
from laser.
This is not correct. You need to tokenize and perform BPE before calling encode_sentences().
In particular, without BPE, most of the "full words" are considered as unknown and are mapped to the same token. This explains why the two sentences end up being "identical".
Please see source/embed.py and tasks/embed/README.md
from laser.
Related Issues (20)
- Containerized Application, Corrupted file for bilstm.93langs.2018-12-26.pt HOT 2
- Change default tokenizer for sentence embeddings HOT 1
- The included Dockerfile and associated Flask app is out of date in multiple ways. HOT 2
- LASER3 encoders for English? (and other high res langs) HOT 2
- SPM models not available HOT 2
- Downloading models and tokenizers does not work on Windows HOT 1
- An error initializing English pipeline (on the MLH-dev branch)
- Suggestion: allow turning off punctuation normalization
- Suggestion: add normalization option in the
- Try decreasing the minimal versions of numpy and torch required by laser-encoders
- Reorganize the lists of languages
- Publish the performance of LASER2 and LASER3 encoders on each of the FLORES-200 languages
- Create a tutorial showing how LASER can be applied for downstream practical tasks (e.g. multilingual sentiment analysis) HOT 1
- Support for saving embeddings bin file in laser_encoder HOT 4
- Add 2-letter codes to the `laser_encoders` language list
- do it support qwen model? HOT 1
- How can I parallelize LASER embeddings? HOT 3
- Can't download: 403 error on some CC segments. HOT 1
- Unable to import LaserEncoderPipeline HOT 10
- Similarity calculation takes too long with LASER3 model, compared to XLM-R/LaBSE HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laser.