• 0 Posts
  • 21 Comments
Joined 1 year ago
cake
Cake day: July 27th, 2023

help-circle

  • I’d be interested in setting up the highest quality models to run locally, and I don’t have the budget for a GPU with anywhere near enough VRAM, but my main server PC has a 7900x and I could afford to upgrade its RAM - is it possible, and if so how difficult, to get this stuff running on CPU? Inference speed isn’t a sticking point as long as it’s not unusably slow, but I do have access to an OpenAI subscription so there just wouldn’t be much point with lower quality models except as a toy.


  • Well they said .NET Framework, and I also wouldn’t be surprised if they more or less wrapped that up - .NET Framework specifically means the old implementation of the CLR, and it’s been pretty much superseded by an implementation just called .NET, formerly known as .NET Core (definitely not confusing at all, thanks Microsoft). .NET Framework was only written for Windows, hence the need for Mono/Xamarin on other platforms. In contrast, .NET is cross-platform by default.




  • The issue is that, in the function passed to reduce, you’re adding each object directly to the accumulator rather than to its intended parent. These are the problem lines:

    if (index == array.length - 1) {
    	accumulator[val] = value;
    } else if (!accumulator.hasOwnProperty(val)) {
    	accumulator[val] = {}; // update the accumulator object
    }
    

    There’s no pretty way (that I can think of at least) to do what you want using methods like reduce in vanilla JS, so I’d suggest using a for loop instead - especially if you’re new to programming. Something along these lines (not written to be actual code, just to give you an idea):

    let curr = settings;
    const split = url.split("/");
    for (let i = 0; i < split.length: i++) {
        const val = split[i];
        if (i != split.length-1) {
            //add a check to see if curr[val] exists
            let next = {};
            curr[val] = next;
            curr = next;
        }
        //add else branch
    }
    

    It’s missing some things, but the important part is there - every time we move one level deeper in the URL, we update curr so that we keep our place instead of always adding to the top level.






  • The issue is not just that a bad update went out. Freak accidents can happen. Software is complicated and you can never be 100% sure. The problem is the specifics. A fat finger should never be able to push a bad update to a system in customers’ hands, forget a system easily capable of killing people in a multitude of ways. I’m not quite as critical as the above commentor but this is a serious issue that should raise major questions about their culture and procedures.

    This isn’t just some website where a fat finger at worst means the site is down for a while (assuming you do the bare minimum and back up your db). This is a vehicle. That’s what they meant about the CAN bus - not that that’s really a concern when the infotainment system just gets bricked, but that they have such lax procedures around software that touches a safety-critical system.

    Having systems in place to ensure only tested, known good builds are pushed is pretty damn basic safety practice. Swiss cheese model. If they can’t even handle the basics, what other bad practices do they have?

    Again, not that I think this is necessarily as bad as the other person - perhaps this is the only mistake they’ve made in their safety procedures and otherwise they’re industry leaders - we don’t know that yet. But this is extremely concerning and until proven otherwise should be investigated and treated as a very serious safety violation. Safety first.


  • Currying is converting a function with n parameters to n functions that each have one parameter. This is done automatically in most primarily functional languages. Then, partial application is when you supply less than n arguments to a curried function. In short, currying happens at the function definition and partial application happens at the function call.

    Currently the type of test_increment is (int, int) -> unit -> unit. What we want is int -> int -> unit -> unit. The more idiomatic way would have this function definition:

    let test_increment new_value original_value () =
    

    Which would require this change in the callers:

    test_case "blah" `Quick (test_increment 1 0);
    

    See, in most primarily functional languages you don’t put parentheses around function parameters/arguments, nor commas between them - in this case, only around and between members of tuples.


  • I’m not an OCaml person but I do know other functional languages. I looked into Alcotest and it looks like the function after “`Quick” has to be unit -> unit. Because OCaml has currying, and I think test_increment already returns unit, all you should have to do is add an extra parameter of type unit. I believe that would be done like this:

    let test_increment (new_value, original_value) () =
    

    Now the expression test_increment (1, 0) returns a function that must be passed a unit to run its body. That means you can change the lambdas to e.g. this:

    test_case "blah" `Quick (test_increment (1, 0))
    

    I don’t know OCaml precedence rules so the enclosing parentheses here may not be necessary.

    I’d also note that taking new_value and original_value as a tuple would probably be considered not idiomatic unless it makes sense for the structure of the rest of your code, especially because it limits currying like we did with the unit being able to be passed later. Partial application/currying is a big part of the flexibility of functional languages.

    Edit: if you’re getting into functional programming you may also consider calling increment_by_one “succ” or “successor” which is the typical terminology in functional land.


  • No, and the above commentor is a little mixed up. While we originally thought the benefit of RISC CPUs was their smaller instruction set - hence the name - it’s turned out that the gains really come from a couple other things common to RISC architectures. In x86 pretty much every instruction can reference memory directly, but in RISC architectures you can only do it from a few specific instructions. Modern RISC architectures actually tend to have a lot of instructions, so RISC means something more like “load/store architecture” nowadays.

    Another big part of RISC architectures is they try to make instruction fetch+decode as easy as possible. x86 instructions are a nightmare to decode and that adds a lot of complexity and somewhat limits optimization opportunities. There’s some more to it, like how RISC thinks about the job of the compiler, but in my experience load/store and ease of fetch+decode are the main differentiators for RISC.

    More towards your question, a lot of the issues with running x86 programs on ARM (really running any program on a different architecture than it was compiled for) is that it will likely depend on very specific behaviors that may not be the same across architectures and may be computationally expensive to emulate. For some great write-ups about that kind of thing check out the Dolphin (Wii emulator) blog posts.




  • Box is (basically) just the way to have memory on the heap. Here’s a direct comparison of how to do heap memory in C/++ and in rust:

    int* intOnHeap = (int*)malloc(sizeof(int));
    *intOnHeap = 0;
    MyClass* classOnHeap = new MyClass();
    
    let intOnHeap: Box = Box::new(0);
    let structOnHeap: Box = Box::new(MyStruct::default());
    

    There can be a bit more to it with custom allocators etc. but that’s the only way most people will use boxes. So Box basically just means “a T is allocated somewhere and we need to free that memory when this value is dropped”.