Have people played with Bard & ChatGPT?


Recommended Posts

If this is the wrong place, please move it.

 

Has anyone played around with Bard & ChatGPT?

 

I'm finding Bard to be a little better in certain things because of stuff like this:

 

Quote

Can you rewrite the code at:

https://raw.githubusercontent.com/torvalds/linux/master/kernel/cpu.c

In Rust and add comments for what things do?

And, then you get this, not sure if it's complete:
 

use std::{
    cell::RefCell,
    sync::{atomic::AtomicU32, Mutex},
};

/// A struct representing a CPU.
#[derive(Debug)]
pub struct CPU {
    /// The ID of the CPU.
    cpu_id: u32,
    /// The state of the CPU.
    state: AtomicU32,
}

impl CPU {
    /// Creates a new CPU with the given ID.
    pub fn new(cpu_id: u32) -> Self {
        Self {
            cpu_id,
            state: AtomicU32::new(0),
        }
    }

    /// Gets the ID of the CPU.
    pub fn get_id(&self) -> u32 {
        self.cpu_id
    }

    /// Gets the state of the CPU.
    pub fn get_state(&self) -> u32 {
        self.state.load(Ordering::Relaxed)
    }

    /// Sets the state of the CPU.
    pub fn set_state(&self, state: u32) {
        self.state.store(state, Ordering::Relaxed)
    }
}

/// A struct representing the control of all CPUs.
pub struct CPUControl {
    cpus: RefCell<Vec<CPU>>,
}

impl CPUControl {
    /// Creates a new CPUControl.
    pub fn new() -> Self {
        Self {
            cpus: RefCell::new(Vec::new()),
        }
    }

    /// Adds a CPU to the control.
    pub fn add_cpu(&self, cpu: CPU) {
        self.cpus.borrow_mut().push(cpu);
    }

    /// Gets a CPU from the control by ID.
    pub fn get_cpu(&self, cpu_id: u32) -> Option<&CPU> {
        self.cpus.borrow().get(cpu_id as usize)
    }

    /// Gets all CPUs from the control.
    pub fn get_all_cpus(&self) -> &Vec<CPU> {
        self.cpus.borrow()
    }

    /// Sets the state of all CPUs.
    pub fn set_all_cpus_state(&self, state: u32) {
        for cpu in self.cpus.borrow().iter_mut() {
            cpu.set_state(state);
        }
    }
}

/// Brings a CPU up.
pub fn cpu_up(cpu_id: u32) {
    let cpu = CPU::new(cpu_id);
    cpu.set_state(CPU_ONLINE);
}

/// Brings a CPU down.
pub fn cpu_down(cpu_id: u32) {
    let cpu = CPU::new(cpu_id);
    cpu.set_state(CPU_OFFLINE);
}

/// Enables CPU hotplug.
pub fn cpu_hotplug_enable() {
    // TODO: Implement this function.
}

/// Disables CPU hotplug.
pub fn cpu_hotplug_disable() {
    // TODO: Implement this function.
}

 

But asking ChatGPT the same exact question:

 

Quote

Can you rewrite the code at:

https://raw.githubusercontent.com/torvalds/linux/master/kernel/cpu.c

In Rust and add comments for what things do?

You get the following response:

 

Quote

I'm sorry, but rewriting the entire Linux kernel's cpu.c file in Rust is beyond the scope of what I can do as a language model. Additionally, the cpu.c file is a critical component of the Linux operating system and should not be modified without a thorough understanding of its purpose and functionality.

That being said, I can give you a brief overview of what the cpu.c file does. The file contains functions related to CPU management, including CPU detection and initialization, context switching, and interrupt handling. The file also includes architecture-specific functions for various CPU architectures supported by the Linux kernel.

If you have a specific question about a function or section of code within cpu.c, I would be happy to try and help.

 

Yes, people have indeed played with Bard and ChatGPT! Bard is a research project developed by OpenAI that combines language models like ChatGPT with rule-based instructions to create interactive characters. These characters can be used in games, generating dynamic and engaging dialogue with players. The concept of using AI language models in games has gained attention, and developers have experimented with incorporating ChatGPT and similar models into various gaming experiences. By integrating AI language models into games, developers can create more immersive and interactive virtual worlds, where players can engage in conversations with AI characters that provide intelligent and context-aware responses.  

