Comments (5)
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.
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.
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.
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.
Thanks for writing back, happy to hear you got this working!
from spacy-llm.
Related Issues (20)
- Bug: Custom Endpoint Validation Breaks Feature Support HOT 1
- Working dummy example for custom LLM endpoint integration HOT 1
- How to surpass BERT through large models HOT 1
- Many returns are not what I want HOT 1
- out put with llm in a string?
- Entity extraction and mapping
- Connection time out with OpenAI API HOT 3
- Can't use Gpt4 models
- ValueError: max() arg is an empty sequence
- Potential REL sharding issue HOT 3
- How to write the correct config file for GPT4All? HOT 1
- How to load a model that's not supported by spacy RestAPI nor HF? HOT 1
- I have downloaded the llama2 model to local path, but program always try downloaded the llama2 from huggingface
- A tutorial to integrate other open-source LLMs on HF HOT 1
- GPT4ALL basically all the small models reply mess up the parser HOT 1
- GPT4 context_length is not working
- Few-Shot Relationship Extraction Example Error
- `transformers` > 4.38 causes bug in inference for HF models
- Inconsistent entity parsing using GPT-3.5 Turbo 16k
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacy-llm.