--- library_name: transformers license: mit language: - en - vi pipeline_tag: text-generation base_model: HuggingFaceH4/zephyr-7b-beta --- # Model Card for Model ID **Ghost 7B Alpha, flying, v0.7.0** ## Model Details ### Model Description This model is fine tuned from **HuggingFaceH4/zephyr-7b-beta** on a small synthetic datasets (about 200MB) for 50% English and 50% Vietnamese. - **Developed by:** **Lam H** - **Language(s) (NLP):** English, Vietnamese - **License:** MIT - **Finetuned from model:** [HuggingFaceH4/zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) ## Uses This model supports both conversation chat and tasks. Feel free to experiment and don't limit your creativity. The simplest way to try it is to use the `pipeline` from `transformers`. ```python import torch from transformers import pipeline pipe = pipeline( "text-generation", model="lamhieu/ghost-7b-v0.9.0", torch_dtype=torch.bfloat16, ) ``` You can then try any of the sample codes below, formatted using the chat template. ```python messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "nói tôi biết bệnh dịch hạch ở châu Âu do khuẩn nào gây ra"}, ] prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False) outputs = pipe.model.generate(**tokenized, max_new_tokens=512) results = tokenizer.batch_decode(outputs)[0] print(results) # Output: # Bệnh dịch hạch ở châu Âu do khuẩn gây ra là do khuẩn Yersinia pestis. ``` ```python messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Thông tin về Peristernia despecta"}, ] prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False) outputs = pipe.model.generate(**tokenized, max_new_tokens=512) results = tokenizer.batch_decode(outputs)[0] print(results) # Output: # Peristernia despecta là một loài ốc biển, là động vật thân mềm chân bụng sống ở biển trong họ Fasciolariidae. # ... ``` ```python messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "do u know vietnam ?"}, ] prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False) outputs = pipe.model.generate(**tokenized, max_new_tokens=512) results = tokenizer.batch_decode(outputs)[0] print(results) # Output: # Yes, I have knowledge about Vietnam. Vietnam is a country in Southeast Asia, bordered by China to the north, Laos and Cambodia to the west, and the South China Sea to the east and south. Its capital city is Hanoi, and its largest city is Ho Chi Minh City (formerly known as Saigon). Vietnam has a population of approximately 100 million people and a diverse cultural heritage influenced by both Chinese and French colonialism. The country has a rich history, including periods of independence, colonization, and resistance, and has experienced significant economic growth in recent years. ``` ```python messages = [ {"role": "system", "content": "You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old."}, {"role": "user", "content": "Tôi yêu em nhiều hơn em nghĩ.\n\nWhich language is this?"}, ] prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False) outputs = pipe.model.generate(**tokenized, max_new_tokens=512) results = tokenizer.batch_decode(outputs)[0] print(results) # Output # This is Vietnamese language. Vietnamese is a language spoken mainly in Vietnam and by the Vietnamese diaspora in many other countries. The sentence you provided means "I love you more than you think." It's like you have more love for someone than they realize. ``` ## More Information Thank you very much [5CD-AI](https://huggingface.co/5CD-AI) and [vilm](https://huggingface.co/vilm), this model uses datasets released by these two organizations. ## Model Card Contact **Lam H** (lamhieu.vk@gmail.com)