How do I use huggingface models offline? Also, how can I retrain those models with my own datasets for specific task? - huggingface-transformers

I want to use huggingface Model offline. Also, I want to use models for particular task trains on a specific dataset.
I expect I will retrain my model with specific datasets and also i can use it offline.

Related

How to export models trained in AutoML to saved model or frozen graph?

I have trained a model on Google Auto-ML. I wish to use it along with other custom models I have built, hence I need the models trained in AutoML in frozen graph or saved model format. Any direction would be much appreciated.
You cannot do that in Google AutoML, you can do it in your local machine and export it to AWS sage-maker kind of platforms and deploy it.

Spark ML broadcast model once

Background: I have a spark-ml trained random forest model. I am reading data from Kafka (streaming) which will pass through the model and the predictions will be saved in database.
What I want: I want to load my model once and broadcast that model only once when my applications will start and only redeploy if I want to.
My understanding: The model gets loaded and broadcasted for each micro-batches.
Question: How do I make my model load only once and not again for each micro batches so that it persists till the end.
Any pointers will be appreciated.

How to add our trained data to existing Stanford NER classifier?

I have to add my trained data to existing CRF classifier [english.all.7class.distsim.crf.ser].
Is there any API to extract the the existing models or de-serialise them ?
Thanks
Unfortunately, no: there is no way to recover the training data from the serialized model files. Nor is there a way to [easily] continue training from a serialized model. Part of this is by design: Stanford is not allowed to redistribute the data that was used to train the classifier. If you have access to the data, you can of course train with it alongside the new data, as per http://nlp.stanford.edu/software/crf-faq.shtml#a

DDD Reporting Scenarios

I'm trying to create a reporting/analysis web app that will use MVC3, EF and DDD approach. I'm havign a hard time to come up with entities or object classes for aggregated tables on existing database. For example, I have Orders and OrderLine as an aggregate and Customers as Entity. This three objects can be modeled using DDD approach but what if I want to have an OrdersAggregate Table which will contatins all the details like customer name, payment type, etc.
Should I create an object class here which contain the properties of customername, payment type, etc. or let EF create his sql query and join related tables? I'm worrying about performance here and this will be deploed on a cloud and a huge volume of transactions awaits.
Any suggestions?
You can utilize CQRS and here in some aspects to take the benefit of separating read model from write.
Dont have to implement the entire architecture, just separate the read from write model and services, this make the read model send customized DTOs flat for rading and analysis purposes, and a strong domain model on the other hand in the write model for business logic handling.
check this and this example
My experience is that DDD is not suitable for doing reporting, statistics etc.
Some experts in like Jimmy Nilsson tells you to bypass your domain with regular dataacces.
If you just think about it, there is not much domain logic in presenting the data. It just seems like an overhead in doing layers and DDD style with ORM, repositories, aggregateroots etc just for view data.
Just a personal opinion.
/Good Luck and best regards Magnus
My suggestion is to create a DTO class for this purpose, and fill using a dataset returned from a SQL command (hand-made) with your joins and relationships.
Is only a suggestion, because I used this approach to a similar problem.

UI-centric vs domain-centric data model - pros and cons

How closely does your data model map to your UI and domain model?
The data model can be quite close to the domain model if it has, for example, a Customer table, an Employee table etc.
The UI might not reflect the data model so closely though - for example, there may be multiple forms, all feeding in bits-and-pieces of Customer data along with other miscellaneous bits of data. In this case, one could you have separate tables to hold the data from each form. As required the data can then combined at a future point... Alternatively one could insert the form data directly into a Customer table, so that the data model does not correlate well to the UI.
What has proven to work better for you?
I find it cleaner to map your domain model to the real world problem you are trying to solve.
You can then create viewmodels which act as a bucket of all the data required by your view.
as stated, your UI can change frequently, but this does not usually change the particular domain problem you are tackling...
information can be found on this pattern here:
http://blogs.msdn.com/dphill/archive/2009/01/31/the-viewmodel-pattern.aspx
UI can change according to many needs, so it's generally better to keep data in a domain model, abstracted away from any one UI.
If I have a RESTful service layer, what they are exposing the domain model. In that case , the UI(any particular screen) calls a number of these services and from the domain models collected composes the screen. In this scenario although domain models bubble all the way up to UI the UI layer skims out the necessary data to build its particular screen. There are also some interesting questions on SO about on using domain model(annotated) for persistence.
My point here is the domain models can be a single source of truth. It can do the work of carrying data , encapsulating logic fairly well. I have worked on projects which had a lot of boilerplate code translating each domain model to DTO, VO , DO and what-have-yous. A lot of that looked quite unnecessary and more due to habit in most cases.

Resources