Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ corpus = rag_tokenizer(doc_chunks, return_tensors="pt", padding=True, truncation
|
|
| 27 |
n_docs = rag_model.config.n_docs
|
| 28 |
corpus_length = corpus.size(-1)
|
| 29 |
pad_length = ceil(corpus_length / n_docs) * n_docs - corpus_length
|
| 30 |
-
corpus = torch.nn.functional.pad(corpus, (0, pad_length), mode='constant', value=
|
| 31 |
|
| 32 |
"""
|
| 33 |
For more information on huggingface_hub Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 27 |
n_docs = rag_model.config.n_docs
|
| 28 |
corpus_length = corpus.size(-1)
|
| 29 |
pad_length = ceil(corpus_length / n_docs) * n_docs - corpus_length
|
| 30 |
+
corpus = torch.nn.functional.pad(corpus, (0, pad_length), mode='constant', value=rag_model.config.pad_token_id)
|
| 31 |
|
| 32 |
"""
|
| 33 |
For more information on huggingface_hub Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|