Views
No views yet
gemma-3n-E4B-it, has been specifically fine-tuned to understand the complex language, nuances, and key concepts within graphene-related scientific abstracts. It serves as a specialized tool to accelerate the research process through precise data extraction, summarization, and question answering.google/gemma-3n-E4B-itq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj) to adapt the model to the specific domain while preserving its core capabilities.bf16 precision for stability and speed, with the adamw_8bit optimizer.1from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
2import torch
3
4model_id = "Shinapri/Matellem-Gemma3n-E4B-Graphene-1"
5
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto").eval()
7tokenizer = AutoTokenizer.from_pretrained(model_id)
8
9INSTRUCTION = "You are a scientific literature search expert. Your task is to identify the title of a research paper based on a user's description of its key methods and findings."
10USER_INPUT = """I'm looking for a paper about manipulating graphene plasmons.
11The key method involved using a ferroelectric nanocavity array to create a periodic doping pattern on the graphene.
12I remember they could tune the plasmon resonance by dynamically changing the applied gate voltage. Can you identify the title?"""
13
14messages = [
15 {"role": "system", "content": [{"type": "text", "text": INSTRUCTION}]},
16 {"role": "user", "content": [{"type": "text", "text": USER_INPUT}]},
17]
18
19prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
20inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
21
22streamer = TextStreamer(tokenizer, skip_prompt=True)
23
24with torch.no_grad():
25 _ = model.generate(
26 **inputs,
27 streamer=streamer,
28 do_sample=True,
29 max_new_tokens=1024,
30 top_p=0.9,
31 temperature=0.7
32 )> The title of the paper is likely: **"Voltage-tunable plasmonics on few-layer graphene based on a ferroelectric nanocavity array"**intfloat/e5-large model.