Running Ptr-Net on MXNet - machine-learning

We have a Ptr-Net model that we want to run. Can the MXNet be useful for this scenario. If not, what are the other libraries that we can use to run Ptr-Net models?
We are building a Ptr-Net model using TensorFlow as of now.

Currently we don't have a complete model for Ptr-Net, but you can define symbolic model for Ptr-Net. Here is a complete example for creating char-level lstm model: http://mxnet.io/tutorials/python/char_lstm.html

Related

How can we save darts model lets say TFT Model using mlflow

I want to save my Darts TFT MODEL using mlflow and load it using mlflow. Currently i log my model using sklearn flavor not i am unable to load it.
ERROR - (AttributeError: 'Trainer' object has no attribute '_accelerator_connector')
Currently i log my model using sklearn flavor not i am unable to load it.
When i tried to load model using mlflow.sklearn.load_model() it is giving error
ERROR - (AttributeError: 'Trainer' object has no attribute '_accelerator_connector')
Any help will be really appreciated.
Thanks

Yolov5 custom object detection model not loading

I have a trained a custom object detection model using yolov5 for 4 classes. I have downloaded the best.pt file. I am still confused about how to load this model using pytorch.
I tried running the following code to load the model as per Yolov5 official documentation
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
but when I tried printing model.names, I am not getting my custom class names. Is there anything I am missing?
Thank you!
Try clearing your cache by adding this: force_reload=True
Store your model in a local folder called model (in case you are locally
trying to run this)
then try adding this:
model = torch.hub.load('ultralytics/yolov5', 'custom', path='model/best-m.pt', force_reload=True)

text classification predefined categories with documents with Omnicat-bayes

I'm using omnicat-bayes to analyse documents (text-classification). With this gem I'm able to create categories and "feed" those with documents. Currently the categories have enough documents in order to be "good enough" to recognize new documents in what category they should be placed in.
Now in my Documents controller under the create action are a few steps.
Creating a new Bayes instance
Creating the categories that will be used
Taking the pre-documents to train the categories
Actually training the categories
(all of those steps are under the run_all function)
The create action:
def create
#document = Document.new(document_params)
#document.case_id = #case.id
if #document.save
run_all
# Running the classify function on reden aanmelding
classify_one = #bayes.classify(#document.reden_aanmelding)
document_category = classify_one.to_hash[:top_score_key]
# Updating the document category by the top key returned by Bayes
#document.update_attribute(:category, document_category)
finding_required_records
# Training Cees Buddy with the document that got saved
#bayes.train(document_category, #document.reden_aanmelding)
redirect_to case_path(#case)
else
render :new
end
end
Inside the #document.save run_all function (I know this isn't really best practice) I'm creating the four steps named above.
Now after the create function is finished the Bayes instance is gone and the AI is now "stupid" again so to speak.
My question is: what would a proper place be and how can I accomplish this to create the new instance, new categories and feed them with documents out of my database. Would a singleton be interesting here?
This is quite a tricky problem, given that you'll probably want to scale the application to deal with more than a handful of documents.
The thing is that a production-mode Rails application web-server will usually fork into multiple processes or even run on more than one machine. Which means that documents trained in one process will be unknown on all the others, even if you use a singleton pattern.
So with only the omnicat-bayes gem, the best way to go about it is to create some kind of separate micro service that runs in its own process and does nothing more than process documents. The main application should then enqueue the processing into asynchronous jobs so it is okay if things take a bit longer in case the training process is busy with other documents.
How you communicate with this external OmniCat instance is up to you. The most comfortable way might be dRuby but I should add that I have no production-mode experience with it. A more future-proof solution would be to use some simple HTTP + JSON. In that case you could even switch out the service that does training and categorisation with some more powerful library that's not based on Ruby in the future.

Rails naming conventions for models with forbidden names

I'm writing a rails application, and I need to name one of my model Test, and inside that model I need a class attribute - when I tried the first one, I couldn't run any UT since Test ceased to be a module - so I ranamed to Tst. I haven't even tried naming a column class - I went with clss. What names would you use? Are there any conventions known amongs RoR developers for such situations?
I haven't seen anything for Test but class is typically changed to klass.
Ruby and Rails have several different objects part of a standard library. You cannot use an already-defined class name as name for your models.
For instance, you cannot call a model Thread or Object because Ruby already defines a Thread and Object class.
Likewise, Ruby has a library called Test::Unit so you can't use the Test namespace as model name.
There isn't a real full list of reserve objects because it really depends on your current environment. However, in order to successfully use Rails, you should at least have a basic Ruby knowledge so that you know the names of the most common standard library classes.
I've run up against this a few times (writing educational software--where you regularly want to model 'tests' :-). Depends exactly what you're modeling I suppose, but I usually opt for 'quiz' to avoid conflicts. I'd love to hear a better solution, since I find 'quizzes' an awkward plural.
Like dj2 said, class is usually done as 'klass'.
Please check the following page for Rails reserved words: http://reservedwords.herokuapp.com/ None of these words should be used as class or attribute name.

related objects in steps with cucumber/pickle

it would be great if somebody could help me with the cucumber/pickle syntax on creating
related objects and assert them.
How can I get references in my cucumber syntax...
Something Like
For example: creating a blog post with a certain title with 3 comments
And then assert this post and the related comments...
Is this with object builder by pickle possible or do I have to write these steps manually
and how do I reference the value from master in detail?
I am looking especially for reffering Object in different steps and inserting master with its details in one batch with pickle (without defining the step manually) and then asserting it....
I should have 1 blogpost with 3 comments...
Check out the following screen-casts:
http://railscasts.com/episodes/155-beginning-with-cucumber
http://railscasts.com/episodes/159-more-on-cucumber
http://railscasts.com/episodes/186-pickle-with-cucumber
These put me well on my way to cucumber and pickle goodness
Good luck!

Resources