You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)
messages=[{"role":"system","content":"Answer the question based on the given document.Only give me the answer and do not output any other words.\nThe following are given documents.\n\nDoc 1(Title: "Ebenezer Howard") Ebenezer Howard Sir Ebenezer Howard (29 January 1850 \u2013 1 May 1928), the English founder of the garden city movement, is known for his publication """" (1898), the description of a utopian city in which people live harmoniously together with nature. The publication resulted in the founding of the garden city movement, and the building of the First Garden City, Letchworth Garden City, commenced in 1903. The second true Garden City was Welwyn Garden City (1920) and the movement influenced the development of several model suburbs in other countries, such as Forest Hills Gardens designed by F. L. Olmsted Jr.\nDoc 2(Title: "New Earswick") founded by the York philanthropist, Joseph Rowntree, who was quoted as saying, ""I do not want to establish communities bearing the stamp of charity but rather of rightly ordered and self governing communities"". The first 28 houses were built between 1902 and 1904 by the architect Raymond Unwin, after which the Joseph Rowntree Village Trust (now the Joseph Rowntree Housing Trust) was established to continue building and manage the new village. The Joseph Rowntree Housing Trust is part of the Joseph Rowntree Foundation. The village had contemporaries such as Bournville, Saltaire, Port Sunlight and others. This was in sharp contrast\nDoc 3(Title: "Ideal city") Other notable example of the concept is Zamo\u015b\u0107 in eastern Poland founded in the late 16th century, modelled by the Italian architect Bernardo Morando. James Oglethorpe synthesized Classical and Renaissance concepts of the ideal city with new Enlightenment ideals of scientific planning, harmony in design, and social equality in his plan for the Province of Carolina. The physical design component of the famous Oglethorpe Plan remains preserved in the Savannah Historic District. Late nineteenth-century examples of the ideal city include the Garden city movement of Sir Ebenezer Howard, realised at Letchworth Garden City and Welwyn Garden City in England. Poundbury,\nDoc 4(Title: "Planned community") UK was undoubtedly the Edinburgh New Town, built in accordance with a 1766 master plan by James Craig, and (along with Bath and Dublin) the archetype of the elegant Georgian style of British architecture. The term ""new town"" often refers in the UK to towns built after World War II under the New Towns Act 1946. These were influenced by the garden city movement, launched around 1900 by Ebenezer Howard and Sir Patrick Geddes and the work of Raymond Unwin, and manifested at Letchworth Garden City and Welwyn Garden City in Hertfordshire. Following World War II, some 28 projected towns\nDoc 5(Title: "Urban design") to house 32,000 people on a site . He planned on a concentric pattern with open spaces, public parks, and six radial boulevards, wide, extending from the center. When it reached full population, Howard wanted another garden city to be developed nearby. He envisaged a cluster of several garden cities as satellites of a central city of 50,000 people, linked by road and rail. His model for a garden city was first created at Letchworth and Welwyn Garden City in Hertfordshire. Howard's movement was extended by Sir Frederic Osborn to regional planning. In the early 1900s, urban planning became professionalized.\n"},{"role":"user","content":"Question: who designed the garden city of new earswick."}]
prompt = "\n".join(message['content'] for message in messages if message['content'])
inputs = tokenizer(prompt, return_tensors="pt",max_length=2048)
outputs = model.generate(inputs['input_ids'], max_new_tokens=32,do_sample=False)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(answer)
Output
<Remember to wrap the output in ```triple-quotes blocks```>
Question: who designed the garden city of new earswick.
Answer:
Raymond Unwin
``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ```
## Runtime Environment
- Model: `meta-llama-3-8b-instruct`
- OS: Linux
- GPU VRAM: 3090
- Number of GPUs: 1
- GPU Make: Nvidia
**Additional context**
torch
The text was updated successfully, but these errors were encountered:
Before submitting a bug, please make sure the issue hasn't been already addressed by searching through the FAQs and existing/past issues
Describe the bug
I downloaded Llama-3-8B-Instruct and used it to generate answer, the output had too many meaningless symbols like "```"
![image](https://private-user-images.githubusercontent.com/98083104/402200449-075e2cca-6b79-444a-9125-6a1aa1a8e66d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTExNDgsIm5iZiI6MTczOTU5MDg0OCwicGF0aCI6Ii85ODA4MzEwNC80MDIyMDA0NDktMDc1ZTJjY2EtNmI3OS00NDRhLTkxMjUtNmExYWExYThlNjZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAzNDA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI1YjBmMGZhMDg4NjI2ZWQ5YmU1MDQwMDAxZTZkOWJhMDE2ZDgwYWU5ZGEzNGYwNTYxZmIxYTM1MzYyNDFiYmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.vfRJjmSRyF4X136SzowgS4jVajQk5EwXm5CmXlOYdW8)
# sample code to repro the bug
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
torch.manual_seed(2024)
model_path = "/home/llama-3-8b"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)
messages=[{"role":"system","content":"Answer the question based on the given document.Only give me the answer and do not output any other words.\nThe following are given documents.\n\nDoc 1(Title: "Ebenezer Howard") Ebenezer Howard Sir Ebenezer Howard (29 January 1850 \u2013 1 May 1928), the English founder of the garden city movement, is known for his publication """" (1898), the description of a utopian city in which people live harmoniously together with nature. The publication resulted in the founding of the garden city movement, and the building of the First Garden City, Letchworth Garden City, commenced in 1903. The second true Garden City was Welwyn Garden City (1920) and the movement influenced the development of several model suburbs in other countries, such as Forest Hills Gardens designed by F. L. Olmsted Jr.\nDoc 2(Title: "New Earswick") founded by the York philanthropist, Joseph Rowntree, who was quoted as saying, ""I do not want to establish communities bearing the stamp of charity but rather of rightly ordered and self governing communities"". The first 28 houses were built between 1902 and 1904 by the architect Raymond Unwin, after which the Joseph Rowntree Village Trust (now the Joseph Rowntree Housing Trust) was established to continue building and manage the new village. The Joseph Rowntree Housing Trust is part of the Joseph Rowntree Foundation. The village had contemporaries such as Bournville, Saltaire, Port Sunlight and others. This was in sharp contrast\nDoc 3(Title: "Ideal city") Other notable example of the concept is Zamo\u015b\u0107 in eastern Poland founded in the late 16th century, modelled by the Italian architect Bernardo Morando. James Oglethorpe synthesized Classical and Renaissance concepts of the ideal city with new Enlightenment ideals of scientific planning, harmony in design, and social equality in his plan for the Province of Carolina. The physical design component of the famous Oglethorpe Plan remains preserved in the Savannah Historic District. Late nineteenth-century examples of the ideal city include the Garden city movement of Sir Ebenezer Howard, realised at Letchworth Garden City and Welwyn Garden City in England. Poundbury,\nDoc 4(Title: "Planned community") UK was undoubtedly the Edinburgh New Town, built in accordance with a 1766 master plan by James Craig, and (along with Bath and Dublin) the archetype of the elegant Georgian style of British architecture. The term ""new town"" often refers in the UK to towns built after World War II under the New Towns Act 1946. These were influenced by the garden city movement, launched around 1900 by Ebenezer Howard and Sir Patrick Geddes and the work of Raymond Unwin, and manifested at Letchworth Garden City and Welwyn Garden City in Hertfordshire. Following World War II, some 28 projected towns\nDoc 5(Title: "Urban design") to house 32,000 people on a site . He planned on a concentric pattern with open spaces, public parks, and six radial boulevards, wide, extending from the center. When it reached full population, Howard wanted another garden city to be developed nearby. He envisaged a cluster of several garden cities as satellites of a central city of 50,000 people, linked by road and rail. His model for a garden city was first created at Letchworth and Welwyn Garden City in Hertfordshire. Howard's movement was extended by Sir Frederic Osborn to regional planning. In the early 1900s, urban planning became professionalized.\n"},{"role":"user","content":"Question: who designed the garden city of new earswick."}]
prompt = "\n".join(message['content'] for message in messages if message['content'])
inputs = tokenizer(prompt, return_tensors="pt",max_length=2048)
outputs = model.generate(inputs['input_ids'], max_new_tokens=32,do_sample=False)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(answer)
Output
<Remember to wrap the output in
```triple-quotes blocks```
>Question: who designed the garden city of new earswick.
Answer:
The text was updated successfully, but these errors were encountered: