I am receiving the following error when trying to load a model that was downloaded from github and am getting the following error
SavedModel file does not exist at: modelname/{saved_model.pbtxt|saved_model.pb}.
I used tf.keras.models.load_model but I believe that is used if the model was already saved. Are there methods to load in an external model that was not previously saved?
As the error says it is not able to find the model to load it, you can try changing the model name if you are saving it again, If you are using make sure you follow the proper folder structure and methods as mentioned in this document.
You need to provide a complete path(including file name) of your model to the function.
my_model = keras.models.load_model("path/to/my_h5_model.h5")
this fuction supports both string and python Path object.
Related
I created a model for image classification following the ML.NET tutorial for machine learning and works perfectly. Now I would like to load images from different folders and create a model from there.
Dim preprocessingPipeline = mlContext.Transforms.Conversion.MapValueToKey(inputColumnName:="Label", outputColumnName:="LabelAsKey") _
.Append(mlContext.Transforms.LoadRawImageBytes(outputColumnName:="Image", Pathfolder, inputColumnName:="ImagePath"))
If I add a second append with a different folder path following the first append, the program just crashes and gives no error, and the code does not continue. I have been looking for tutorial or any other function inside ml.Context.Transforms but I found nothing. Any idea?
In Data Integration module, I have created a mapping to load data from Csv file to Oracle table. I want to give a file pattern as the file name will have date in it. When I try to provide file pattern in the Source object, it is throwing the below error.
If someone can assist on letting me know how to load file with a file pattern, it will be very helpful.
Please let me know if you need any further details.
Try using a File Listener as the source for this mapping. In File Listener settings you can provide the pattern - and in turn, File Listener will trigger the mapping with the file found.
I want to perform a text generation task in a flask app and host it on a web server however when downloading the GPT models the elastic beanstalk managed EC2 instance crashes because the download takes too much time and memory
from transformers.tokenization_openai import OpenAIGPTTokenizer
from transformers.modeling_tf_openai import TFOpenAIGPTLMHeadModel
model = TFOpenAIGPTLMHeadModel.from_pretrained("openai-gpt")
tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
These are the lines in question causing the issue. GPT is approx 445 MB. I am using the transformers library. Instead of downloading the model at this line I was wondering if I could pickle the model and then bundle it as part of the repository. Is that possible with this library? Otherwise how can I preload this model to avoid the issues I am having?
Approach 1:
Search for the model here: https://huggingface.co/models
Download the model from this link:
pytorch-model: https://s3.amazonaws.com/models.huggingface.co/bert/openai-gpt-pytorch_model.bin
tensorflow-model: https://s3.amazonaws.com/models.huggingface.co/bert/openai-gpt-tf_model.h5
The config file: https://s3.amazonaws.com/models.huggingface.co/bert/openai-gpt-config.json
Source: https://huggingface.co/transformers/_modules/transformers/configuration_openai.html#OpenAIGPTConfig
You can manually download the model (in your case TensorFlow model .h5 and the config.json file), put it in a folder (let's say model) in the repository. (you can try compressing the model, and then decompressing once it's in the ec2 instance if needed)
Then, you can directly load the model in your web server from the path instead of downloading (model folder which contains the .h5 and config.json):
model = TFOpenAIGPTLMHeadModel.from_pretrained("model")
# model folder contains .h5 and config.json
tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
# this is a light download
Approach 2:
Instead of using links to download, you can download the model in your local machine using the conventional method.
from transformers.tokenization_openai import OpenAIGPTTokenizer
from transformers.modeling_tf_openai import TFOpenAIGPTLMHeadModel
model = TFOpenAIGPTLMHeadModel.from_pretrained("openai-gpt")
tokenizer = OpenAIGPTTokenizer.from_pretrained("openai-gpt")
This downloads the model. Now you can save the weights in a folder using save_pretrained function.
model.save_pretrained('/content/') # saving inside content folder
Now, the content folder should contain a .h5 file and a config.json.
Just upload them to the repository and load from that.
Open https://huggingface.co/models and search the model you want. Click on the model name and finnaly click on "List all files in model". You will get a list of the files you can download.
i was tring to create a workflow with geocortex workflow designer that upload a file in folder.
So to do that, i create a Form that make a file picker and it returns a IList of FileItem.
than i would take the base64 data and write a file, but it show me an error:
Geocortex.Forms.Client.FileItem.Friend Property FileDataBase64 As
String is not accessible in this context beacause it is 'Friend'
the scope of my variable its Flowchart and i can't understand why this error
this error is showned even if i try to access te variable inside the form activity even outside.
thank's every one
It is probably a security related issue.
Make sure that your target directory is writeable by Geocortex workflow. Do a very basic test.
Again do every steps of the process in isolation, in order to pin-point the source of the problem. Poliart.com
I'm using carrier wave to upload images in rails3,
i want to just check the condition is image available in upload folder or not.
Because in my case suppose image name available in data base but by mistake image deleted from upload folder in that scenario when click on image link getting error .
I think, this can be done using exist?(file_name) method of Ruby File Class. I assume you can get the full path of the file from the database, and pass it to the class method as follows:
File.exist?('full/path/of/the/file')
This will return true if the file exists otherwise false. for reference you can read about File operations here
Carrierwave has a built-in method to do just that. It works whether your storage method is :file or :fog. Looks like this:
picture.data.file.exists?