Skip to content
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

[RAG] Bumping up transformers version to 3.3.x #579

Merged
merged 5 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion farm/modeling/prediction_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np

from pathlib import Path
from transformers.modeling_bert import BertForPreTraining, BertLayerNorm, ACT2FN
from transformers.modeling_bert import BertForPreTraining, ACT2FN
from transformers.modeling_auto import AutoModelForQuestionAnswering, AutoModelForTokenClassification, AutoModelForSequenceClassification
from typing import List

Expand All @@ -18,6 +18,12 @@

logger = logging.getLogger(__name__)

try:
from apex.normalization.fused_layer_norm import FusedLayerNorm as BertLayerNorm
except (ImportError, AttributeError) as e:
logger.info("Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex .")
BertLayerNorm = torch.nn.LayerNorm
tholor marked this conversation as resolved.
Show resolved Hide resolved


class PredictionHead(nn.Module):
""" Takes word embeddings from a language model and generates logits for a given task. Can also convert logits
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sklearn
seqeval
mlflow==1.0.0
# huggingface repository
transformers==3.1.0
transformers==3.3.1
tholor marked this conversation as resolved.
Show resolved Hide resolved
# accessing dictionary elements with dot notation
dotmap==1.3.0
# for inference-rest-apis
Expand Down