| --- |
| license: apache-2.0 |
| --- |
| Fine-tuned version of IBM Granite 3.3 2b base |
|
|
| Accepts a research project title and summary and creates a largely extractive breakdown (with some minor tweaks for coherence) into: |
| * context and background |
| * problem and aim |
| * approach and methodology |
| * outcomes and impact |
|
|
| with seperate keywords for each of these breakdowns. |
|
|
| Additionally includes lists of: |
| * application areas - where the research is indicated as applying to |
| * expected beneficiaries - where indicated within the document |
|
|
| Usage: |
| ```python |
| from transformers import AutoTokenizer, AutoModelForCausalLM |
| import torch |
| import json |
| |
| input_title: str = "your project title here" |
| input_summary: str = "your summary here" |
| model_name: str = "Lux-In-Tenebris/research_summary_deconstructor" |
| |
| device = "cuda" if torch.cuda.is_available() else "cpu" |
| model = AutoModelForCausalLM.from_pretrained(model_name, dtype=torch.bfloat16).to(device) |
| tokenizer = AutoTokenizer.from_pretrained(model_name) |
| model.eval() |
| |
| input_text = json.dumps({"title": input_title, "summary": input_summary}, ensure_ascii=False) |
| inputs = tokenizer(input_text, return_tensors="pt", truncation=False, padding=False).to(device) |
| |
| with torch.no_grad(): |
| outputs = model.generate(**inputs, max_new_tokens=8_192, temperature=1.0, do_sample=True) |
| generated_tokens = outputs[0][inputs["input_ids"].shape[1]:] |
| decoded = tokenizer.decode(generated_tokens, skip_special_tokens=True) |
| ``` |
|
|
| Will of course need adjustment for batch processing, and highly recommend checking for invalid json and additional characters being output. |
|
|
| Trained on approx 5000 synthetic research project titles, summaries, and structured elements, for 2 epochs using an RTX6000 Pro |
| * Learning rate: 3e-5 |
| * Effective batch size: 128 |
| * Time taken: Under 2 hours |
|
|