I am training a YOLO model and it is working fine during training, but when I try to test it, I get the following error: AttributeError: 'GELU' object has no attribute 'approximate'. The model is using the GELU activation function and I am not sure why this error is occurring. Can anyone help me troubleshoot this issue and fix the model?
The error is associated with this line: self.act = nn.GELU().
OS: Ubuntu 22
ENV: pytorch 1.12
Python: 3.10
I am trying to fit a deep learning model for segmentation task (tensorflow), but i am continuously facing this error.
I'm building a Named Entity Recognition (NER) model using the Hugging Face implementation of emilyalsentzer/Bio_ClinicalBERT. Up to today, I've had no issues with the model. I'm hopeful that someone can help me understand why it's currently not working as expected.
Question 1 - today, trying to train using:
MODEL_NAME = 'emilyalsentzer/Bio_ClinicalBERT'
model = text.sequence_tagger('bilstm-bert', preproc, bert_model=MODEL_NAME)
results in this error:
404 Client Error: Not Found for url: https://huggingface.co/emilyalsentzer/Bio_ClinicalBERT/resolve/main/tf_model.h5
Does Hugging Face offer any kind of health check to ascertain the status of their models?
Question 2 - working with files (model.h5, model.json, and preproc.sav) I'd saved from earlier training iterations, I'm getting the same 404 error shown above. I don't understand wherein these files the call to Hugging Face is occurring. It doesn't seem to be in the .json, and the .h5 and .sav file formats are hard to inspect. Read more about what these files are:
https://medium.com/analytics-vidhya/how-to-deploy-your-neural-network-model-using-ktrain-ae255b134c77
Back in February, I'd used these exact model.h5, model.json, and preproc.sav files to run the NER app using Streamlit, no problem. Not sure if this is temporary issue with Bio_ClinicalBERT or if I need to retool my original approach due to potentially permanent problems with this transformer model.
Judging from the URL you provided for Question 1, I understand that you are trying to load pre-trained weights for a TensorFlow model (tf_model.h5)
However, the pre-trained model you are trying to load is only available in a PyTorch version. Go on the link and look at the tags at the top of the page. This model only has a PyTorch tag, not a Tensorflow tag.
It's my understanding that in this case you should load pre-trained weights from the PyTorch checkpoint. To that end, you would add this parameter to the function that does the loading:
from_pt=True
As mentioned in this post in the ktrain repo, you should be able to safely ignore the error.
The 404 error simply means that transformers was not able to find a Tensorflow version of this particular model (which is being requested by ktrain). If you go to the Hugging Face model hub, you'll see that the model you're using was only uploaded as a PyTorch model.
In cases like this, the PyTorch version of the model checkpoint will be automatically downloaded by ktrain and then loaded as a Tensorflow model for training/fine-tuning. If you type model.summary(), it should show that the model was loaded successfully.
The reason you didn't see the error before is because newer versions of Hugging Face transformers show the 404 error, I think.
I am trying to load a pre-trained ResNet model from the MadryLab CIFAR-10 challenge into CleverHans to compute transfer attacks.
However restoring the saved models into the model_zoo.madry_lab_challenges.cifar10_model.ResNet object does not work. It appears to restore fine initially, but when I try to actually use the model, I get an error such as:
Attempting to use uninitialized value
ResNet/unit_3_1/residual_only_activation/BatchNorm/moving_mean
The easiest way to reproduce this error is to actually just run the provided attack_model.py example included in CleverHans here:
https://github.com/tensorflow/cleverhans/blob/master/examples/madry_lab_challenges/cifar10/attack_model.py
It encounters the same error after loading the model when it tries to use it, on both adv_trained and naturally_trained models.
Is there a workaround to this problem?
It seems the other option is to use the cleverhans.model.CallableModelWrapper instead, but I haven't been able to find an example of how to use that.
I am using tensorflow's object detection API. I successfully trained with 'ssd_mobilenet_v1_coco_2017_11_17' model, later I moved to another model from the given models but while training process starts it showing the error:
"TypeError: Expected int32, got range <0,3> of type 'range' instead".
This error was thrown for all other models other than the ssd_mobilenet_v1_coco_2017_11_17.
I used 300*300 size images for training for all the models.
Here I attached images of the command prompt window showing the error message.I use tensorflow version is 1.5 and python 3.6.
Please modify
line 154 : tf.constant(range(num_boundaries), dtype=tf.int32),
to tf.constant(list(range(num_boundaries)), dtype=tf.int32)
For further reference :
https://github.com/tensorflow/models/issues/3443