Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
02c5409
api code to download model from hugging face
aditya0by0 Jun 24, 2025
c13423c
Merge branch 'dev' into feature/api_downloadble_models
aditya0by0 Jun 27, 2025
b539f0a
Create .pre-commit-config.yaml
aditya0by0 Jun 27, 2025
2c2aba2
utility to setup env and model package dependencies
aditya0by0 Jun 27, 2025
2b9f335
`gather_predictions` will return predicted_classes_dict
aditya0by0 Jun 27, 2025
6faf3bd
use package namespace imports for prediction models
aditya0by0 Jun 28, 2025
a4f5f85
add hugging face api
aditya0by0 Jun 28, 2025
481a2eb
api registry
aditya0by0 Jun 28, 2025
584b6a6
api cli
aditya0by0 Jun 28, 2025
05d8580
Update .gitignore
aditya0by0 Jun 28, 2025
997120e
use hugging face's cache system instead of custom file management
aditya0by0 Jun 28, 2025
9c3beea
pre-commit -run -a
aditya0by0 Jun 28, 2025
e6602ef
remove explicit config kwargs for resgated
aditya0by0 Jul 1, 2025
fd814e9
api support for ensemble
aditya0by0 Jul 6, 2025
a044f23
add ruff action workflow
aditya0by0 Jul 6, 2025
51a2d34
same version for workflow and pre-commit yaml
aditya0by0 Jul 6, 2025
d2c586a
Update base_predictor.py
aditya0by0 Jul 6, 2025
e0b3ca7
merge from dev
aditya0by0 Jul 9, 2025
ebc450f
Merge branch 'refs/heads/dev' into feature/api_downloadble_models
sfluegel05 Jul 11, 2025
f3b3905
fix readme
sfluegel05 Jul 11, 2025
001538d
fix cli and ensemble imports
sfluegel05 Jul 11, 2025
f8583cb
add huggingface download to cli
sfluegel05 Jul 11, 2025
90aedd4
reformat with black
sfluegel05 Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # or any version your project uses

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==25.1.0 ruff==0.12.2

- name: Run Black
run: black --check .

- name: Run Ruff (no formatting)
run: ruff check . --no-fix
179 changes: 179 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# configs/ # commented as new configs can be added as a part of a feature

/.idea
/data
/logs
/results_buffer
electra_pretrained.ckpt

build
.virtual_documents
.jupyter
chebai.egg-info
lightning_logs
logs
.isort.cfg
/.vscode
/api/.cloned_repos
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/psf/black
rev: "25.1.0"
hooks:
- id: black
- id: black-jupyter # for formatting jupyter-notebook

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile=black"]

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff
args: [--fix]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cd python-chebifier
pip install -e .
```

Some dependencies of `chebai-graph` cannot be installed automatically. If you want to use Graph Neural Networks, follow
u`chebai-graph` and its dependencies cannot be installed automatically. If you want to use Graph Neural Networks, follow
the instructions in the [chebai-graph repository](https://github.com/ChEB-AI/python-chebai-graph).

## Usage
Expand Down
Empty file added api/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions api/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .cli import cli

if __name__ == "__main__":
"""
Entry point for the CLI application.

This script calls the `cli` function from the `api.cli` module
when executed as the main program.
"""
cli()
24 changes: 24 additions & 0 deletions api/api_registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
electra:
hugging_face:
repo_id: aditya0by0/python-chebifier
subfolder: electra
files:
ckpt: electra.ckpt
labels: classes.txt
package_name: chebai

resgated:
hugging_face:
repo_id: aditya0by0/python-chebifier
subfolder: resgated
files:
ckpt: resgated.ckpt
labels: classes.txt
package_name: chebai-graph

Comment on lines +1 to +18
Copy link
Member Author

@aditya0by0 aditya0by0 Jul 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to upload the models to chebai hugging face repo and update here

chemlog:
package_name: chemlog


en_mv:
ensemble_of: {electra, chemlog}
30 changes: 30 additions & 0 deletions api/check_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import subprocess
import sys


def get_current_environment() -> str:
"""
Return the path of the Python executable for the current environment.
"""
return sys.executable


def check_package_installed(package_name: str) -> None:
"""
Check if the given package is installed in the current Python environment.
"""
python_exec = get_current_environment()
try:
subprocess.check_output(
[python_exec, "-m", "pip", "show", package_name], stderr=subprocess.DEVNULL
)
print(f"✅ Package '{package_name}' is already installed.")
except subprocess.CalledProcessError:
raise (
f"❌ Please install '{package_name}' into your environment: {python_exec}"
)


if __name__ == "__main__":
print(f"🔍 Using Python executable: {get_current_environment()}")
check_package_installed("numpy") # Replace with your desired package
Loading