Edit model card

JPNsensei-V2

Model Application

This is a QA model specifically tailored for answering questions about learning Japanese in English.

Model Description

It is built upon the japanese-stablelm-instruct-gamma-7b base model. To optimize the quality of responses, please adhere to the specified prompt format.

Uses

Ensure you are using Transformers 4.34.0 or newer.

model = AutoModelForCausalLM.from_pretrained(
    "kanxxyc/JPNsensei-V2", low_cpu_mem_usage=True,
    return_dict=True,torch_dtype=torch.bfloat16,
    device_map= {"": 0}
)
tokenizer = AutoTokenizer.from_pretrained("kanxxyc/JPNsensei-V2")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)

text_generation_pipeline = transformers.pipeline(
    model=model,
    tokenizer=tokenizer,
    task="text-generation",
    pad_token_id=tokenizer.eos_token_id, 
    temperature=0.2,
    do_sample=True,
    repetition_penalty=1.1,
    max_new_tokens=1024,

)

mistral_llm = HuggingFacePipeline(pipeline=text_generation_pipeline)
prompt_template = """
### Instruction: Given a title and a question, your task is to generate an appropriate answer based on the context provided, using simple English to explain any Japanese language-related queries.

### title:
{title}

### question:
{question}

### answer:
"""
prompt = PromptTemplate(
    input_variables=["title", "question"],
    template=prompt_template,
)


llm_chain = LLMChain(llm=mistral_llm, prompt=prompt)

Training Data

Data from Stack Exchange Japanese site (https://japanese.stackexchange.com/)

Evaluation

To be updated.

Downloads last month
4
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.