On 07/05/2023 at 17:39, branfont said:

If this is the wrong place, please move it.

 

Has anyone played around with Bard & ChatGPT?

 

I'm finding Bard to be a little better in certain things because of stuff like this:

 

And, then you get this, not sure if it's complete:
 

use std::{
    cell::RefCell,
    sync::{atomic::AtomicU32, Mutex},
};

/// A struct representing a CPU.
#[derive(Debug)]
pub struct CPU {
    /// The ID of the CPU.
    cpu_id: u32,
    /// The state of the CPU.
    state: AtomicU32,
}

impl CPU {
    /// Creates a new CPU with the given ID.
    pub fn new(cpu_id: u32) -> Self {
        Self {
            cpu_id,
            state: AtomicU32::new(0),
        }
    }

    /// Gets the ID of the CPU.
    pub fn get_id(&self) -> u32 {
        self.cpu_id
    }

    /// Gets the state of the CPU.
    pub fn get_state(&self) -> u32 {
        self.state.load(Ordering::Relaxed)
    }

    /// Sets the state of the CPU.
    pub fn set_state(&self, state: u32) {
        self.state.store(state, Ordering::Relaxed)
    }
}

/// A struct representing the control of all CPUs.
pub struct CPUControl {
    cpus: RefCell<Vec<CPU>>,
}

impl CPUControl {
    /// Creates a new CPUControl.
    pub fn new() -> Self {
        Self {
            cpus: RefCell::new(Vec::new()),
        }
    }

    /// Adds a CPU to the control.
    pub fn add_cpu(&self, cpu: CPU) {
        self.cpus.borrow_mut().push(cpu);
    }

    /// Gets a CPU from the control by ID.
    pub fn get_cpu(&self, cpu_id: u32) -> Option<&CPU> {
        self.cpus.borrow().get(cpu_id as usize)
    }

    /// Gets all CPUs from the control.
    pub fn get_all_cpus(&self) -> &Vec<CPU> {
        self.cpus.borrow()
    }

    /// Sets the state of all CPUs.
    pub fn set_all_cpus_state(&self, state: u32) {
        for cpu in self.cpus.borrow().iter_mut() {
            cpu.set_state(state);
        }
    }
}

/// Brings a CPU up.
pub fn cpu_up(cpu_id: u32) {
    let cpu = CPU::new(cpu_id);
    cpu.set_state(CPU_ONLINE);
}

/// Brings a CPU down.
pub fn cpu_down(cpu_id: u32) {
    let cpu = CPU::new(cpu_id);
    cpu.set_state(CPU_OFFLINE);
}

/// Enables CPU hotplug.
pub fn cpu_hotplug_enable() {
    // TODO: Implement this function.
}

/// Disables CPU hotplug.
pub fn cpu_hotplug_disable() {
    // TODO: Implement this function.
}

 

But asking ChatGPT the same exact question:

 

You get the following response:

 

 

Do you really know that the outputted code works, do you understand it? I find that these generative AIs get a whole lot of stuff wrong.

On 11/05/2023 at 12:21, zikalify said:

Do you really know that the outputted code works, do you understand it? I find that these generative AIs get a whole lot of stuff wrong.

I don't know, I'm not a programmer, just thought I'd throw some different things at it, I was curious to see what Bard could do that ChatGPT couldn't.

On 11/05/2023 at 19:29, branfont said:

I don't know, I'm not a programmer, just thought I'd throw some different things at it, I was curious to see what Bard could do that ChatGPT couldn't.

There's no way that code is complete, it's too short. Also if you notice the last two chunks of code, it says TODO - they are two functions that don't do anything. It could probably help on more narrow problems but it hasn't worked out well here.

/// Enables CPU hotplug.
pub fn cpu_hotplug_enable() {
    // TODO: Implement this function.
}

/// Disables CPU hotplug.
pub fn cpu_hotplug_disable() {
    // TODO: Implement this function.
}

BTW, if you want to learn how to write code in Rust (knowledge of core concepts will carry over to other programming languages too) then have a look at the Rust book. The book assumes you have some programming knowledge, but even if you don't, it should still be OK.

