Code Monkey home page Code Monkey logo

Comments (5)

svlandeg avatar svlandeg commented on May 27, 2024 1

Hi! Yes, you're right, we need to document this better.

Currently, the best explanation is over at https://github.com/explosion/spacy-llm/tree/main/usage_examples#writing-your-own-task.

Any thoughts on what would be helpful to add to this? Are there particular bits you're stuck on? Does it help looking at the built in tasks we have over at https://github.com/explosion/spacy-llm/tree/main/spacy_llm/tasks? I can imagine that the class inheritance makes it a bit difficult to follow, so maybe we should work on a fully written-out, self-contained example. The recently introduced sharding functionality also makes this slightly more complicated.

from spacy-llm.

aschimmenti avatar aschimmenti commented on May 27, 2024

I'm stuck on multiple points, I get a few sharding configuration errors and a bit of problems in configuring the prompt for few-shot tasks. I could do it with other LLM wrappers but I really enjoy the structured doc output so it can seamlessly go the llm-rel task. The task I'm interested is entity typing, i.e. given an entity, induce the class from the context
E.g. "Babylonia was an ancient Akkadian-speaking Semitic state and cultural region based in central-southern Mesopotamia (present-day Iraq)."
Output: {"entity": "Babilonia", "class":"state"}, {"entity": "Mesopotamia", "class":"region"}
or
Bājíquán is a Chinese martial art that features explosive, short-range power and is famous for its elbow strikes.
Output: {"entity": "Bājíquán ", "class":"martial art"}

from spacy-llm.

svlandeg avatar svlandeg commented on May 27, 2024

In our test suite, we have a toy task implemented called "spacy.CountWithSharding.v1", you can find it here. Maybe you can use that as a "template" for now, while we work on the docs.

With respect to your entity typing task - can't you use Named Entity Recognition for this? spacy-llm has built-in tasks for NER as well as spancat - maybe that will already fulfill your needs for this particular use-case.

from spacy-llm.

aschimmenti avatar aschimmenti commented on May 27, 2024

Hello! Thanks for your suggestion, I managed to use NER.v3 to also recognise classes by providing examples and to connect it to another spacy REL model by combining the pipelines.
I just have a question:
The template argument in the few-shot NER v3 configuration lets you add a different path for a jinja template. I created a 1:1 jinja template for the NER v3 task just by changing the text, but I always get an empty Entities array.
In the fewshot.cfg file I've wrote:

[components.llm.task] @llm_tasks = "spacy.NER.v3" labels = ["ENTITY", "CLASS"] template = "./template-ent-classification.v3.jinja"
Is something wrong there? Thank for any help, it is much appreciated.

UPDATE:
I've used this and seems to work now. Thanks!

[components.llm.task.template]
@misc = "spacy.FileReader.v1"
path = "./template-ent-classification.v3.jinja"

from spacy-llm.

svlandeg avatar svlandeg commented on May 27, 2024

Thanks for writing back, happy to hear you got this working!

from spacy-llm.

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.