Open mrseanryan opened 1 year ago
seems possible with 13B version
https://huggingface.co/codellama/CodeLlama-13b-hf#model-use
and carefully written prompt:
https://huggingface.co/blog/codellama#how-to-use-code-llama
create a DOT graph to decide a mortgage loan. if credit score is greater than 700 then check years employed. else reject.
if years employed is greater than 3 then approve. else reject.
DOT: —-
outputs:
create a DOT graph to decide a mortgage loan. if credit score is greater than 700 then check years employed. else reject.
if years employed is greater than 3 then approve. else reject.
DOT:
digraph {
rankdir=LR;
node [shape = box];
start [label="start"];
end [label="end"];
start -> a [label="credit score > 700"];
start -> b [label="credit score < 700"];
a -> c [label="years employed > 3"];
a -> d [label="years employed < 3"];
b -> e [label="reject"];
c -> f [label="approve"];
d -> g [label="reject"];
f -> end;
g -> end;
}
Describe is possible via the separate Instruct 13B model:
https://huggingface.co/spaces/codellama/codellama-13b-chat
https://huggingface.co/codellama/CodeLlama-13b-Instruct-hf#model-use
prompt:
explain this DOT graph:
prompt that gets high level on first paragraph:
what is the overall purpose of this DOT graph:
maybe can use instruct model for BOTH generation and description.
the non-instruct model can also generate labels referring to known properties and also a whitelist of prefixes:
create a DOT graph to decide a mortgage loan. if credit score is greater than 700 then check years employed. else reject.
if years employed is greater than 3 then approve. else reject.
name the DOT nodes with a prefix decision or end or other_.
In the labels, refer to the available properties: applicant.credit_score, applicant.years_employed, applicant.other
DOT:
————————
create a DOT graph to decide a mortgage loan. if credit score is greater than 700 then check years employed. else reject.
if years employed is greater than 3 then approve. else reject.
name the DOT nodes with a prefix decision or end or other_.
In the labels, refer to the available properties: applicant.credit_score, applicant.years_employed, applicant.other
DOT:
digraph {
rankdir=LR;
node [shape=box];
start [label="start"];
end_reject [label="end_reject"];
end_approve [label="end_approve"];
decision_credit_score [label="credit_score"];
decision_years_employed [label="years_employed"];
start -> decision_credit_score;
decision_credit_score -> end_reject [label="applicant.credit_score < 700"];
decision_credit_score -> decision_years_employed [label="applicant.credit_score >= 700"];
decision_years_employed -> end_approve [label="applicant.years_employed > 3"];
decision_years_employed -> end_reject [label="applicant.years_employed <= 3"];
}
To use via transformers (locally)
# (windows)
cd my-project
py -m venv env
.\env\Scripts\activate
where python
.\env\Scripts\python.exe
# when done:
deactivate
Then install special version of transformers for this model:
pip install git+https://github.com/huggingface/transformers.git@main accelerate
pip freeze > requirements.txt
Next time around, can install via:
pip install -r requirements.txt
Using the LLM:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="codellama/CodeLlama-13b-Python-hf")
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("codellama/CodeLlama-13b-Python-hf")
model = AutoModelForCausalLM.from_pretrained("codellama/CodeLlama-13b-Python-hf")
Try a quantized LLM
https://huggingface.co/TheBloke/CodeLlama-13B-GGUF
instruct version:
https://huggingface.co/blog/codellama