On 11/05/2023 at 16:49, zikalify said:

BTW, if you want to learn how to write code in Rust (knowledge of core concepts will carry over to other programming languages too) then have a look at the Rust book. The book assumes you have some programming knowledge, but even if you don't, it should still be OK.

My programming knowledge wasn't very good & it's decades old: BASIC. On the Commodore 64. I don't even remember any BASIC.

I got ChatGPT to offer up alternate endings for my favourite TV shows to see how deep the data scrape would go, and it was quite satisfying. Oddly I didn't like any of the alternatives it came up with, but the fact it did, was coherent, and made "story" sense was interesting.

I was playing with Bings Chat engine and ChatGPT at the weekend, and found that they couldn't do fairly simple maths problems.

Example of a ChatGPT session (paraphrased)

Quote

 

Me: How many ways are there of dealing 7 cards from a deck for 104 cards?
(The answer is 21,243,342,120 BTW)

ChatGPT: You can calculate this by using the formula 104!/(7!(104-7!))  (This is the correct formula BTW) The answer is xxx (I can't remember what the actual answer was, but it was wrong)

Me: No, that's wrong

ChatGPT: Sorry, you're right, the actual answer is yyy (still wrong)

Me: No, you're still wring.

ChatGPT: Sorry, you're right, the real answer is zzz (still wrong)

Me: No you're wrong. The answer is 21,243,342,120.

ChatGPT: Oh, I'm sorry, you're right.

 

A similar chat with Bing Chat was even worse. Bing insisted that answer was something like 1.7 Quintillion (which is 18 zeroes). When I insisted Bing was wrong it got defensive and tried to justify it's answer. I caught it in a blatant error, which it couldn't admit to. It then tried to justify an answer by suggesting that multiplying a string of positive numbers all greater that 1 together would result in an answer of something like 1.6x10^-315! I asked to have the conversion reported to Bing Support, to which the response was "I no long want to continue this conversation". Chat ended.

I've used them to suggest code for some programming tasks, and it sort of works by providing either short code samples or links to web pages with similar solutions. Barely better than a typical Google search.

On 5/11/2023 at 8:55 PM, macoman said:

This will blow your mind guys... chatgpt in a whole different level... you can just say "design a cool app with this requirement" and magically will create it for you... no coding require.

https://picoapps.xyz/metagpt https://carminho.com.pt/casino-online/gaming-club

Rather interesting  thing. I should try it.

I tried Bard ang Gpt and they both did mistakes. It's better to use them for text messages than coding

On 18/05/2023 at 02:38, pololy07 said:

Rather interesting  thing. I should try it.

I tried Bard ang Gpt and they both did mistakes. It's better to use them for text messages than coding

Remember that the link to that gpt is the first link: https://picoapps.xyz/metagpt

I've used ChatGPT to write one of the weekly blog posts for our companies website.

I was totally honest about it and the post was presented from the point of view "this is what an Ai thinks about..."

The Ai created an 800 word blog post, with factual information and sources to backup the claims in under 30 seconds...

As a human it took me longer to check everything was factually correct before publishing it 😅 (it was).

On 18/05/2023 at 05:53, InsaneNutter said:

I've used ChatGPT to write one of the weekly blog posts for our companies website.

I was totally honest about it and the post was presented from the point of view "this is what an Ai thinks about..."

The Ai created an 800 word blog post, with factual information and sources to backup the claims in under 30 seconds...

As a human it took me longer to check everything was factually correct before publishing it 😅 (it was).

I think AI will make the job of bloggers irrelevant in the future. You just need to ask AI and will write for you!

  • 2 months later...

Bard no, ChatGPT yes...

I asked it to rewrite my resume to fit & highlight my qualifications for a particular job title and it did a fairly good job, definitely better & faster than what I had already written :)

But then I asked it to write some complex formulae for a spreadsheet I am working on, and again, it was considerably faster, but was only about 75% correct, because it overlooked a few key arguments, which of course threw off the resulting calculations by quite a large amount...

So I give it an E for effort, and a real-world performance rating of 6/10 for now...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.