category stringclasses 107
values | title stringlengths 15 179 | question_link stringlengths 59 147 | question_body stringlengths 53 33.8k | answer_html stringlengths 0 28.8k | __index_level_0__ int64 0 1.58k |
|---|---|---|---|---|---|
machine translation | How to deploy Neural Machine Translation checkpoints on Azure as endpoints and microservice | https://stackoverflow.com/questions/78095214/how-to-deploy-neural-machine-translation-checkpoints-on-azure-as-endpoints-and-m | <p>I find it straightforward to deploy simple Machine Learning models on AzureML after training, as we can serialize the trained model into a single .pkl file, for example. However, for Neural Machine Translation models, especially when fine-tuning pre-trained models, we end up with up to eleven files. These files can ... | <p>Currently, foundation models of this kind can be deployed from the <code>Hugging Face</code> registry in Azure ML.</p>
<p><img src="https://i.imgur.com/cKdisP2.png" alt="enter image description here" /></p>
<p>So, you register your model with Hugging Face and try deploying it in Azure ML.</p>
<p><img src="https://i.... | 1,334 |
machine translation | machine translation of HTML blocks | https://stackoverflow.com/questions/2305254/machine-translation-of-html-blocks | <p>Is there any API (like google translation api) in PHP which allows to translate HTML blocks and translate only text out of the html ?</p>
| <p>Microsoft's translation API will translate while maintaining HTML tags.</p>
<p>The API is documented <a href="http://www.microsofttranslator.com/dev/" rel="nofollow noreferrer">here</a>. It has both a REST and WSDL interface.</p>
<p>I tend to use the WSDL interface with PHP's SoapClient library. Here is some cod... | 1,335 |
machine translation | What are the return values from fairseq WMT19 machine translation model's .generate() function? | https://stackoverflow.com/questions/76359809/what-are-the-return-values-from-fairseq-wmt19-machine-translation-models-gener | <p>I am trying to play around with the Fairseq machine translation model using</p>
<pre><code>en2de = torch.hub.load('pytorch/fairseq', 'transformer.wmt19.en-de',
checkpoint_file='model1.pt:model2.pt:model3.pt:model4.pt',
tokenizer='moses', bpe='fastbpe')
</code></pre>
<p>W... | <p>Most probably the code snippet you're looking at came from <a href="https://github.com/facebookresearch/fairseq/blob/main/examples/wmt19/README.md" rel="nofollow noreferrer">https://github.com/facebookresearch/fairseq/blob/main/examples/wmt19/README.md</a></p>
<p>The example code there looks like this:</p>
<pre><cod... | 1,336 |
machine translation | How do we generate the first target words in machine translation? | https://stackoverflow.com/questions/73103907/how-do-we-generate-the-first-target-words-in-machine-translation | <p>I am learning about machine translation tasks with transformers. To my knowledge, the transformers model predicts the next word of the target sentence based on the previous words of the source sentence.
However, in the MarianMT model (or T5), I find its tokenizer does not have a start of sentence token (<cls> ... | <p>From the <a href="https://huggingface.co/docs/transformers/model_doc/marian" rel="nofollow noreferrer">documentation</a>:</p>
<blockquote>
<p>the model starts generating with pad_token_id (which has <code>0</code> as a
token_embedding) as the prefix (Bart uses <code><s/></code>)</p>
</blockquote>
<p>So it does... | 1,337 |
machine translation | What is projection layer in the context of neural machine translation using RNN? | https://stackoverflow.com/questions/60110462/what-is-projection-layer-in-the-context-of-neural-machine-translation-using-rnn | <p>I read a paper about machine translation, and it uses projection layer.
The projection layer is explained as follows: "Additional projection aims to reduce the dimensionality of the encoder output representations to match the decoder stack dimension."</p>
<p>Does anyone know this architecture or how to implement th... | <p>It is a standard linear projection. You can just add <code>nn.Linear(2 * model_dim, model_dim)</code> where <code>model_dim</code> is RNN dimension.</p>
<p>The encoder is bidirectional, with one RNNs in both directions having an output of dimension <code>model_dim</code>. The decoder only works in the forward dire... | 1,338 |
machine translation | Input to attention in TensorFlow 2.0 tutorial on "Neural machine translation with attention" | https://stackoverflow.com/questions/58618837/input-to-attention-in-tensorflow-2-0-tutorial-on-neural-machine-translation-wit | <p>There is one question when I learned the example <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention" rel="nofollow noreferrer">"Neural machine translation with attention"</a>.</p>
<pre class="lang-py prettyprint-override"><code>class Decoder(tf.keras.Model):
def __init__(self, vocab_size, embed... | <p>The attention is called in every step of the decoder. The inputs to the decoder step are:</p>
<ul>
<li>previously decoded token <code>x</code> (or ground-truth token while training)</li>
<li>previous hidden state of the <strong>decoder</strong> <code>hidden</code></li>
<li>hidden states of the encoder <code>enc_out... | 1,339 |
machine translation | How to parallelize transformer model for machine translation on 8 GPUs? | https://stackoverflow.com/questions/78774602/how-to-parallelize-transformer-model-for-machine-translation-on-8-gpus | <p>I am attempting to perform machine translation using a transformer model in a manner almost identical to the original article. While the model works reasonably well, it requires greater computational resources. To address this, I ran the model on a computer with 8 GPU processors, but I lack experience in this area.
... | 1,340 | |
machine translation | Tensorflow: Creating a custom text dataset to use in machine translation | https://stackoverflow.com/questions/57099339/tensorflow-creating-a-custom-text-dataset-to-use-in-machine-translation | <p>I would want to use my own data to train the model for a <a href="https://www.tensorflow.org/beta/tutorials/text/transformer" rel="nofollow noreferrer">machine translation system using Transformers</a>. There are a set of datasets already available in TFDS (Tensorflow datasets) and there is also option to <a href="h... | <p>The dataset in the colab notebook is just a collection of pairs of strings (the translation pairs of sentences). This doesn't seem to be what you have there (you have name and age??).</p>
<p>However, it is certainly possible to create a Dataset from a csv of language pairs (or name and age for that matter!). There ... | 1,341 |
machine translation | No gradients provided for any variable, Attention-based Neural Machine Translation, tensorflow-keras implementation | https://stackoverflow.com/questions/62906248/no-gradients-provided-for-any-variable-attention-based-neural-machine-translati | <p>I am trying to implement an Attention-based Neural Machine Translation architecture in Keras. I have encoder (Extends Model class), attention(layer class) and decoder(Model class) classes. Finally, I have a "combine" class (Extends Model) that combines all these models.</p>
<p>Here is the issue I am facin... | 1,342 | |
machine translation | What are the methods to collect data for building machine translation model (French to German) | https://stackoverflow.com/questions/56971308/what-are-the-methods-to-collect-data-for-building-machine-translation-model-fre | <p>I have a lot of emails in french language and I want to convert it into German language.</p>
<p>Now for the same I need Machine Translation Model, but not sure how to collect data for creating the model.</p>
<p>It's ok to have a low accuracy in the starting but I am not finding a way to start collecting data. </p>... | <blockquote>
<p>German-French texts extracted from the website of the Federal Foreign Office Berlin. This includes 11,852 pairs that were translated between October 2013 and the beginning of November 2015 and converted into a .TMX file format.</p>
</blockquote>
<p><a href="https://data.europa.eu/euodp/en/data/datase... | 1,343 |
machine translation | Machine translation for multilingual sentiment analysis | https://stackoverflow.com/questions/4482758/machine-translation-for-multilingual-sentiment-analysis | <p>I am trying to do sentiment analysis for non english languages like japenese, chinese, german etc. I want to know if any Machine translator available for translating documents in these languages to english. I am working on JAVA so I should be able to call the API or tool.
I have used google translator API so please... | <p>Sentiment analysis is highly dependent on both the culture and the domain of practice (see <a href="http://en.wikipedia.org/wiki/Sentiment_analysis" rel="nofollow">http://en.wikipedia.org/wiki/Sentiment_analysis</a> ). We are working in the area of SA for scientific texts and this is undoubtedly a research area. So ... | 1,344 |
machine translation | Neural machine translation - seq2seq encoder-decoder | https://stackoverflow.com/questions/65879201/neural-machine-translation-seq2seq-encoder-decoder | <p>I am working on seq2seq NMT for french to english translation. In the inference model I am getting cardinality error.</p>
<blockquote>
<p>ValueError: Data cardinality is ambiguous:<br />
x sizes: 1, 5, 5<br />
Please provide data which shares the same first dimension.</p>
</blockquote>
<pre class="lang-py prettyprin... | 1,345 | |
machine translation | How to tune a Machine Translation model with huge language model? | https://stackoverflow.com/questions/29869607/how-to-tune-a-machine-translation-model-with-huge-language-model | <p><code>Moses</code> is a software to build machine translation models. And <code>KenLM</code> is the defacto language model software that moses uses.</p>
<p>I have a textfile with 16GB of text and i use it to build a language model as such:</p>
<pre><code>bin/lmplz -o 5 <text > text.arpa
</code></pre>
<p>The... | <p>Answering how to use <code>filter</code> command of <a href="https://kheafield.com/code/kenlm/" rel="nofollow noreferrer">KenLM</a></p>
<pre><code>cat small_vocabulary_one_word_per_line.txt \
| filter single \
"model:LM_large_vocab.arpa" \
output_LM_small_vocab.
</code></pre>
<p>Note: that <co... | 1,346 |
machine translation | How to use locally saved United MUP model in Unbabel-Comet model for Machine Translation Evaluation? | https://stackoverflow.com/questions/76953227/how-to-use-locally-saved-united-mup-model-in-unbabel-comet-model-for-machine-tra | <p>From <a href="https://huggingface.co/Unbabel/unite-mup" rel="nofollow noreferrer">https://huggingface.co/Unbabel/unite-mup</a>, there's a model that comes from the <a href="https://aclanthology.org/2022.acl-long.558/" rel="nofollow noreferrer">UniTE: Unified Translation Evaluation</a> paper. The usage was documented... | <p>First ensure that you have the required <code>unbabel-comet</code> version to support the model,</p>
<pre><code>pip install unbabel-comet>=2.0.1
</code></pre>
<p>Then</p>
<pre><code>import os
from huggingface_hub import snapshot_download
from comet.models.multitask.unified_metric import UnifiedMetric
model_path... | 1,347 |
machine translation | Machine translation transformer output - "unknown" tokens? | https://stackoverflow.com/questions/69595863/machine-translation-transformer-output-unknown-tokens | <p>When decoding / translating a test dataset after training on the base Transformer model (Vaswani et. al.), I sometimes see this token "unk" in the ouput.</p>
<p>"unk" here refers to an unknown token, but my question is what is the reasoning behind that? Based on <a href="https://nlp.stanford.edu/... | <p>Neural machine translation models have a limited vocabulary. The reason is that you get the distribution over the target vocabulary tokens by multiplying the hidden state of the encoder by a matrix that has one row for each vocabulary token. The paper that you mention uses hidden state of 1000 dimensions. If you wan... | 1,348 |
machine translation | Why is the Multilingual App Toolkit not generating machine translations? | https://stackoverflow.com/questions/46584891/why-is-the-multilingual-app-toolkit-not-generating-machine-translations | <p>My Multilingual App Toolkit is throwing an error when trying to connect to my azure subscription and generate machine translations.</p>
<p>A couple months ago I successfully set up the new Multilingual App Toolkit to use the Translator Text API in the Azure Market Place on my Azure account. I did this following th... | 1,349 | |
machine translation | trouble installing a protocol-buffer known as SentencePiece too, to alleviate the open vocabulary problems in neural machine translation | https://stackoverflow.com/questions/55358694/trouble-installing-a-protocol-buffer-known-as-sentencepiece-too-to-alleviate-th | <p>im trying to install a protocol-buffer known as SentencePiece too, to alleviate the open vocabulary problems in neural machine translation .</p>
<p>I used this command as suggested on github documentation :</p>
<p>sudo apt-get install cmake build-essential pkg-config libgoogle-perftools-dev</p>
<p>it gives an err... | 1,350 | |
machine translation | Metrics or evaluation about machine learning translation | https://stackoverflow.com/questions/46187542/metrics-or-evaluation-about-machine-learning-translation | <p>Could you guys recommend some evaluation or metrics about machine learning for translation: for example Japanese to English et al. If possible, could you tell me some papers about metrics. I am a new one to translation. Thanks! </p>
| <p>Despite continuous critics and debates starting with <a href="http://homepages.inf.ed.ac.uk/miles/papers/eacl06.pdf" rel="nofollow noreferrer">this 2006 article</a>, <strong>BLEU</strong> (<strong><em>B</strong>i<strong>L</strong>ingual <strong>E</strong>valuation <strong>U</strong>nderstudy</em>) score is still the... | 1,351 |
machine translation | Save load and retrain a tensorflow model for machine translation | https://stackoverflow.com/questions/76412332/save-load-and-retrain-a-tensorflow-model-for-machine-translation | <p>I've been trying train a model for machine translation. It worked pretty fine when I trained it for 10 epochs at a time and tested it. But when I try to train it for 1 epoch at a time, save and load it to continue from where I left earlier it gives some errors.</p>
<pre><code>import tensorflow as tf
import einops
i... | 1,352 | |
machine translation | How can i use BERT fo machine Translation? | https://stackoverflow.com/questions/61523829/how-can-i-use-bert-fo-machine-translation | <p>I got a big problem. For my bachelor thesis I have to make a machine tranlation model with BERT.
But I am not getting anywhere right now.
Do you know a documentation or something that can help me here?
I have read some papers in that direction but maybe there is a documentation or tutorial that can help me.</p>
... | <p>BERT is not a machine translation model, BERT is designed to provide a contextual sentence representation that should be useful for various NLP tasks. Although there exist ways how BERT can be incorporated into machine translation (<a href="https://openreview.net/forum?id=Hyl7ygStwB" rel="noreferrer">https://openrev... | 1,353 |
machine translation | Transformers architecture for machine translation | https://stackoverflow.com/questions/60398105/transformers-architecture-for-machine-translation | <p>I have adapted the base transformer model, for my corpus of aligned Arabic-English sentences. As such the model has trained for 40 epochs and accuracy (SparseCategoricalAccuracy) is improving by a factor of 0.0004 for each epoch.
To achieve good results, my estimate is to attain final accuracy anywhere around 0.5 an... | <p>Do you mean Tesla K80 on aws p2.xlarge instance.
If that is the case, these gpus are very slow. You should use p3 instances on aws with V100 gpus. You will get around 6-7 times speedup.
Checkout <a href="https://avp-project.uk/blog-gpu-box-vs-cloud-for-deep-learning" rel="nofollow noreferrer">this</a> for more deta... | 1,354 |
machine translation | Seq2Seq Neural Machine Translation step for aligning right to left languages with English (Or any LTR language) | https://stackoverflow.com/questions/76183491/seq2seq-neural-machine-translation-step-for-aligning-right-to-left-languages-wit | <p>I've so far worked with left to right languages and NLTK worked fine for tokenization. But while working on a research paper focused on several languages including RTL languages, the normal procedure has been giving me completely inaccurate translations. Could anyone please let me know what is the norm in neural mac... | 1,355 | |
machine translation | Statistical Machine Translation from Hindi to English using MOSES | https://stackoverflow.com/questions/27669446/statistical-machine-translation-from-hindi-to-english-using-moses | <p>I need to create a Hindi to English translation system using MOSES. I have got a parallel corpora containing about 10000 Hindi sentences and corresponding English translations. I followed the method described in the <a href="http://www.statmt.org/moses/?n=Moses.Baseline" rel="nofollow">Baseline system creation page<... | <p>Moses does not support Hindi for tokenization, the <code>tokenizer.perl</code> uses the <code>nonbreaking_prefix.*</code> files (from <a href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl#L516" rel="noreferrer">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/to... | 1,356 |
machine translation | Remove "Machine Translated by Google" | https://stackoverflow.com/questions/67645265/remove-machine-translated-by-google | <p>I am using a new Google's Document Translation API that is still in preview. After it translate the document, translated document have <code>Machine Translated by Google</code> text at the top of each page. How can I disable adding that text?</p>
| <p>It's not possible to do natively via Google Cloud, according to Google Technical Support. While you could theoretically do post-processing, you might run afoul of the requirements listed in <a href="https://cloud.google.com/translate/attribution" rel="noreferrer">Google's Attribution Requirements</a> . For example:... | 1,357 |
machine translation | Best evaluation method for real-time machine translation? | https://stackoverflow.com/questions/43943372/best-evaluation-method-for-real-time-machine-translation | <p>I'm aware that there are many different methods like BLEU, NIST, METEOR etc. They all have their pros and cons, and their effectiveness differs from corpus to corpus. I'm interested in real-time translation, so that two people could have a conversation by typing out a couple sentences at a time and having it immedia... | <p>What you are asking for, belongs to the domain of <em>Confidence Estimation</em>, nowadays (within the Machine Translation (MT) community) better known as <em>Quality Estimation</em>, i.e. "assigning a score to MT output without access to a reference translation". </p>
<p>For MT evaluation (using BLEU, NIST or METE... | 1,358 |
machine translation | losing leading & trailing space when translated using Google Machine Translation | https://stackoverflow.com/questions/2887980/losing-leading-trailing-space-when-translated-using-google-machine-translation | <p>I am using google ajax based translation API like in the below example.</p>
<pre><code>google.load("language", "1");
function initialize() {
var text = document.getElementById("text").innerHTML;
google.language.detect(text, function(result) {
if (!result.error && result.language) {... | <p>Try:</p>
<pre><code>function initialize() {
var text = document.getElementById("text").innerHTML;
var spaceMatch = text.match(/^(\s*).*?(\s*)$/);
google.language.detect(text, function(result) {
if (!result.error && result.language) {
google.language.translate(text, result.language, "en",
... | 1,359 |
machine translation | Machine Translation using babelize_shell() in NLTK | https://stackoverflow.com/questions/12267544/machine-translation-using-babelize-shell-in-nltk | <p>Hi I am learning Natural Language processing using NLTK. I am trying to implement babelize_shell() example of the book. What I am doing is executing babelize_shell(), after that I am entering my string, followed by german as stated in the book, followed by run.</p>
<p>The error I am getting is:</p>
<pre><code>Trac... | <p>I'm having the same problem right now.</p>
<p>I've found this:
<a href="http://nltk.googlecode.com/svn/trunk/doc/api/nltk.misc.babelfish-module.html">http://nltk.googlecode.com/svn/trunk/doc/api/nltk.misc.babelfish-module.html</a></p>
<p>and it says:
BabelfishChangedError
Thrown when babelfish.yahoo.com changes s... | 1,360 |
machine translation | Tying weights in neural machine translation | https://stackoverflow.com/questions/49299609/tying-weights-in-neural-machine-translation | <p>I want to tie weights of the <code>embedding</code> layer and the <code>next_word</code> prediction layer of the decoder. The embedding dimension is set to 300 and the hidden size of the decoder is set to 600. Vocabulary size of the target language in NMT is 50000, so embedding weight dimension is <code>50000 x 300<... | <p>You could use linear layer to project the 600 dimensional space down to 300 before you apply the shared projection. This way you still get the advantage that the entire embedding (possibly) has a non-zero gradient for each mini-batch but at the risk of increasing the capacity of the network slightly.</p>
| 1,361 |
machine translation | Creating a Neural Machine Translation basics | https://stackoverflow.com/questions/69988135/creating-a-neural-machine-translation-basics | <p>I'm currently working on a project design where I will create a program/model to translate my native dialect to English, I'm asking is there any books or anything that can you recommend to me in creating my project.</p>
| <p>On the NLP side of things there's this course: <a href="https://www.youtube.com/watch?v=dIUTsFT2MeQ" rel="nofollow noreferrer">Natural Language Processing with spaCy & Python - Course for Beginners</a> and this older course: <a href="https://www.youtube.com/watch?v=X2vAabgKiuM" rel="nofollow noreferrer">Natural ... | 1,362 |
machine translation | Machine learning for natural language processing - Custom translation | https://stackoverflow.com/questions/42947128/machine-learning-for-natural-language-processing-custom-translation | <p>Lets say I have the following very simplified training and testing observations. </p>
<p><strong>Training</strong></p>
<pre><code>input: her favourite dog was a huskey and her favourite cat was a leopard
output: dog=huskey, cat=leopard
input: her favourite dog was a beagle and her favourite cat was a lion
output:... | <p>(1) I would reformulate the problem you are trying to solve to: Given some specific <strong>animal A</strong> in <strong>sentence S</strong> find the best animal <strong>class C</strong>. So given sentence 1: </p>
<blockquote>
<p>her favourite dog was a huskey and her favourite cat was a leopard</p>
</blockquote>... | 1,363 |
machine translation | Can I customize the dictionary of a pre-trained transformer neural machine translation model? | https://stackoverflow.com/questions/58346657/can-i-customize-the-dictionary-of-a-pre-trained-transformer-neural-machine-trans | <p>There are many pre-trained machine translations models available, but it seems like they all need to be run with the dictionary they are trained with. The dictionaries sometimes can have less coverage for my data set (even BPE based ones), and sometimes miss important words as unknowns. What are the best ways to cus... | 1,364 | |
machine translation | Is it possible to evaluate Machine Translations using Sentence BERT? | https://stackoverflow.com/questions/79381185/is-it-possible-to-evaluate-machine-translations-using-sentence-bert | <p>I'm not referring to <a href="https://arxiv.org/abs/1904.09675" rel="nofollow noreferrer">BERTScore</a>. BERTScore uses token-level word embeddings, you compute pairwise cosine similarity of word embeddings and obtain scores using greedy matching.</p>
<p>I'm referring to <a href="https://arxiv.org/abs/1908.10084" re... | <p>Although the <a href="https://arxiv.org/abs/1908.10084" rel="nofollow noreferrer">Sentence BERT</a> improve the ability to evaluate of semantic similarity to BLEU, it lacks sufficient sensitivity to surface-level error such as spelling mistake, word order issue etc. According to this paper ( <a href="https://arxiv.o... | 1,365 |
machine translation | A Variation on Neural Machine Translation | https://stackoverflow.com/questions/58445247/a-variation-on-neural-machine-translation | <p>I have been processing this thought in my head for a long time now. So in NMT, We pass in the text in the source language in the encoder seq2seq stage and the language in the target language in the decoder seq2seq stage and the system learns the conditional probabilities for each word occurring with its target langu... | <p>In that case, you would be learning a model that copies the input symbol to the output. It is trivial for the attention mechanism to learn the identity correspondence between the encoder and decoder states. Moreover, RNNs can easily implement a counter. It thus won't provide any realistic estimate of the probability... | 1,366 |
machine translation | Change putty translation to UTF-8 by remote machine | https://stackoverflow.com/questions/23336829/change-putty-translation-to-utf-8-by-remote-machine | <p>How to change "<strong>remote character set</strong>" in Translation of a putty by remote machine? </p>
<p>Its by default set to ISO, so when I run my application, I get weird characters. It can be changed by host machine.</p>
<p>But can I change the putty terminal settings from remote machine via some command so ... | <p>I fear it is not possible. character set is controlled by LC_* environment variables. Putty has no way to get theirs values. </p>
<p>You can associate "remote character set" with each account in Putty. It should be sufficient.</p>
<p>The best thing is to configure all your environments in UTF-8 (which is default f... | 1,367 |
machine translation | loss is drastically decreasing whereas BLEU score stays at zero during training of the seq2seq RNN for machine translation | https://stackoverflow.com/questions/75139358/loss-is-drastically-decreasing-whereas-bleu-score-stays-at-zero-during-training | <p>I'm trying to train an RNN for machine translation, using LSTM. However,the BLEU at the first batch decreases to zero and stay at this level during all the training. At the same time loss is drastically decreasing. What may be the problem?</p>
<p>**the code: **</p>
<pre><code>class SimpleRNNTranslator(nn.Module):
... | <p>You probably forgot to shift the target sequence when computing the loss.</p>
<p>At the training time, the decoder sequence needs to be shifted such that (<em>n</em>-1)-th predicts <em>n</em>-th word. For sequence <code>w1 w2 w3 w4</code> with beginning-of-sentence token <code>[BOS]</code> and end-of-sentence token ... | 1,368 |
machine translation | How Can I Optimize Machine Translation Model Training to Overcome GPU Memory Overflow Issues? | https://stackoverflow.com/questions/78645618/how-can-i-optimize-machine-translation-model-training-to-overcome-gpu-memory-ove | <p>I'm trying to train a fairly standard machine translation transformer model using PyTorch. It's based on the "Attention is All You Need" paper. When I ran it on my PC with standard hyperparameters and a batch size of 128 segments (pairs of source and target language sentences), it worked fine but was slow,... | 1,369 | |
machine translation | Tensorflow Neural Machine Translation Example - Loss Function | https://stackoverflow.com/questions/65028889/tensorflow-neural-machine-translation-example-loss-function | <p>Im stepping through the code here: <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/nmt_with_attention</a>
as a learning method and I am confused as to when the loss function is called and what is passed. I added two print stat... | <p>The loss is treated similar to the rest of the graph. In tensorflow calls like tf.keras.layers.Dense and tf.nn.conv2d don't actually do the operation, but instead they define the graph for the operations. I have another post here <a href="https://stackoverflow.com/questions/44210561/how-do-backpropagation-works-in... | 1,370 |
machine translation | transformers: how to use hugging face EncoderDecoderModel to do machine translation task? | https://stackoverflow.com/questions/65167131/transformers-how-to-use-hugging-face-encoderdecodermodel-to-do-machine-translat | <p>I have trained a EncoderDecoderModel from huggging face to do english-German translation task. I tried to overfit a small dataset (100 parallel sentences), and use <code>model.generate()</code> then <code>tokenizer.decode()</code> to perform the translation. However, the output seems to be proper German sentences, b... | 1,371 | |
machine translation | Moses machine translation - using Moses with Anymalign | https://stackoverflow.com/questions/36072799/moses-machine-translation-using-moses-with-anymalign | <p>Does anyone know how to replace GIZA++ in Moses with Anymalign which is obtained from <a href="https://anymalign.limsi.fr/" rel="nofollow">here</a> </p>
<p>In fact, there is 9 <a href="http://www.statmt.org/moses/?n=FactoredTraining.HomePage" rel="nofollow">steps</a> to using Moses, I want to start the step 4 witho... | <p>In the moses <a href="http://www.statmt.org/moses/manual/manual.pdf" rel="nofollow noreferrer">manual</a>
on page 351 in the section <strong>8.3 Reference: All Training Parameters</strong> there is described parameter <code>--first-step</code> <em>-- first step in the training process (default 1)</em>, so you can us... | 1,372 |
machine translation | Translation example not working anymore in Node-Red and Bluemix | https://stackoverflow.com/questions/31380846/translation-example-not-working-anymore-in-node-red-and-bluemix | <p>Node-Red on bluemix provides a Watson Machine Translation node. Bluemix recently changed the translation APIs that this uses, releasing a new Watson Language Translation API. (see <a href="https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/language-translation/migrating.shtml" rel="nofollow">https:... | <p><s>We're currently working on updates to support the API changes in the nodes. Hopefully, we'll have this working by the end of the week.</s></p>
<p>This issue has now been resolved. Please update your source and try again...</p>
| 1,373 |
machine translation | django compiling translation string in different machines | https://stackoverflow.com/questions/23384847/django-compiling-translation-string-in-different-machines | <p>On my system i have changed mgstr in <code>django.po</code> and compiled it and i get the translation as expected.Now my question is should i run <code>manage.py compilemessages</code> even on the production machine or checkin the binary file(<code>django.mo</code>) so that when it is checked out on prod machine com... | <p>Typically, <a href="https://github.com/github/gitignore/blob/master/Python.gitignore" rel="nofollow">.mo files are git-ignored</a>. This means it makes sense to re-compilemessages after you checkout the latest revision.</p>
<p>EDIT:</p>
<p>The procedure I use is the following: .po are part of git rep, .mo are git-... | 1,374 |
machine translation | Embedding layer in neural machine translation with attention | https://stackoverflow.com/questions/64675228/embedding-layer-in-neural-machine-translation-with-attention | <p>I am trying to understanding how to implement a seq-to-seq model with attention from this <a href="https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html?highlight=attention" rel="nofollow noreferrer">website</a>.</p>
<p>My question: Is nn.embedding just returns some IDs for each word, so the e... | <p>According to the <a href="https://pytorch.org/docs/stable/generated/torch.nn.Embedding.html" rel="nofollow noreferrer">PyTorch docs</a>:</p>
<blockquote>
<p>A simple lookup table that stores embeddings of a fixed dictionary and size.</p>
<p>This module is often used to store word embeddings and retrieve them using i... | 1,375 |
machine translation | Bahdanaus attention in Neural machine translation with attention | https://stackoverflow.com/questions/63268582/bahdanaus-attention-in-neural-machine-translation-with-attention | <p>I am trying to understand Bahdanaus attention using the following tutorial:
<a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/nmt_with_attention</a></p>
<p>The calculation is the following:</p>
<pre><code>self.attention_units = ... | <blockquote>
<ol>
<li>) I cannot understand why the shape of tf.nn.tanh(self.W1(last_inp_dec) + self.W2(input_enc)) is
(batch_size,max_len,attention_units) ?</li>
</ol>
</blockquote>
<p>From the comments section of the code in <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention" rel="nofollow noreferr... | 1,376 |
machine translation | Not able to generate correct English to SQL translations using LSTM for machine translation | https://stackoverflow.com/questions/49199943/not-able-to-generate-correct-english-to-sql-translations-using-lstm-for-machine | <p>I'm using recurrent neural networks to train a model to translate sample english sentences such as "fetch all employee data" into sql such as "SELECT * FROM EMPLOYEE". Right now my program takes 100 epochs of training time but translates all the inputs the same. Required libraries are tensorflow and keras. Could som... | <p><strong>TLDR;</strong> Your dataset is very small, biased and lacks the variety needed for RNNs. So you need 'some tricks' to make your code work. </p>
<p>The problem is <strong>you</strong> <strong>didn't shuffle your input data.</strong> (The fully working source code is <a href="https://drive.google.com/file... | 1,377 |
machine translation | Why special characters like () "" : [] are often removed from data before training translation machine? | https://stackoverflow.com/questions/64181801/why-special-characters-like-are-often-removed-from-data-before-traini | <p>I see that people often remove special characters like () "" : [] from data before training translation machine. Could you explain for me the benefits of doing so?</p>
| <p>Date clean-up or pre-processing is performed so that algorithms could focus on important, linguistically meaningful "words" instead of "noise". See <a href="https://towardsdatascience.com/nlp-building-text-cleanup-and-preprocessing-pipeline-eba4095245a0" rel="nofollow noreferrer">"<em>Removi... | 1,378 |
machine translation | Documentation of Moses (statistical machine translation) mose.ini file format? | https://stackoverflow.com/questions/30033707/documentation-of-moses-statistical-machine-translation-mose-ini-file-format | <p>Is there any documentation of the moses.ini format for Moses? Running moses at the command line without arguments returns available feature names but not their available arguments. Additionally, the structure of the .ini file is not specified in the manual that I can see.</p>
| <p>The main idea is that the file contains settings that will be used by the translation model. Thus, the documentation of values and options in <code>moses.ini</code> should be looked up in the Moses feature specifications.</p>
<p>Here are some excerpt I found on the Web about <code>moses.ini</code>.</p>
<p>In the <... | 1,379 |
machine translation | Can I create a custom domain with the IBM Watson Machine Translation API? | https://stackoverflow.com/questions/39120127/can-i-create-a-custom-domain-with-the-ibm-watson-machine-translation-api | <p>My goal is to create a custom translation engine for the financial domain, language pair CHT - EN and CHS - EN. I have respective dictionaries and aligned segments ready to import into a custom engine and train the engine.</p>
<p>If I understand the documentation (<a href="https://www.ibm.com/watson/developercloud/... | <p>To create a model you can use a glossary with high frequency or high confidence phrase translations or a parallel corpus(TMX file) instead.</p>
<p>As @Nathan said, if you use <code>zh-en-patent</code> as <code>base_model_id</code> you will have support for both Traditional and Simplified Chinese using <a href="http... | 1,380 |
machine translation | Machine Translation FFN : Dimension problem due to window size | https://stackoverflow.com/questions/72439789/machine-translation-ffn-dimension-problem-due-to-window-size | <p>this is my first time creating a FFN to train it to translate French to English using word prediction:
Input are two arrays of size <em>2 x window_size + 1</em> from source language and <em>window_size</em> target language. And the label of size 1</p>
<p>For e.g for window_size = 2:</p>
<pre><code>["je",&q... | 1,381 | |
machine translation | Neural Machine Translation model predictions are off-by-one | https://stackoverflow.com/questions/48256372/neural-machine-translation-model-predictions-are-off-by-one | <p><strong>Problem Summary</strong></p>
<p>In the following example, my NMT model has high loss because it correctly predicts <code>target_input</code> instead of <code>target_output</code>.</p>
<pre><code>Targetin : 1 3 3 3 3 6 6 6 9 7 7 7 4 4 4 4 4 9 9 10 10 10 3 3 10 10 3 10 3 3 10 10 3 9... | <p>The core issue with the NMT model used to predict a language-like syntax with a repetitive structure is that it becomes incentivized to simply predict whatever the past prediction was. Since it is fed the correct previous prediction at each step by <code>TrainingHelper</code> to speed up training, this artificially ... | 1,382 |
machine translation | Tensorflow Neural machine translation with attention Graph execution error: | https://stackoverflow.com/questions/71892574/tensorflow-neural-machine-translation-with-attention-graph-execution-error | <p>I am currently using tensorflow and following tutorial <a href="https://www.tensorflow.org/text/tutorials/nmt_with_attention" rel="nofollow noreferrer">https://www.tensorflow.org/text/tutorials/nmt_with_attention</a>
I am trying to make a Korean to English translator by referring to the above document. However, whil... | 1,383 | |
machine translation | "Unicode Error 'unicodeescape' codec can't decode bytes..." when writing Windows file paths | https://stackoverflow.com/questions/1347791/unicode-error-unicodeescape-codec-cant-decode-bytes-when-writing-windows | <p>I am using Python 3.1 on a Windows 7 machine. Russian is the default system language, and utf-8 is the default encoding.</p>
<p>Looking at the answer to a <a href="https://stackoverflow.com/questions/778096/problem-opening-a-text-document-unicode-error">previous question</a>, I have attempting using the "codecs... | <p>The problem is with the string</p>
<pre><code>"C:\Users\Eric\Desktop\beeline.txt"
</code></pre>
<p>Here, <code>\U</code> in <code>"C:\Users</code>... starts an eight-character Unicode escape, such as <code>\U00014321</code>. In your code, the escape is followed by the character 's', which is invalid.</p>
<p>You e... | 1,384 |
machine translation | how do i predict my machine translation after i loaded model.5 | https://stackoverflow.com/questions/60394098/how-do-i-predict-my-machine-translation-after-i-loaded-model-5 | <p>i had build seq2seq translation with keras it is translating between 2 languages </p>
<p>then i saved the whole model as model.h5</p>
<pre><code> model.save('model.h5')
</code></pre>
<p>and then i loaded the <strong>model.h5</strong> in another python script</p>
<pre><code>from keras.models import load_model
mo... | <p>You can get the prediction of a model using </p>
<pre><code>predicted_output = model.predict(input)
</code></pre>
| 1,385 |
machine translation | Enforcing a Prediction Language for NLLB Machine Translation Model | https://stackoverflow.com/questions/78600144/enforcing-a-prediction-language-for-nllb-machine-translation-model | <p>All I need is a way to insert my GenerationConfig into the HuggingFace <code>Seq2Seq</code> Trainer.</p>
<p>I want to enforce <code>facebook/nllb-200-distilled-600M</code> model's predictions to be in Arabic, I am using <code>transformers</code> library.</p>
<p>Here is my Trainer Code</p>
<pre><code>from transformer... | 1,386 | |
machine translation | Can I use BERT or BART for machine translation? | https://stackoverflow.com/questions/66862585/can-i-use-bert-or-bart-for-machine-translation | <p>I am working on a project to use a pre-trained model and finetune it for customized language translations, for example from English to French. Is it possible to load these models in Tensorflow and run them to see how translations turn out and fine-tune afterward?</p>
| <p>Probably the fastest way to do so is relying on the HuggingFace transformers library. If you're not familiar with it, you may take a look at their official <a href="https://huggingface.co/transformers/quicktour.html" rel="nofollow noreferrer">documentation</a>. To fine-tune a BART for NMT you can use directly this p... | 1,387 |
machine translation | How to predict <unk> token for neural machine translation | https://stackoverflow.com/questions/73847435/how-to-predict-unk-token-for-neural-machine-translation | <p>For example, if I have the words MKIK or "牛逼" (which is artificially created) how can we tell neural networks (transformer model) to keep the same output?</p>
<p>The problem is with using the transformer model on fairseq.</p>
<p>I found fairseq has <code>--replace-unk</code> parameters, but it doesn't seem... | <p>I have an idea myself, pretrain a naive model with all of the unknown tokens, like Chinese characters. Then finetune the model without those unknown tokens.</p>
<p>I guess in this way the neural network connections will not update?</p>
<p>But I will have to play around the structure and see.</p>
| 1,388 |
machine translation | How can I fine-tune mBART-50 for machine translation in the transformers Python library so that it learns a new word? | https://stackoverflow.com/questions/76191862/how-can-i-fine-tune-mbart-50-for-machine-translation-in-the-transformers-python | <p>I try to fine-tune mBART-50 (<a href="https://arxiv.org/pdf/2008.00401" rel="nofollow noreferrer">paper</a>, <a href="https://huggingface.co/facebook/mbart-large-50" rel="nofollow noreferrer">pre-trained model on Hugging Face</a>) for machine translation in the transformers Python library. To test the fine-tuning, I... | <p>One could add the following to fine-tune mBART-50:</p>
<pre><code>from transformers.optimization import AdamW
# Set up the optimizer and training settings
optimizer = AdamW(model.parameters(), lr=1e-4)
model.train()
print('Fine-tuning started')
for i in range(100):
optimizer.zero_grad()
output = model(**mo... | 1,389 |
machine translation | How to concatenate a split word using NLP caused by tokenizers after machine translation? | https://stackoverflow.com/questions/77005341/how-to-concatenate-a-split-word-using-nlp-caused-by-tokenizers-after-machine-tra | <p>Russian translation produces the following result, is there a NLP function which we can use to concatenate as "Europe's" in the following string?</p>
<p>"Nitzchia Protector Todibo can go to one of Europe ' s top clubs"</p>
| <p>Try detokenizers but because there are rules to process tokens that are expected to change <code>x 's</code> -> <code>x's</code> but not <code>x ' s</code> -> <code>x's</code>, you might have to iteratively apply the detokenizer, e.g. using <code>sacremoses</code></p>
<pre><code>>>> from sacremoses im... | 1,390 |
machine translation | Do programming language compilers first translate to assembly or directly to machine code? | https://stackoverflow.com/questions/845355/do-programming-language-compilers-first-translate-to-assembly-or-directly-to-mac | <p>I'm primarily interested in popular and widely used compilers, such as gcc. But if things are done differently with different compilers, I'd like to know that, too.</p>
<p>Taking gcc as an example, does it compile a short program written in C directly to <em>machine</em> code, or does it first translate it to human-... | <p>gcc actually produces assembler and assembles it using the <strong>as</strong> assembler. Not all compilers do this - the MS compilers produce object code directly, though you can make them generate assembler output. Translating assembler to object code is a pretty simple process, at least compared with C→Assembly o... | 1,391 |
machine translation | Translation API with candidates | https://stackoverflow.com/questions/37982632/translation-api-with-candidates | <p>I am looking for a translation API that outputs all the candidates and not just single "best" candidate.</p>
<p>All statistical machine translation systems at the last stage score the list of translation candidates and choice the best candidate. I wonder if there is a system like Google translate or Microsoft trans... | <p>I think WordNet is good for this:
<a href="https://wordnet.princeton.edu/" rel="nofollow">https://wordnet.princeton.edu/</a></p>
<p>Originally wordnet is english ontology describing english word in english, showing synonims, definition etc. but there are a lot of other language wordnets projects as well as multilin... | 1,392 |
machine translation | Why does my translation machine always output 't'? | https://stackoverflow.com/questions/60565308/why-does-my-translation-machine-always-output-t | <p>My code:</p>
<pre><code>import numpy as np
from keras import Input, Model
from keras.layers import LSTM, Dense
input_texts = []
target_texts = []
input_characters = set()
target_characters = set()
with open('catalan.txt', 'r', encoding = 'utf-8') as f:
lines = f.read().split('\n')
for line in lines[: min(653... | <p>As @Recessive answered in comments: increase epochs.</p>
<p>I tested with 1000 and it worked, without changing other parameters.</p>
<p>Also: by tweaking those other parameters, results get better with fewer epochs.</p>
<p>That means: the code seems correct after correcting the <code>return</code> inside <code>wh... | 1,393 |
machine translation | what is the format of word alignments in machine translation? | https://stackoverflow.com/questions/37982045/what-is-the-format-of-word-alignments-in-machine-translation | <p>I am reading <a href="http://www.aclweb.org/anthology/P05-1032" rel="nofollow">this</a> paper and having a difficulty understanding the way word alignments are represented. To be precise, right below section <code>4.1</code>, the authors say the format of the alignment is <code>(i,j)</code> where <code>i</code> rang... | 1,394 | |
machine translation | Output of the Embedding layer in Decoder(Neural machine translation) | https://stackoverflow.com/questions/63272961/output-of-the-embedding-layer-in-decoderneural-machine-translation | <p>I am trying to understand Attention model using the following tutorial <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/nmt_with_attention</a></p>
<p>In the Decoder section it's written:</p>
<pre><code># x shape after passing t... | <p>The model in this tutorial is a sequence to sequence.so at each step the model receives One word of the entire text. This is why the max_len in (batch_size, max_len,embedding_dim) is equal to 1. each word is represented by ONE vector of size = embedding_dim</p>
| 1,395 |
machine translation | Phrase-based translation at Google API PBMT | https://stackoverflow.com/questions/51976180/phrase-based-translation-at-google-api-pbmt | <p>I am trying to use phrase-based machine translation as provided by the Google API (PBMT). </p>
<p>Is it possible to provide Google with my own mappings of terms between languages, thus extending their phrase table? </p>
<p>Thank you!
cheers
zabe</p>
| <p>tl;dr: It's not possible. </p>
<p>The parameters you can specify in a Translation Request are only the ones listed in the <a href="https://cloud.google.com/translate/docs/reference/translate" rel="nofollow noreferrer">Translate Method reference</a>.</p>
<p>If you're interested, Google released <a href="https://clo... | 1,396 |
machine translation | Google Translate vs. Google Cloud Translate | https://stackoverflow.com/questions/65388265/google-translate-vs-google-cloud-translate | <p>Google Cloud Translation offers Neural Machine Translation (NMT) and Phrase-Based Machine Translation (PBMT). It is stated that "nmt model is used if the language pair is supported, otherwise the PBMT model is used."(<a href="https://cloud.google.com/translate/docs/advanced/translating-text-v3" rel="nofoll... | 1,397 | |
machine translation | Translating MIPS to machine code | https://stackoverflow.com/questions/11972320/translating-mips-to-machine-code | <pre><code> .text
.align 2
.global main
.equ val,0x4712 # 16-bit binary code for 0x4712: 0100 0111 0001 0010
# Program code starts now
main:
movi r16,val
movi r17,0
loop: addi r17,r17,1
subi r16,r16,1
bne r1... | <p>First off, why dont you at least try using an assembler to see what is produced? </p>
<p>You need to read the mips instruction set references to see the real mips instructions, often the pseudo instructions are described in these references. as far as movi goes, load upper is a bit obvious for controlling the uppe... | 1,398 |
machine translation | Remove "Machine Translated by Google" google api document translate | https://stackoverflow.com/questions/78653380/remove-machine-translated-by-google-google-api-document-translate | <p>I am paying to use the Google api to translate document and google is adding <code>Machine Translated by Google</code> on each page.</p>
<p>I know this is part of the attribution requirements but if I specify it on my website it should not be required on the generated document.</p>
<pre class="lang-js prettyprint-ov... | 1,399 | |
implement RAG | Is there a way to implement multiple csv's as RAG? | https://stackoverflow.com/questions/78951491/is-there-a-way-to-implement-multiple-csvs-as-rag | <p>I recently uploaded a csv and wanted to create a project to analyze the csv with llm.</p>
<p>However, I don't know which RAG to use for RAG through the csv file.</p>
<p>In addition, the resources of the csv file are numbers, not natural language, so it seems too difficult to draw out the performance of RAG.</p>
<p>D... | <p>I think the advantage of rag is that it processes unstructured text data. If you want to process csv data, you still need some specific functions.</p>
| 1,400 |
implement RAG | How to Implement Retrieval Augmented Generation (RAG) for Semantic Search and Summarization? | https://stackoverflow.com/questions/78661577/how-to-implement-retrieval-augmented-generation-rag-for-semantic-search-and-su | <p>I am working on a project for a publishing house that involves implementing semantic search across an archive of approximately 50,000 articles, each averaging 15 pages in length. My understanding is that I need to use a Retrieval Augmented Generation (RAG) approach to achieve this.
Here are my specific requirements:... | 1,401 | |
implement RAG | RAG engine error: Can't instantiate abstract class BaseNode | https://stackoverflow.com/questions/78864925/rag-engine-error-cant-instantiate-abstract-class-basenode | <p>While executing RAG query engine as per the following code</p>
<pre><code>query_engine = RetrieverQueryEngine.from_args(
retriever,llm=AzureOpenAI(api_key='xxxxxxxxxxxxxxx',
azure_endpoint="https://xxxxxxxxxxxxxx/",
engine="openai-gpt35-1106",
temperature=0.1,
api_version="202... | 1,402 | |
implement RAG | How to implement vector stores and RAG with Open AI functions with proven rule base code generation | https://stackoverflow.com/questions/78716134/how-to-implement-vector-stores-and-rag-with-open-ai-functions-with-proven-rule-b | <p>How to implement vector stores and RAG with OpenAI playground functions json code rule base for ez function loading that is a lot of time very hard to do , this is a proven system to max you code structure that is valid and will load!, just because it is valid does not mean that it will load!!!</p>
<p>render a verif... | 1,403 | |
implement RAG | Creating Overall RAG status in Tableau | https://stackoverflow.com/questions/43907675/creating-overall-rag-status-in-tableau | <p>I have three RAG status build with logic. Now my requirement is to create overall RAG over them. There are different department filters applied on three RAG status. Now I want to implement overall RAG on below condition.
Please note - Below - G= Green, A=Amber and R=Red</p>
<p>a. G-G-G = G</p>
<p>b. G-G-A = G</p... | <p>This might be a possible solution,</p>
<p>Recode the labels 'A', 'G' and 'R' as 0,1,3 (numeric) respectively.</p>
<p>Now create a column which will be a sum of the recoded columns,
example, if the sequence is AGR, then new_col = 0+1+3 = 4</p>
<p>Now, create a calculated field (CF) with the following logic,</p>
<... | 1,404 |
implement RAG | How to implement RAG with LLMs for a large collection of local PDF documents | https://stackoverflow.com/questions/78118204/how-to-implement-rag-with-llms-for-a-large-collection-of-local-pdf-documents | <p>I am currently working on a project where I intend to utilize a LLM to provide answers to user inquiries, drawing from a substantial collection of local PDF documents. These documents are subject to daily updates, with approximately 10 new documents being added each day.</p>
<p>Could you suggest the most effective m... | <p>You can create a vector database storing all the documents (with a real-time pipeline that adds the new additions and indexes + generates embeddings for them too as they come in).</p>
<p>So when you want to create a new query - you would first retrieve any relevant documents from your dataset; then use this context ... | 1,405 |
implement RAG | VectorStore implementation throws type "vector" does not exist error with custom schema and table | https://stackoverflow.com/questions/79555127/vectorstore-implementation-throws-type-vector-does-not-exist-error-with-custom | <p>I am trying to implementing RAG using pgvector/Postgres and stuck on a strange problem where RAG search fails when running programmatically. The raw query works fine on PostgresDB though.</p>
<p>We have two different issues:</p>
<ol>
<li><p>When using the <a href="https://docs.spring.io/spring-ai/reference/api/vecto... | <p>The problem seems to be related to using the custom pgvector store dependency</p>
<pre><code><dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pgvector-store</artifactId>
</dependency>
</code></pre>
<p>As opposed to using PgVectorStore boot start... | 1,406 |
implement RAG | My llama2 model is talking to itself asking question and answering it to them using Conversational retrieval chain | https://stackoverflow.com/questions/79075644/my-llama2-model-is-talking-to-itself-asking-question-and-answering-it-to-them-us | <p>I was implementing RAG on a document with using the LLama2 model but my model is asking questions to itself and answering it to them.</p>
<pre class="lang-py prettyprint-override"><code>llm = LlamaCpp(model_path=model_path,
temperature=0,
max_tokens=2000,
top_p=0.1,
n_ctx=2048,
)
qa_chain = Con... | 1,407 | |
implement RAG | Trying to add records in RAG vector database Pinecone | https://stackoverflow.com/questions/78921436/trying-to-add-records-in-rag-vector-database-pinecone | <p>Hello All I am trying creating a RAG chatbot, that does a POST request when user clicks add. The purpose of the add, is to add the record in the RAG vector database. I can't seem to format the data properly to do, I was able to achieve something similar using python notebook.</p>
<p>Json Format:</p>
<pre><code>{
&... | 1,408 | |
implement RAG | ConversationalRetrievalChain raising KeyError | https://stackoverflow.com/questions/78199269/conversationalretrievalchain-raising-keyerror | <p>I am implementing RAG on a Gemma-2B-it model using langchain's HuggingFaceEmbeddings and ConversationalRetrievalChain.</p>
<p>When running:</p>
<pre><code>chat_history = []
question = "My prompt"
result = qa.invoke({"question": question, "chat_history": chat_history})
</code></pre>
<p>... | <p>If you're using <code>transformers.pipeline</code>, then make sure that this <code>return_tensors='pt'</code> parameter is not passed.</p>
| 1,409 |
implement RAG | Retrieval augmented generation (RAG) for text classification | https://stackoverflow.com/questions/77190366/retrieval-augmented-generation-rag-for-text-classification | <p>I'm currently exploring the implementation of Retrieval-Augmented Generation (RAG) for text classification, but I'm facing a lack of comprehensive online resources to guide me through the process.</p>
<p>In this project, the task involves taking a sentence as input and categorizing it into one of three distinct clas... | <p>Don't use embeddings to contain class attributes. That will mess with retrieval quality.</p>
<p>Use metadata filters instead.</p>
<ol>
<li><p><strong>Retrieve</strong>
Include classes in the metadata before feeding it to the rag. Then when you do a a retrieval, use the metadata filter to make a retrieval call for ea... | 1,410 |
implement RAG | c# Microsoft Semantic Kernel - RAG using local files | https://stackoverflow.com/questions/78825096/c-microsoft-semantic-kernel-rag-using-local-files | <p>I am new to Semantic Kernel and would like to build an application using RAG (local file implementation). I know this is possible in OpenAI using "KernelMemoryBuilder" and "WithOpenAIDefaults" method. Any help is appreciated.</p>
<p>Thanks,</p>
<p>I have tried below implementations but they use O... | 1,411 | |
implement RAG | RAG model not reading json files | https://stackoverflow.com/questions/77511555/rag-model-not-reading-json-files | <p>I'm trying to implement a simple rag that reads a list of input files and answers to questions based on their content:</p>
<pre><code>documents = SimpleDirectoryReader("/content/Data/").load_data()
llm = LlamaCPP(
model_url='https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mis... | <p>It looks like you're using llama_index library, with a simple search on the used method <a href="https://github.com/run-llama/llama_index/blob/main/docs/module_guides/loading/simpledirectoryreader.md" rel="nofollow noreferrer">SimpleDirectoryReader</a> you will find the supported files extensions.</p>
<pre><code>.cs... | 1,412 |
implement RAG | Issue with Hallucinated Outputs in RAG System Using LangChain and Chroma Vectorstore | https://stackoverflow.com/questions/79201785/issue-with-hallucinated-outputs-in-rag-system-using-langchain-and-chroma-vectors | <p>I am working on a Retrieval-Augmented Generation (RAG) system where I input a simple PDF file and expect structured outputs such as the title, summary, publication year, and authors of the research paper. While testing the system, I encountered an issue:</p>
<p>First run: The output was correct and as expected.</p>
... | 1,413 | |
implement RAG | Unable to create a vectorstore retriever using Chroma | https://stackoverflow.com/questions/78793204/unable-to-create-a-vectorstore-retriever-using-chroma | <p>I am trying to implement RAG with the GPT-3.5 API. However, my code execution gets stuck while trying to create the retriever. I didn't get this issue on Google Colab but I started getting this issue once I shifted my codebase to my local environment.</p>
<p>Here is the function:</p>
<pre><code>def create_retriever(... | 1,414 | |
implement RAG | Handling greet type of questions without llm in RAG | https://stackoverflow.com/questions/78843382/handling-greet-type-of-questions-without-llm-in-rag | <p>I'm implementing a Retrieval-Augmented Generation (RAG) system for a chatbot that handles a variety of user queries. While RAG is primarily designed to provide informative responses by retrieving relevant documents and generating responses using a language model (LLM), I want to handle certain types of queries, like... | 1,415 | |
implement RAG | How to use LLaVa embedding function? Multi-Modal Rag | https://stackoverflow.com/questions/78333716/how-to-use-llava-embedding-function-multi-modal-rag | <p>I'm currently implementing a multi-modal RAG sys leveraging, LLaVa, Chroma & Langchain.</p>
<p>However, I'm having a hard time finding the embeddings function llava uses. Can anybody help me with that? Am I just blind?</p>
<p>Any pointers on how to narrow that down would be much appreciated.</p>
<p>Thanks in adv... | 1,416 | |
implement RAG | Python Langchain RAG example code. Unsupported operand types for |: 'method' and 'operator.itemgetter' | https://stackoverflow.com/questions/77303068/python-langchain-rag-example-code-unsupported-operand-types-for-method-and | <p>I am trying to implement the code for Python RAG with chat history from:</p>
<p><a href="https://python.langchain.com/docs/expression_language/cookbook/retrieval#with-memory-and-returning-source-documents" rel="nofollow noreferrer">https://python.langchain.com/docs/expression_language/cookbook/retrieval#with-memory-... | <p>it looks like the <a href="https://python.langchain.com/docs/expression_language/cookbook/retrieval#with-memory-and-returning-source-documents" rel="nofollow noreferrer">documentation for this issue has been updated</a>. For any future users who run into the same problem, it is necessary to wrap the <code>memory.loa... | 1,417 |
implement RAG | Handling Multiple Embedding Types in LangChain for RAG Applications | https://stackoverflow.com/questions/78771100/handling-multiple-embedding-types-in-langchain-for-rag-applications | <p>I'm building a RAG application using LangChain. It works well with one type of embedding in my database, generating specific code based on context. Now, I want to add support for Q&A. I've implemented Q&A by creating embeddings for various common questions, but sometimes my code generation fails because the ... | 1,418 | |
implement RAG | RAG pipeline help request | https://stackoverflow.com/questions/78662555/rag-pipeline-help-request | <p>I'm a bit new to the whole RAG pipeline thing and find myself being a bit lost in the endless possibilities of building one. My goal is to create a script that can transform about 60 anatomical pdfs into a vector store database and use this to answer questions about body parts and return the references to the pages ... | 1,419 | |
implement RAG | Can I use FLARE RAG as a substitute for another open source LLM that is not based on OpenAI? | https://stackoverflow.com/questions/78615556/can-i-use-flare-rag-as-a-substitute-for-another-open-source-llm-that-is-not-base | <p>We are preparing a capstone design for our graduation project, and in that project, we want to implement a RAG chatbot using Langchain, where we want to implement FLARE as an open-source LLM model, but we are having difficulties because the flare library in Langchain is based on OpenAI.</p>
<p>So we are trying to mo... | 1,420 | |
implement RAG | How to use DSPy with a custom database (JSON/JSONL) as a retriever for RAG? | https://stackoverflow.com/questions/79440428/how-to-use-dspy-with-a-custom-database-json-jsonl-as-a-retriever-for-rag | <p>I am trying to implement a retrieval-augmented generation (RAG) pipeline using DSPy and want to use my own custom database stored in JSON/JSONL files as the retrieval source.</p>
<p>I see that DSPy provides <code>ColBERTv2</code> for retrieval, but I’m unsure how to configure it to work with my local dataset. My ide... | 1,421 | |
implement RAG | Hybrid search using Azure AI Search and lang chain as a retriever | https://stackoverflow.com/questions/78576496/hybrid-search-using-azure-ai-search-and-lang-chain-as-a-retriever | <p>I am trying to implement a conversational RAG using Azure AiSearch and lang chain with conversational history. I am trying to use the</p>
<pre><code>AzureAISearchRetriever from langchain_community.retrievers
</code></pre>
<p>However, the examples in langchain documentation only points us to using default (seman... | <p>According to this <a href="https://python.langchain.com/v0.2/docs/integrations/vectorstores/azuresearch/#perform-a-hybrid-search" rel="nofollow noreferrer">documentation</a> you can do hybrid search using vector store.</p>
<p>Use below code</p>
<pre class="lang-py prettyprint-override"><code>import os
from langchai... | 1,422 |
implement RAG | Best approach for RAG using Azure OpenAI and AI Search with Python SDK | https://stackoverflow.com/questions/79239258/best-approach-for-rag-using-azure-openai-and-ai-search-with-python-sdk | <p>I struggle understanding what are the pros and cons of each one of these approaches for implementing a RAG using Azure OpenAI with AI Search as source, with Python SDK. Both work well, but option B looks much cleaner. Why should we even bother doing all the steps in option A ourselves? Am I missing something?</p>
<p... | <p>These are many approaches you can do with Azure OpenAI and AI Search, from your option A and B, it falls under:</p>
<ul>
<li><p>A, Retrieve Then Read: Simple retrieve-then-read implementation, using the AI Search and OpenAI APIs directly. It first retrieves top documents from search, then constructs a prompt with th... | 1,423 |
implement RAG | VertexAI authentication | https://stackoverflow.com/questions/78834087/vertexai-authentication | <p>I am currently referring to the codelab <a href="https://codelabs.developers.google.com/multimodal-rag-gemini#0" rel="nofollow noreferrer">Build a Q&A App with Multi-Modal RAG using Gemini Pro</a> which uses</p>
<pre><code>from google.colab import auth
auth.authenticate_user()
</code></pre>
<p>to authenticate.</... | <p>As you are already part of Google Cloud ecosystem, I believe you will be using services like <code>Cloud Run</code> to host your Application. Cloud Run will use a designated service account to run your application.</p>
<p>(Your TODO) If you provide minimum requirement permission to this service account, then it will... | 1,424 |
implement RAG | Feeding tabular data to Chromadb for RAG | https://stackoverflow.com/questions/79491162/feeding-tabular-data-to-chromadb-for-rag | <p>I am working on a RAG chatbot which takes .csv financial tables (eg. income statements/balance sheets etc.) of a company in the last 3 quarters, and answers questions based on the provided report context. Each CSV file contains a financial table for a company, with 3 rows representing 3 quarters and columns represen... | 1,425 | |
implement RAG | APIConnectionError: Connection error. in langchain vector search | https://stackoverflow.com/questions/77837392/apiconnectionerror-connection-error-in-langchain-vector-search | <p>I am trying to implement a RAG solution using Azure OpenAI and Azure AI Search.</p>
<p>This is my <code>requirements.txt</code> file:</p>
<pre><code>azure-core==1.29.6
azure-common==1.1.28
azure-identity==1.15.0
azure-keyvault-keys==4.8.0
azure-keyvault-secrets==4.7.0
azure-search-documents==11.4.0
openai==1.8.0
lan... | 1,426 | |
implement RAG | How to sync/update Vector DB Vertex AI Search (used as RAG) in a agent? | https://stackoverflow.com/questions/79481102/how-to-sync-update-vector-db-vertex-ai-search-used-as-rag-in-a-agent | <p>Using Firestore Genkit (Node.js) and GCP Vortex AI, Vortex AI Search, and GCP Cloud storage I am writing a agent that will process some files of code. The files get uploaded to cloud storage since they are unstructured data.</p>
<p>I want to use Vortex AI search as RAG for the agent I am building. I have the datasto... | 1,427 | |
implement RAG | RAG | chromadb is retrieving the old vectors after first attemp not on new document | https://stackoverflow.com/questions/78825666/rag-chromadb-is-retrieving-the-old-vectors-after-first-attemp-not-on-new-docum | <p>Actually i am building rag chatbot with gradio where the issue is that on first pdf file it give the actual response to that pdf file what the question is asked but if i upload new pdf and ask any question the pdf is loading correctly and its embeddings are also being created correctly but when it goes to chromadb a... | <p>The issue is sort out actually it was chromadb that was messing up , I used FAISS and the problem resolved.</p>
| 1,428 |
implement RAG | BM25Retriever + ChromaDB Hybrid Search Optimization using LangChain | https://stackoverflow.com/questions/79477745/bm25retriever-chromadb-hybrid-search-optimization-using-langchain | <p>For those who have integrated the ChromaDB client with the Langchain framework, I am proposing the following approach to implement the Hybrid search (Vector Search + BM25Retriever):</p>
<pre><code>from langchain_chroma import Chroma
import chromadb
from chromadb.config import Settings
from langchain_openai import Op... | 1,429 | |
implement RAG | want to generate memory based rag with vector stores for storing documents | https://stackoverflow.com/questions/78387076/want-to-generate-memory-based-rag-with-vector-stores-for-storing-documents | <p>I'm working on building a memory-based chat system that utilizes vector retrieval for multiple users across multiple sessions. I'm using LangChain, OpenAI, and ChromaDB in Python.</p>
<p>My current implementation involves integrating LangChain's VectorDBQA with OpenAI for language processing and ChromaDB for vector ... | 1,430 | |
implement RAG | Spring AI with MongoDB Vector Store - How to Retrieve Source URL for RAG | https://stackoverflow.com/questions/79525963/spring-ai-with-mongodb-vector-store-how-to-retrieve-source-url-for-rag | <p>I am working on creating a RAG application using Spring AI and MongoDB for the vector store.</p>
<p>My current entry point/controller is as follows (based heavily on Spring AI's own docs):</p>
<pre><code>
@RestController
public class ChatController {
private final OllamaChatModel chatModel;
private final Vector... | 1,431 | |
implement RAG | Neo4j GraphRAG Document Insertion but nothing is coming in my Neo4j Workspace | https://stackoverflow.com/questions/79079178/neo4j-graphrag-document-insertion-but-nothing-is-coming-in-my-neo4j-workspace | <pre><code>
import logging
from neo4j import GraphDatabase
from neo4j_graphrag.indexes import upsert_vector
import openai
from PyPDF2 import PdfReader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from dotenv import load_dotenv
load_dotenv()
# Set up logging to both file and console
logging.basic... | 1,432 | |
implement RAG | Getting Error while doing integration for AgenticRAG and Crew-Ai for llms | https://stackoverflow.com/questions/79007732/getting-error-while-doing-integration-for-agenticrag-and-crew-ai-for-llms | <p>While using Agentic RAG with Crew-Ai and using their own integrated tools such as pdfTool or TXTSearchTool, I am getting the following error: "</p>
<pre><code>ImportError: cannot import name 'PydanticDeprecationWarning' from 'pydantic' (C:\Users\Administrator\Desktop\AgentRAGsearch\venv\lib\site-packages\pydant... | 1,433 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.