Skip to content

New modules: Llamacpp-python/run and huggingface/download for allowing to run simple text workloads with local LLMs #11053

Open
toniher wants to merge 22 commits intonf-core:masterfrom
biocorecrg:llamacpp
Open

New modules: Llamacpp-python/run and huggingface/download for allowing to run simple text workloads with local LLMs #11053
toniher wants to merge 22 commits intonf-core:masterfrom
biocorecrg:llamacpp

Conversation

@toniher
Copy link
Copy Markdown
Member

@toniher toniher commented Mar 26, 2026

This pull request, contributed jointly with @lucacozzuto , provides a simple workload for running text inference tasks using llamacpp-python against local LLMs.
This effort was worked on during the nf-core Hackathon in March 2026.

PR checklist

Closes #XXX

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR.
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity
      • nf-core modules test <MODULE> --profile conda
    • For subworkflows:
      • nf-core subworkflows test <SUBWORKFLOW> --profile docker
      • nf-core subworkflows test <SUBWORKFLOW> --profile singularity
      • nf-core subworkflows test <SUBWORKFLOW> --profile conda

@toniher toniher added the new module Adding a new module label Mar 26, 2026
@toniher toniher requested a review from JoseEspinosa March 26, 2026 14:08
@toniher toniher moved this to Ready for review in Hackathon March 2026 Mar 26, 2026
Copy link
Copy Markdown
Contributor

@famosab famosab left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution to nf-core! We really appreciate it. I added a few comments to your PR.

We usually recommend to have one module per PR. That makes the review process easier and its more likely that someone will review your PR. You can keep that in mind for the next PRs.

Comment on lines +30 to +34
{ assert process.out.output.size() == 1 },
{ assert process.out.output[0][0] == [ id:'test_model' ] },
{ assert file(process.out.output[0][1]).name == "gemma-3-1b-it-Q4_K_M.gguf" },
{ assert file(process.out.output[0][1]).size() > 0 },
{ assert snapshot(process.out.findAll { key, val -> key.startsWith('versions') }).match() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add other files to this snapshot as well? Ideally we want all outputs to be at least present by name in the snapshot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added new model here: 421603e

@@ -0,0 +1,7 @@
nextflow.enable.moduleBinaries = true

process {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We want the ext.args to be present in the main.nf.test file. That makes everything more readable in one go. See the docs for more info.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moved here: 421603e

task.ext.when == null || task.ext.when

script:
def hf_home_resolved = hf_home ?: "${workflow.projectDir}/hf_cache"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont think the module should write to a hard coded path in the projectDir

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is a cache directory needed for hf to work. It is a bit annoying when using Docker (sic). The user can choose another location. What would you suggest instead? Maybe ${workDir}, kind of similarly as singularity images? Any other approach?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I must admit that is a bit of my bias that I normally like to place singularity images in projectDir instead of workDir 😛

- ai
tools:
- huggingface_hub:
description: "HuggingFace Hub CLI interface"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be described a bit better?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried to provide more details here: 6dfff97

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

both files in this folder should be added to test-datasets and not to the modules repo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

They are somehow dummy files (specially the model for the stub, since it was an empty file). Now I generated them on the fly, unless you think it may be worth to have a prompt JSON on test-datasets.

@toniher
Copy link
Copy Markdown
Member Author

toniher commented Apr 4, 2026

Thank you for your contribution to nf-core! We really appreciate it. I added a few comments to your PR.

We usually recommend to have one module per PR. That makes the review process easier and its more likely that someone will review your PR. You can keep that in mind for the next PRs.

Hi @famosab . Thanks for the feedback and I will go through your comments! I was told about the module submission, but since you need the output of one of the processes for the other, I thought it would help potential users once it could become eventually accepted. But, certainly, is more work for everyone. Sorry about this and I will avoid it in future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants