Posts

Showing posts with the label Python

How to run HugginFace models in Python

  Hugging Face Hugging face is a machine learning community where you can share pre trained models and explore other trained models, which are suited for many use cases. Many of the models already trained well and ready to use. Without delay get started! Python setup Open your Jupiter notebook or for easy startup without python installation on local machine, use Colab . In this example we are using mistralai/Mistral-7B-v0.1 model. Let's install the transformers module which is the primary dependency for HuggingFace.   conda install transformers Following script will work like a charm . # mistrel model test from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "mistralai/Mistral-7B-v0.1" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) text = "Hello my name is" inputs = tokenizer(text, return_tensors="pt") outputs = model.generate(**inputs, max_new_tokens=20) print(tokenizer.d...

Using Image url in Keras image classification

Image
  How to load an image in Keras for machine learning from a url ?

Get predicted class name in Keras Sequential Model

 In Keras Sequential Model problems we can get predicted result as output. As a beginner you may note that it is not what you expected. So how do we get the actual label for that image.?

Build a Flask-Python web App

Image
Building a dynamic website made so easy with Python -Flask, a Micro FrameWork which helps us to create the websites like Twitter and even more. Forget about the complicated web programming languages, start learning Python. So where you start, Python or Flask ?. I should say, you have to learn basics of how Python first, just have a look at Python.org