Code Monkey home page Code Monkey logo

arkham's Introduction

Instalation

In order to install and use this library to it's full capacity, you must follow these steps:

  1. Install poppler with sudo apt-get install poppler-utils or brew install poppler on mac.

  2. Install tesseract with sudo apt-get install tesseract-ocr-spa or brew install tesseract on mac.

  3. Install the library with the command:

pip install git+https://github.com/IsaidMosqueda/arkham.git

Usage

Finetuning

If you want to run the model fine tunning, SFTTrainer library has a pending bug, where the tokenizer won't consider the max_lenght when creating the vector space when running the tokenizer function, to change that go to the file env/lib/python3.10/site-packages/trl/trainer/utils.py and replace the line 272 from:

tokenized_inputs = self.tokenizer(buffer, truncation=False)["input_ids"]

to:

tokenized_inputs = self.tokenizer(buffer, truncation=True,max_length=self.seq_length)["input_ids"]

Demo

If you want to get a hand at the user experience, take a look at the demo.ipynb, there you'll learn to use and manipulate the OCR functionalities as well as use the chatbot on any file you want, with a set of models to be used.

Research

In the research folder you may find all the steps that lead to the definition of the modules, feel free to check them. Certain files are to big to be added, if any file is required please feel free to get it from here. In particular, you have to download the folder checkpoint-240 and store it on the directory you may be calling it, and the file CONTRATO...pdf to re run the OCR implementations, saving it as well on the directory from where you may be calling it.

Notes

If it's the first time that you run the ´falcon´model, it's necessary that you firstly install the falcon7b-Instruct model manually, to do that run the following code after installing the library:

from transformers import AutoModelForCausalLM,AutoTokenizer

model_id="tiiuae/falcon-7b-instruct"
tokenizer=AutoTokenizer.from_pretrained(model_id)
model=AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)

If you want to use the GPT3.5 model, make sure to have your OpenAI key loaded in your enviroment with the following name:

OPENAI_API_KEY = 'your key'

arkham's People

Contributors

isaidmosqueda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.