Code Monkey home page Code Monkey logo

Comments (2)

tomolopolis avatar tomolopolis commented on June 2, 2024 1

@jenniferajiang - I second this as well. A cogstack-nifi 'slim' version was suggested in our prev call for the SLaM folks also. Ticket created on our dev board. CU-8692wktvq

from medcat.

adam-sutton-1992 avatar adam-sutton-1992 commented on June 2, 2024

@jenniferajiang - Due to how PyPI & pip are configured, along with how pytorch is deployed we cannot have a cpu only wheel of MedCAT.

PyPI is set up so it only downloads wheels from "https://pypi.org/simple", unless changed explicitly from the user (such as --index-url like you've done here). This is for security purposes so you can always be sure that the wheel is coming from a trusted source, or the user consciously changed the source yourself.

Pytorch also do not offer CPU-only wheels on PyPI, they're available at https://download.pytorch.org/whl/cpu. In setup.py you're very limited in changing the source of the wheel you want. You provide a specific wheel via:

setup
(
...
install_requires = ["torch@https://download.pytorch.org/whl/cpu/
torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"]
...
)

which isn't ideal as there are multiple versions depending on versions, python, os, architecture, etc...

I've looked at multiple work arounds for this, and all of them offering this functionality have been purposely closed off (requirements.txt, setup.cfg, pyproject.toml). I think it's better for us to accept the constraints rather than find another work around which would likely be removed.

My first suggestion is we document how to install a CPU only version - using the options provided to us by pip:

pip install medcat --extra-index-url https://download.pytorch.org/whl/cpu/

this will install the most relevant up to date version of pytorch for the cpu given our constraints provided in setup.py (currently torch>=1.13.0). This solution seems the most common among people I've seen trying to do the same as us here.

The second suggestion would be a wrapper bash script that would install MedCAT along with whatever extra parameters are required. This could be called when starting up a docker so the preferred version is installed saving network / disk usage.

I've added the extra documentation to the README.md and added a bash wrapper setup.sh for the pip install command (https://github.com/CogStack/MedCAT/tree/cpu-only).

Added conversations regarding PyPI and Pytorch:

Pytorch - pytorch/pytorch#26340
PyPI - https://discuss.python.org/t/specifying-extra-index-url-in-setup-cfg-option-dependencies/19377

from medcat.

Related Issues (20)

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.