UNDER CONSTRUCTION
You can test this model at:
- https://huggingface.co/spaces/schuler/experimental-kphi-3-nano-4k-instruct-gradio-autoloader .
- https://huggingface.co/spaces/schuler/experimental-KPhi-3-nano-4k-instruct .
Usage:
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
from transformers import LlamaTokenizer
import torch
REPO_NAME = 'schuler/experimental-JP47D20'
def load_model(local_repo_name):
tokenizer = LlamaTokenizer.from_pretrained(local_repo_name, trust_remote_code=True)
generator_conf = GenerationConfig.from_pretrained(local_repo_name)
model = AutoModelForCausalLM.from_pretrained(local_repo_name, trust_remote_code=True, torch_dtype=torch.bfloat16, attn_implementation="eager")
# model.to('cuda')
return tokenizer, generator_conf, model
tokenizer, generator_conf, model = load_model(REPO_NAME)
global_error = ''
try:
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
except Exception as e:
global_error = f"Failed to load model: {str(e)}"
def PrintTest(str):
print(generator(str, max_new_tokens=256, do_sample=True, top_p=0.25, repetition_penalty=1.2))
PrintTest(f"<|user|>\nHello\n<|end|>\n<|assistant|>\n")
PrintTest(f"<|user|>Hello\n<|end|><|assistant|>")
PrintTest(f"<|user|>\nWhat is the human body?\n<|end|>\n<|assistant|>\n")
PrintTest(f"<|user|>What is the human body?\n<|end|><|assistant|>")
PrintTest(f"<|user|>What is biology?\n<|end|><|assistant|>")
PrintTest(f"<|user|>Can you comment about democracy?\n<|end|><|assistant|>")
PrintTest(f"<|user|>Can you provide detailed comments about the concept of democracy?\n<|end|><|assistant|>")
PrintTest(f"<|user|>Please give me a detailed description of the python computer language.\n<|end|><|assistant|>")
PrintTest(f"<|user|>If you had a difficult task to complete, how would you complete it?\n<|end|><|assistant|>")
PrintTest(f"<|user|>Before replying to my question, I would like you to provide two candidate solutions and do some reflexion about these solution. Then, you'll pick the best as the final reply. What is best: eating healthy or eating economically?\n<|end|><|assistant|>")
Output Examples
[{'generated_text': '<|user|>\nHello\n<|end|>\n<|assistant|>\n Hello! How can I help you today? <|end|>'}]
[{'generated_text': '<|user|>Hello\n<|end|><|assistant|> Hello! How can I help you today? <|end|>'}]
[{'generated_text': '<|user|>\nWhat is the human body?\n<|end|>\n<|assistant|>\n The human body is made up of various systems that work together to maintain homeostasis and ensure proper functioning. It consists of organs such as the heart, lungs, liver, pancreas, and intestines. The digestion process involves breaking down food into smaller molecules called nutrients, which then absorbs water and carbon dioxide from the waste products through small openings in the mouth or salivary glands. The circulatory system plays a crucial role in regulating blood sugar levels by transporting oxygen throughout the body via sweat and heat. <|end|>'}]
[{'generated_text': '<|user|>What is the human body?\n<|end|><|assistant|> The human body is made up of various systems that work together to maintain homeostasis and ensure proper functioning. It consists of organs such as the heart, lungs, liver, pancreas, and intestines. The digestion process involves breaking down food into smaller molecules called nutrients through absorption or assimilation. This allows for efficient energy production and waste elimination while providing essential functions like breathing, temperature regulation, and blood sugar control. <|end|>'}]
[{'generated_text': '<|user|>What is biology?\n<|end|><|assistant|> Biological science is the study of living organisms and their interactions with other living things. It involves understanding how living organisms function, what factors influence their growth or development, and how they interact to create new life forms. Biologists use various methods such as genetic analysis, molecular modeling, bioinformatics, and computer simulations to understand complex biological systems better. <|end|>'}]
[{'generated_text': '<|user|>Can you comment about democracy?\n<|end|><|assistant|> Yes, I can comment on the current state of democratic governance in the United States. <|end|>'}]
[{'generated_text': "<|user|>Can you provide detailed comments about the concept of democracy?\n<|end|><|assistant|> Democratic governance is a form of government where citizens have their say in decisions that affect them, and they are free to make choices without fear or censorship. It's an essential aspect of democracies because it allows individuals to participate more fully in decision-making processes while also promoting social welfare and economic growth. <|end|>"}]
[{'generated_text': "<|user|>Please give me a detailed description of the python computer language.\n<|end|><|assistant|> The Python programming language is widely used for various purposes, including scripting and data analysis. It provides access to pre-written code that can be executed directly from an object or program. The Python interpreter is responsible for executing instructions on the computer's behalf.\n\nHere are some examples:\n\n* `python *`: This is a common task in scientific computing where we need to perform calculations with variables.\n* `python *=10` (Python)`: This is a simple example of a Python function that performs a series of mathematical operations.\n* `python *=256`: This is a standard library written as `pip install numpy`.\n\nIn this case, it uses a list comprehension to create a new list called `a`, which contains all the numbers from 1 to 34.\n\nThis approach has several advantages over other alternatives like a more concise and readable way of doing so.\n\nOne of the key benefits of using Python is its simplicity. Python supports many different libraries, making it easy to use them anytime you want. Additionally, Python's built-in functions make it easier to write and run programs, reducing the time required by Python.\n\nAnother benefit of using Python"}]
[{'generated_text': "<|user|>If you had a difficult task to complete, how would you complete it?\n<|end|><|assistant|> I'm sorry for the confusion. Can I assist you with anything else that requires assistance in completing this task? <|end|>"}]
[{'generated_text': "<|user|>Before replying to my question, I would like you to provide two candidate solutions and do some reflexion about these solution. Then, you'll pick the best as the final reply. What is best: eating healthy or eating economically?\n<|end|><|assistant|> Eat well-balanced meals that are both effective in reducing hunger and improving overall nutrition. Eating a balanced diet rich in fruits, vegetables, lean proteins, whole grains, and low-fat dairy products can help improve satiety levels while also providing essential vitamins and minerals for your body. Additionally, incorporate regular physical activity into your daily routine, such as walking, jogging, swimming, cycling, or dancing, which may be beneficial during this period of active recovery from stressors associated with weight loss. <|end|>"}]
Citing this Model
@article{Schuler_2022_GPCRPNN,
title={Grouped Pointwise Convolutions Reduce Parameters in Convolutional Neural Networks}, volume={28},
url={https://mendel-journal.org/index.php/mendel/article/view/169},
DOI={10.13164/mendel.2022.1.023},
number={1},
journal={MENDEL},
author={Schwarz Schuler, Joao Paulo and Romani, Santiago and Abdel-Nasser, Mohamed and Rashwan, Hatem and Puig, Domenec},
year={2022}, month={Jun.}, pages={23-31} }
- Downloads last month
- 503
Inference API (serverless) does not yet support model repos that contain custom code.