lamm-mit / BioinspiredLlama-3-1-8B-128k

huggingface.co
Total runs: 22
24-hour runs: -1
7-day runs: -7
30-day runs: -3
Model's Last Updated: July 31 2024
text-generation

Introduction of BioinspiredLlama-3-1-8B-128k

Model Details of BioinspiredLlama-3-1-8B-128k

Inference example
model_name='lamm-mit/BioinspiredLlama-3-1-8B-128k'

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    trust_remote_code=True,
    device_map="auto",
    torch_dtype =torch.bfloat16,
    attn_implementation="flash_attention_2"
)
model.config.use_cache = True
tokenizer = AutoTokenizer.from_pretrained(model_name)

Check https://huggingface.co/lamm-mit/BioinspiredLlama-3-1-8B-128k-dominant-protein-SS-structure for further examples use of the model for protein structural features prediction, including a fine-tuning script.

Function to interact with the model
def generate_response (text_input="What is spider silk?",
                       system_prompt='',
                       num_return_sequences=1,
                       temperature=1., #the higher the temperature, the more creative the model becomes
                       max_new_tokens=127,device='cuda',
                       add_special_tokens = False, #since tokenizer.apply_chat_template adds <|begin_of_text|> template already, set to False
                       num_beams=1,eos_token_id= [
                                            128001,
                                            128008,
                                            128009
                                          ], verbatim=False,
                       top_k = 50,
                       top_p = 0.9,
                       repetition_penalty=1.1,
                       messages=[],
                      ):

    if messages==[]: #start new messages dictionary
        if system_prompt != '': #include system prompt if provided
            messages.extend ([  {"role": "system", "content": system_prompt},  ])
        messages.extend ( [   {"role": "user", "content": text_input}, ])
        
    else: #if messages provided, will extend (make sure to add previous response as assistant message)
        messages.append ({"role": "user", "content": text_input})
        
    text_input = tokenizer.apply_chat_template(
            messages, 
            tokenize=False, 
            add_generation_prompt=True
    )
    inputs = tokenizer([text_input],  add_special_tokens = add_special_tokens,  return_tensors ='pt' ).to(device)
    if verbatim:
        print (inputs)
    with torch.no_grad():
          outputs = model.generate(**inputs,
                                   max_new_tokens=max_new_tokens,
                                   temperature=temperature, 
                                   num_beams=num_beams,
                                   top_k = top_k,eos_token_id=eos_token_id,
                                   top_p =top_p,
                                   num_return_sequences = num_return_sequences, 
                                   do_sample =True, repetition_penalty=repetition_penalty,
                                  )
    outputs=outputs[:, inputs["input_ids"].shape[1]:]
    return tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True), messages             

Usage:

res,_= generate_response (text_input = "What is collagen?", system_prompt = 'You are a materials scientist.',
                      num_return_sequences=1,
                      temperature=1., #the higher the temperature, the more creative the model becomes
                      max_new_tokens=127,
                      num_beams=1,  
                      top_k = 50, top_p =0.9, repetition_penalty=1.1,
                       
                      )
print (res[0])

To realize multi-turn interactions, see this example:

res, messages = generate_response (text_input="What is spider silk?", messages=[])
messages.append ({"role": "assistant", "content": res[0]}, ) #append result to messages dict 
print (res)
res, messages = generate_response (text_input="Explain this result in detail.", messages=messages)
messages.append ({"role": "assistant", "content": res[0]}, ) #append result to messages dict 
print (res)
res, messages = generate_response (text_input="Provide this in JSON format.", messages=messages)
messages.append ({"role": "assistant", "content": res[0]}) #append result to messages dict 
print (res)
Fine-tuning script

See ( https://huggingface.co/lamm-mit/BioinspiredLlama-3-1-8B-128k-dominant-protein-SS-structure ) for a Colab fine-tuning script.

Runs of lamm-mit BioinspiredLlama-3-1-8B-128k on huggingface.co

22
Total runs
-1
24-hour runs
-4
3-day runs
-7
7-day runs
-3
30-day runs

More Information About BioinspiredLlama-3-1-8B-128k huggingface.co Model

BioinspiredLlama-3-1-8B-128k huggingface.co

BioinspiredLlama-3-1-8B-128k huggingface.co is an AI model on huggingface.co that provides BioinspiredLlama-3-1-8B-128k's model effect (), which can be used instantly with this lamm-mit BioinspiredLlama-3-1-8B-128k model. huggingface.co supports a free trial of the BioinspiredLlama-3-1-8B-128k model, and also provides paid use of the BioinspiredLlama-3-1-8B-128k. Support call BioinspiredLlama-3-1-8B-128k model through api, including Node.js, Python, http.

BioinspiredLlama-3-1-8B-128k huggingface.co Url

https://huggingface.co/lamm-mit/BioinspiredLlama-3-1-8B-128k

lamm-mit BioinspiredLlama-3-1-8B-128k online free

BioinspiredLlama-3-1-8B-128k huggingface.co is an online trial and call api platform, which integrates BioinspiredLlama-3-1-8B-128k's modeling effects, including api services, and provides a free online trial of BioinspiredLlama-3-1-8B-128k, you can try BioinspiredLlama-3-1-8B-128k online for free by clicking the link below.

lamm-mit BioinspiredLlama-3-1-8B-128k online free url in huggingface.co:

https://huggingface.co/lamm-mit/BioinspiredLlama-3-1-8B-128k

BioinspiredLlama-3-1-8B-128k install

BioinspiredLlama-3-1-8B-128k is an open source model from GitHub that offers a free installation service, and any user can find BioinspiredLlama-3-1-8B-128k on GitHub to install. At the same time, huggingface.co provides the effect of BioinspiredLlama-3-1-8B-128k install, users can directly use BioinspiredLlama-3-1-8B-128k installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

BioinspiredLlama-3-1-8B-128k install url in huggingface.co:

https://huggingface.co/lamm-mit/BioinspiredLlama-3-1-8B-128k

Url of BioinspiredLlama-3-1-8B-128k

BioinspiredLlama-3-1-8B-128k huggingface.co Url

Provider of BioinspiredLlama-3-1-8B-128k huggingface.co

lamm-mit
ORGANIZATIONS

Other API from lamm-mit

huggingface.co

Total runs: 854
Run Growth: 289
Growth Rate: 33.84%
Updated:December 04 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 31 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:April 11 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 04 2024